### GET /pipelines Source: https://context7.com/prometheus-dynamics/pdlib/llms.txt Endpoints for listing, resolving, and inspecting vision pipelines stored on the device. ```APIDOC ## GET /pipelines ### Description Retrieves a list of all vision pipelines stored on the device or resolves a specific pipeline by UUID, name, or alias. ### Method GET ### Endpoint /pipelines ### Parameters #### Query Parameters - **id** (string) - Optional - The UUID, name, or alias of the pipeline to resolve. ### Response #### Success Response (200) - **pipelines** (array) - A list of pipeline objects containing name, id, and summary information. #### Response Example { "pipelines": [ { "name": "apriltag-detector", "id": "uuid-123", "updatedAtMs": 1672531200000 } ] } ``` -------------------------------- ### GET /v1/ws/streams/{id}/metrics Source: https://github.com/prometheus-dynamics/pdlib/blob/main/README.md Establishes a WebSocket connection to receive real-time performance and diagnostic metrics for a specific stream. ```APIDOC ## GET /v1/ws/streams/{id}/metrics ### Description Connects to a WebSocket endpoint to receive diagnostic metrics for a specific HeliOS stream. ### Method GET ### Endpoint /v1/ws/streams/{id}/metrics ### Parameters #### Path Parameters - **id** (string) - Required - The UUID or alias of the stream. ### Response #### Success Response (101 Switching Protocols) - **metrics** (object) - Real-time metric data points. ``` -------------------------------- ### GET /v1/ws/streams/{id}/outputs Source: https://github.com/prometheus-dynamics/pdlib/blob/main/README.md Establishes a WebSocket connection to receive real-time stream outputs for a specific stream ID. ```APIDOC ## GET /v1/ws/streams/{id}/outputs ### Description Connects to a WebSocket endpoint to stream output data from a specific HeliOS stream. ### Method GET ### Endpoint /v1/ws/streams/{id}/outputs ### Parameters #### Path Parameters - **id** (string) - Required - The UUID or alias of the stream to connect to. ### Response #### Success Response (101 Switching Protocols) - **data** (object) - Real-time stream output payload. ``` -------------------------------- ### GET /localization Source: https://context7.com/prometheus-dynamics/pdlib/llms.txt Endpoints for retrieving robot localization data, including field poses and solver outputs from specific profiles. ```APIDOC ## GET /localization ### Description Retrieves available localization profiles and solves for the current robot pose using a specified profile. ### Method GET ### Endpoint /localization ### Parameters #### Query Parameters - **profile** (string) - Optional - The name or ID of the localization profile to use. ### Response #### Success Response (200) - **solve** (object) - The solver response containing pose estimates, standard deviations, and latency. #### Response Example { "pose": { "x": 1.5, "y": 2.0, "rotation": 0.0 }, "timestampSeconds": 123.45, "latency": 0.02 } ``` -------------------------------- ### Initialize HeliOS Client Source: https://context7.com/prometheus-dynamics/pdlib/llms.txt Demonstrates how to instantiate the HeliOS client using either an IP address or a hostname. This is the primary entry point for all subsequent API interactions. ```java import ca.pd.lib.helios.HeliOS; // Initialize with IP address HeliOS cam = new HeliOS("172.31.250.1"); // Initialize with hostname HeliOS cam = new HeliOS("helios-front"); // Access base URI for debugging System.out.println("Connected to: " + cam.baseUri()); ``` -------------------------------- ### Sample Vision Pipeline Outputs Source: https://context7.com/prometheus-dynamics/pdlib/llms.txt Explains how to query available output ports on a stream and sample data from them. This is used to retrieve detection results or processed frame data from vision pipelines. ```java import ca.pd.lib.helios.HeliOS; import ca.pd.lib.helios.HeliOSStream; import ca.pd.lib.helios.HeliOSOutput; import com.fasterxml.jackson.databind.JsonNode; HeliOS cam = new HeliOS("172.31.250.1"); HeliOSStream stream = cam.stream("front-camera"); // Sample a specific output port HeliOSOutput detectionsOutput = stream.output("detections"); JsonNode sample = detectionsOutput.sample(); System.out.println("Detections: " + sample); ``` -------------------------------- ### List and Resolve Camera Streams Source: https://context7.com/prometheus-dynamics/pdlib/llms.txt Shows how to discover available camera streams and resolve them by UUID, alias, or hardware ID. It also covers accessing stream metadata like metrics and calibration data. ```java import ca.pd.lib.helios.HeliOS; import ca.pd.lib.helios.HeliOSStream; import ca.pd.lib.helios.model.HeliosStreamInfo; import java.util.List; import java.util.Optional; HeliOS cam = new HeliOS("172.31.250.1"); // List all streams List streams = cam.streams(); // Resolve stream by alias HeliOSStream stream = cam.stream("front-camera"); // Safe lookup with Optional Optional maybeStream = cam.findStream("back-camera"); // Access stream metadata HeliosStreamInfo info = stream.info(); ``` -------------------------------- ### Retrieve Robot Localization and Pose Estimates Source: https://context7.com/prometheus-dynamics/pdlib/llms.txt Shows how to list localization profiles, perform pose estimation, and retrieve detailed field pose data including standard deviations and latency. ```java import ca.pd.lib.helios.HeliOS; import ca.pd.lib.helios.HeliOSLocalization; import ca.pd.lib.helios.localization.HeliosLocalizationProfile; import ca.pd.lib.helios.localization.HeliosLocalizationSolveResponse; import ca.pd.lib.helios.localization.HeliosPoseEstimate2d; import edu.wpi.first.math.geometry.Pose2d; import java.util.List; import java.util.Optional; HeliOS cam = new HeliOS("172.31.250.1"); // List available localization profiles List profiles = cam.localizations(); for (HeliosLocalizationProfile profile : profiles) { System.out.println("Profile: " + profile.name() + " id=" + profile.id()); } // Use default localization profile HeliOSLocalization localization = cam.localization(); HeliosLocalizationSolveResponse solve = localization.solve(); System.out.println("Solve response: " + solve); // Get field pose (blue alliance origin) Optional pose = localization.fieldPoseBlue(); pose.ifPresent(p -> System.out.println("Robot pose: " + p)); // Get detailed pose estimate with std devs and latency Optional estimate = localization.fieldPoseBlueEstimate(); estimate.ifPresent(e -> { System.out.println("Pose: " + e.pose()); System.out.println("Timestamp: " + e.timestampSeconds() + "s"); System.out.println("Std devs: " + e.stdDevs()); System.out.println("Latency: " + e.latency()); }); // Use a specific localization profile HeliOSLocalization customLocalization = cam.localization("competition-profile"); HeliosLocalizationSolveResponse customSolve = customLocalization.solve(); ``` -------------------------------- ### Manage Vision Pipelines with HeliOS Source: https://context7.com/prometheus-dynamics/pdlib/llms.txt Demonstrates how to list, resolve, and inspect vision pipelines stored on a device. It also shows how to access pipelines attached to specific camera streams. ```java import ca.pd.lib.helios.HeliOS; import ca.pd.lib.helios.HeliOSPipeline; import ca.pd.lib.helios.HeliOSPipelineOnStream; import ca.pd.lib.helios.model.HeliosPipelineSummary; import com.fasterxml.jackson.databind.JsonNode; import java.util.List; import java.util.Optional; HeliOS cam = new HeliOS("172.31.250.1"); // List all pipelines on device List pipelines = cam.pipelines(); for (HeliOSPipeline pipeline : pipelines) { HeliosPipelineSummary summary = pipeline.summary(); System.out.println("Pipeline: " + pipeline.name() + " id=" + pipeline.id() + " updated=" + summary.updatedAtMs()); } // Resolve pipeline by UUID, name, or alias HeliOSPipeline pipeline = cam.pipeline("apriltag-detector"); JsonNode graphDoc = pipeline.graph(); System.out.println("Pipeline graph: " + graphDoc); // Safe lookup with Optional Optional maybePipeline = cam.findPipeline("unknown"); if (maybePipeline.isEmpty()) { System.out.println("Pipeline not found"); } // Access pipelines attached to a stream HeliOSStream stream = cam.stream("front-camera"); List attachedPipelines = stream.pipelines(); HeliOSPipelineOnStream activePipeline = stream.pipeline(); // Active pipeline System.out.println("Active pipeline: " + activePipeline.id()); ``` -------------------------------- ### Publish PDLib Online using Gradle Source: https://github.com/prometheus-dynamics/pdlib/blob/main/README.md This command publishes the PDLib project to an online Maven repository. It requires a .env file with repository credentials and can accept overrides via Gradle properties. ```bash MAVEN_ONLINE_URL=https://maven.pdlib.local/PDLib MAVEN_ONLINE_USER= MAVEN_ONLINE_PASSWORD= ./gradlew publishToMavenOnline # Optional overrides: # -PmavenOnlineUrl=... # -PmavenOnlineUser=... # -PmavenOnlinePassword=... ``` -------------------------------- ### Publish PDLib Locally using Gradle Source: https://github.com/prometheus-dynamics/pdlib/blob/main/README.md This command publishes the PDLib project to the local Maven repository. It is useful for testing local changes before publishing online. ```bash ./gradlew publishToMavenLocal ``` -------------------------------- ### Run PDLib Integration Tests with Gradle Source: https://github.com/prometheus-dynamics/pdlib/blob/main/README.md This command executes the read-only integration tests for PDLib against a specified HeliOS target. It allows configuring the target IP address and timeout. ```bash ./gradlew :pdlib-test:test -Dhelios.it=true -Dhelios.target=172.31.250.1 # Target and timeout can also be set with Gradle properties: # -PheliosTarget=172.31.250.1 # -PheliosTimeoutSec=20 # Override versions with: # -PpdlibVersion=2026.0.0 # -PwpilibVersion=2026.+ ``` -------------------------------- ### Configure Gradle Dependencies for PDLib Source: https://context7.com/prometheus-dynamics/pdlib/llms.txt Instructions for adding PDLib to an FRC project via build.gradle. It supports both vendor dependency files and direct Maven repository configuration. ```groovy repositories { maven { url 'https://maven.prometheus-dynamics.ca/Prometheus-Dynamics/PDLib' } } dependencies { implementation 'ca.pd.lib:pdlib-core:2026.0.0' implementation 'ca.pd.lib:pdlib-helios:2026.0.0' } ``` -------------------------------- ### Integrate HeliOS Vision Data with WPILib Pose Estimator (Java) Source: https://context7.com/prometheus-dynamics/pdlib/llms.txt Fuses localization data from the HeliOS library with WPILib's SwerveDrivePoseEstimator or DifferentialDrivePoseEstimator for improved robot pose estimation. This involves adding vision measurements to the estimator and updating odometry in a periodic loop. Dependencies include the HeliOS library and WPILib's math and kinematics classes. The output is the robot's estimated pose. ```java import ca.pd.lib.helios.HeliOS; import ca.pd.lib.helios.localization.HeliosPoseEstimate2d; import edu.wpi.first.math.estimator.SwerveDrivePoseEstimator; import edu.wpi.first.math.geometry.Pose2d; import edu.wpi.first.math.geometry.Rotation2d; import edu.wpi.first.math.kinematics.SwerveDriveKinematics; import edu.wpi.first.math.kinematics.SwerveModulePosition; import java.util.Optional; HeliOS cam = new HeliOS("172.31.250.1"); // Assume estimator is already initialized with kinematics SwerveDrivePoseEstimator estimator = new SwerveDrivePoseEstimator( kinematics, new Rotation2d(), new SwerveModulePosition[] { /* module positions */ }, new Pose2d() ); // Add vision measurement from HeliOS public void addVisionMeasurement(HeliOS cam, SwerveDrivePoseEstimator estimator) throws Exception { Optional estimate = cam.localization().fieldPoseBlueEstimate(); if (estimate.isEmpty()) return; HeliosPoseEstimate2d e = estimate.get(); estimator.addVisionMeasurement(e.pose(), e.timestampSeconds(), e.stdDevs()); } // Typical periodic update pattern public void periodic(Rotation2d gyroAngle, SwerveModulePosition[] modulePositions) throws Exception { // Update odometry estimator.update(gyroAngle, modulePositions); // Fuse vision when available addVisionMeasurement(cam, estimator); Pose2d currentPose = estimator.getEstimatedPosition(); System.out.println("Fused pose: " + currentPose); } ``` -------------------------------- ### Implement WebSocket Stream Subscription in Java Source: https://context7.com/prometheus-dynamics/pdlib/llms.txt This snippet demonstrates how to connect to a HeliOS WebSocket stream using the HeliosStreamOutputsSocket class. It includes defining a listener for output events, errors, and connection lifecycle management. ```java import ca.pd.lib.helios.ws.HeliosStreamOutputsSocket; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import java.net.URI; import java.net.http.HttpClient; import java.net.http.WebSocket; import java.util.List; import java.util.UUID; import java.util.concurrent.CompletableFuture; HttpClient httpClient = HttpClient.newHttpClient(); ObjectMapper mapper = new ObjectMapper(); URI baseUri = URI.create("http://172.31.250.1:5800"); UUID streamId = UUID.fromString("550e8400-e29b-41d4-a716-446655440000"); HeliosStreamOutputsSocket.Listener listener = new HeliosStreamOutputsSocket.Listener() { @Override public void onOutputsList(List outputs, long timestampMs) { System.out.println("Available outputs: " + outputs); } @Override public void onSample(String port, JsonNode value, String error, long timestampMs) { if (error != null) { System.err.println("Error on " + port + ": " + error); } else { System.out.println("Sample from " + port + ": " + value); } } @Override public void onAck(String requestId) { System.out.println("Subscription acknowledged: " + requestId); } @Override public void onError(String requestId, String error) { System.err.println("WebSocket error: " + error); } @Override public void onClose(int statusCode, String reason) { System.out.println("Connection closed: " + statusCode + " " + reason); } }; HeliosStreamOutputsSocket socket = new HeliosStreamOutputsSocket(httpClient, mapper, baseUri, streamId, listener); List ports = List.of("detections", "annotated_frame"); int intervalMs = 100; CompletableFuture connection = socket.connectAndSubscribe(ports, intervalMs); connection.thenAccept(ws -> System.out.println("Connected to WebSocket")); socket.sendSubscribe(List.of("detections"), 50); socket.close(); ``` -------------------------------- ### Parse AprilTag Detections and Compute Targeting Angles (Java) Source: https://context7.com/prometheus-dynamics/pdlib/llms.txt Parses 2D AprilTag detections from camera stream output and computes the yaw, pitch, and distance to the detected AprilTags. It utilizes the HeliOS library for camera communication and vision processing. Dependencies include the HeliOS library and Jackson for JSON parsing. Outputs are printed to the console. ```java import ca.pd.lib.helios.HeliOS; import ca.pd.lib.helios.HeliOSStream; import ca.pd.lib.helios.localization.HeliosLocalizationDetectionPose; import ca.pd.lib.helios.localization.HeliosLocalizationSolveResponse; import ca.pd.lib.helios.vision.HeliosFiducialDetection2d; import ca.pd.lib.helios.vision.HeliosVisionHelpers; import com.fasterxml.jackson.databind.JsonNode; import java.util.List; HeliOS cam = new HeliOS("172.31.250.1"); HeliOSStream stream = cam.streams().get(0); // Parse 2D fiducial detections from pipeline output JsonNode sample = stream.output("detections").sample(); List detections = HeliosVisionHelpers.parseFiducialDetections2d(sample); for (HeliosFiducialDetection2d det : detections) { System.out.println("Tag ID: " + det.id() + " corners: " + det.corners().size()); } // Get 3D tag poses from localization solver HeliosLocalizationSolveResponse solve = cam.localization().solve(); List tagPoses = HeliosVisionHelpers.tagInCamera(solve, null); // Find closest tag and compute targeting angles HeliOSLocalizationDetectionPose closest = HeliosVisionHelpers.closestTag(tagPoses); if (closest != null && closest.pose() != null) { var translation = closest.pose().translation(); double yaw = HeliosVisionHelpers.yawDegFromCameraTranslation(translation); double pitch = HeliosVisionHelpers.pitchDegFromCameraTranslation(translation); double distance = HeliosVisionHelpers.distanceMetersFromCameraTranslation(translation); System.out.println("Closest tag: " + closest.tagId()); System.out.println("Yaw: " + yaw + "°"); System.out.println("Pitch: " + pitch + "°"); System.out.println("Distance: " + distance + "m"); } ``` -------------------------------- ### Read Device Health and Metrics Source: https://context7.com/prometheus-dynamics/pdlib/llms.txt Retrieves device health status, system metrics (CPU/Memory), network configuration, NT4 settings, camera layout, OS information, bootloader status, and resource guard status from a HeliOS device. ```java import ca.pd.lib.helios.HeliOS; import ca.pd.lib.helios.api.HeliosDeviceReadApi; import ca.pd.lib.helios.model.HeliosNt4Settings; import ca.pd.lib.helios.model.device.*; import java.util.List; HeliOS cam = new HeliOS("172.31.250.1"); HeliosDeviceReadApi device = cam.device(); // Health and metrics HeliosHealth health = device.health(); System.out.println("Device healthy: " + health); HeliosDeviceMetrics metrics = device.metrics(); System.out.println("CPU/Memory metrics: " + metrics); // Device identification HeliosHostname hostname = device.hostname(); System.out.println("Hostname: " + hostname); HeliosTeamNumber team = device.team(); System.out.println("Team number: " + team); // Network configuration List network = device.network(); for (HeliosNetworkInterfaceSettings iface : network) { System.out.println("Interface: " + iface); } // NT4 settings HeliosNt4Settings nt4 = device.nt4(); System.out.println("NT4 settings: " + nt4); // Camera layout HeliosCameraLayout layout = device.cameraLayout(); System.out.println("Camera layout: " + layout); // OS and system info HeliosOsReleaseInfo osInfo = device.osRelease(); System.out.println("OS: " + osInfo); HeliosBootloaderStatus bootloader = device.bootloaderStatus(); System.out.println("Bootloader: " + bootloader); // Resource management HeliosResourceGuardStatus resourceGuard = device.resourceGuardStatus(); System.out.println("Resource guard: " + resourceGuard); ``` -------------------------------- ### Discover HeliOS Devices via NT4 Source: https://context7.com/prometheus-dynamics/pdlib/llms.txt Discovers HeliOS devices on the network using NetworkTables 4 (NT4). Reads published device information such as hostname, IP address, API URL, stream details, and telemetry data. ```java import ca.pd.lib.helios.nt4.HeliosNt4Device; import ca.pd.lib.helios.nt4.HeliosNt4Device.PublishedStream; import com.fasterxml.jackson.databind.JsonNode; import edu.wpi.first.networktables.NetworkTableInstance; import java.util.List; import java.util.Optional; // Create NT4 device reader for a hostname HeliosNt4Device ntDevice = HeliosNt4Device.forHostnameTable("helios-front"); // Or with custom NetworkTableInstance NetworkTableInstance inst = NetworkTableInstance.getDefault(); HeliosNt4Device ntDevice = new HeliosNt4Device(inst, "/helios-front"); // Read published device info Optional hostname = ntDevice.hostname(); Optional ip = ntDevice.ip(); Optional apiUrl = ntDevice.apiUrl(); hostname.ifPresent(h -> System.out.println("Hostname: " + h)); ip.ifPresent(i -> System.out.println("IP: " + i)); apiUrl.ifPresent(u -> System.out.println("API URL: " + u)); // Parse stream information List streams = ntDevice.parseStreams(); for (PublishedStream stream : streams) { System.out.println("Stream: " + stream.id + " alias=" + stream.alias + " url=" + stream.url); } // Read telemetry JSON Optional telemetry = ntDevice.telemetry(); telemetry.ifPresent(t -> System.out.println("Telemetry: " + t)); // Clean up when done ntDevice.close(); ``` -------------------------------- ### Read Peripheral Device Status Source: https://context7.com/prometheus-dynamics/pdlib/llms.txt Retrieves the status of peripheral devices connected to a HeliOS device, including cameras, IMU, sensors, power information, fans, LEDs, and bus devices (I2C, USB). ```java import ca.pd.lib.helios.HeliOS; import ca.pd.lib.helios.HeliOSPeripherals; import com.fasterxml.jackson.databind.JsonNode; HeliOS cam = new HeliOS("172.31.250.1"); HeliOSPeripherals peripherals = cam.peripherals(); // Get all peripheral status JsonNode all = peripherals.all(); System.out.println("All peripherals: " + all); // Camera status JsonNode cameras = peripherals.cameras(); System.out.println("Cameras: " + cameras); // Sensor data JsonNode imu = peripherals.imu(); System.out.println("IMU: " + imu); JsonNode sensors = peripherals.sensors(); System.out.println("Sensors: " + sensors); // Power and thermal JsonNode power = peripherals.power(); System.out.println("Power: " + power); JsonNode fan = peripherals.fan(); System.out.println("Fan: " + fan); // LEDs JsonNode leds = peripherals.leds(); System.out.println("LEDs: " + leds); // Bus devices JsonNode i2c = peripherals.i2c(); JsonNode usb = peripherals.usb(); System.out.println("I2C devices: " + i2c); System.out.println("USB devices: " + usb); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.