Skip to main content

Samples

Local only

This feature is not available in the Cloud API.

The Nimbus agent repository includes sample clients for Local API Gateway live stream and fleet Custom KPI WebSocket flows.

Download the ready-to-run Python source bundle:

C# Desktop Sample

Download the ready-to-run C# source bundle:

The sample targets .NET 10 and requires the .NET 10 SDK.

The C# sample uses:

  • Cogniteam.ApiGateway.Core DTOs and a sample-owned ReFit route interface for login, robot listing, and stream listing.
  • Cogniteam.ApiGateway.Client for the Fleet Custom KPI WebSocket and JSON deserialization.
  • ClientWebSocket for the Local robot /streams/connect route.
  • a sample-owned protobuf for binary output MessageStream envelopes.
  • shared API Gateway DTOs for Fleet Custom KPI JSON frames.
  • Cogniteam.Nimbus.Messages for selected output parsers and teleoperation commands.

The explicit self-signed HTTPS test option keeps a small sample-owned Fleet KPI socket path. Normal trusted-certificate connections use Cogniteam.ApiGateway.Client.

Run it from the Nimbus Agent repository root:

dotnet run --project Nimbus.ApiGateway.SampleClient

The default base URL is:

http://<agent-host>:19992

Choose output to subscribe to binary MessageStream envelopes or direct typed JSON. Choose input to send a finite Twist or Ackermann command as JSON or raw protobuf. Motion defaults to zero, the command rate is limited to 20 Hz, and the sample sends zero before and after motion. Use Fleet Custom KPIs for the separate local-fleet JSON feed.

Python Sample

The Python package contains separate commands for robot output, teleoperation input, and Fleet Custom KPIs. Robot output supports binary MessageStream envelopes or direct typed JSON. The teleoperation command selects a discovered Twist or Ackermann input and sends JSON or raw typed protobuf for a finite duration. Fleet Custom KPI frames remain direct JSON.

Install and run it from the Nimbus agent repository root, or from the extracted Python sample bundle root:

python3 -m pip install --target /tmp/nimbus-apigateway-python ./Nimbus.ApiGateway.PythonSampleClient

PYTHONPATH=/tmp/nimbus-apigateway-python \
python3 -m nimbus_apigateway_streams <local-user-token> <base-url> [filter]

Example:

PYTHONPATH=/tmp/nimbus-apigateway-python \
python3 -m nimbus_apigateway_streams 588e0a9f-8d2 http://<agent-host>:19992 pose

Request direct JSON output:

PYTHONPATH=/tmp/nimbus-apigateway-python \
python3 -m nimbus_apigateway_streams <local-user-token> <base-url> pose --format json

Send a finite command after selecting a discovered input descriptor:

PYTHONPATH=/tmp/nimbus-apigateway-python \
python3 -m nimbus_apigateway_teleoperation <local-user-token> <base-url> cmd_vel \
--format json --speed 0.2 --turn 0.1 --rate 10 --duration 1

The command's speed and turn default to zero. Its maximum rate is 20 Hz and its maximum duration is five minutes. It sends zero before and after the command interval; the Agent also applies a 500 ms deadman.

The optional filter searches descriptor display name, component name, stream name, stream type, source type, URL, and endpoint.

To subscribe to fleet Custom KPI updates from the local fleet manager:

PYTHONPATH=/tmp/nimbus-apigateway-python \
python3 -m nimbus_apigateway_fleet_custom_kpis <local-user-token> <base-url> [fleet-id]

fleet-id defaults to local-fleet.