Skip to content

ROS2 Bridge

The PhyTrace ROS2 Bridge is a drop-in container node that connects any ROS2 robot to PhyCloud without modifying your existing robot code. It subscribes to standard ROS2 topics, normalizes every message to the PhyTrace UDM, and streams batched telemetry to PhyCloud over HTTP. On robots fitted with PhyTAU, the bridge runs on the TAU so events can be signed with its hardware-held key.


Architecture

graph LR
    A[ROS2 Robot Topics] --> B[PhyTrace Bridge Node]
    B --> C[UDM Normalization]
    C --> D[HTTP Batch Sink]
    D --> E[PhyCloud]

Internal pipeline:

graph TD
    A["/odom, /battery_state, /scan\n/imu/data, /cmd_vel, /gps/fix\n/diagnostics, /goal_pose\n/joint_states, /delivery/status"] -->|ROS2 messages| B[topic_handlers.py]
    B -->|typed dicts| C[UDMBuilder]
    C -->|UDMEvent| D[CloudSink]
    D -->|HTTP POST batch| E[PhyCloud API]

Quick Start

# Set your credentials, then:
docker compose -f ros2_bridge/docker-compose.yml up --build

Full setup with environment variables:

PHYCLOUD_ENDPOINT=https://api.phycloud.phyware.io/v1 \
PHYCLOUD_API_KEY=your-api-key \
SOURCE_ID=my-robot-001 \
SOURCE_TYPE=delivery_robot \
docker compose -f ros2_bridge/docker-compose.yml up --build

The bridge uses network_mode: host so it automatically discovers ROS2 DDS traffic from your robot stack.

No ROS2 installed? Use the built-in simulation:

cd ros2_bridge && pip install -r requirements.txt -e .
python -c "from delivery_robot_sim.sim_runner import run_simulation; print(run_simulation(num_ticks=100))"


Topic Coverage

Topic ROS2 Type UDM Domain Description
/odom nav_msgs/Odometry Location, Motion Robot odometry — position, orientation, velocity
/battery_state sensor_msgs/BatteryState Power Battery voltage, SoC, and charging state
/scan sensor_msgs/LaserScan Perception Laser scanner range array
/imu/data sensor_msgs/Imu Motion Orientation, angular velocity, linear acceleration
/cmd_vel geometry_msgs/Twist Motion Commanded linear and angular velocity
/gps/fix sensor_msgs/NavSatFix Location WGS84 GPS fix — lat, lon, altitude
/diagnostics diagnostic_msgs/DiagnosticArray Operational Hardware/software diagnostic status and errors
/goal_pose geometry_msgs/PoseStamped Navigation Current navigation goal in the map frame
/joint_states sensor_msgs/JointState Actuators Joint names, positions, velocities, efforts
/delivery/status std_msgs/String (JSON) Operational, Payload Delivery task state and payload metadata

Topics not present on your robot are silently skipped — no configuration needed.

On an iRobot Create 3 base (TurtleBot 4), with irobot_create_msgs installed, the bridge also records the base's safety state from /wheel_status, /hazard_detection and /dock_status. The state goes in the UDM safety domain of every event:

safety_state When
protective_stop A stopping hazard: bump (with side), cliff, wheel drop, stall, backup limit
emergency_stop The wheels are disabled, off the dock, with no hazard. This is the effect of an /e_stop call or the base's own stop; the call itself isn't visible as a topic.
normal Otherwise. Object proximity alone is a warning, not a stop.

Each change is sent at once as a signed event: safety.e_stop, safety.contact_detected (a bump), safety.violation (another hazard) or state.transition (back to normal). Find stops with where=safety.safety_state="emergency_stop".


Configuration

Variable Default Description
PHYCLOUD_ENDPOINT http://localhost:8000/api/v1 PhyCloud ingestion API base URL
PHYCLOUD_API_KEY (empty) API authentication key
SOURCE_ID / ROBOT_ID delivery-robot-001 Unique robot identifier
SOURCE_TYPE / ROBOT_TYPE delivery_robot Robot class (amr, agv, drone, etc.)
FLEET_ID (none) Fleet grouping identifier
SITE_ID (none) Site or facility identifier
SAMPLE_RATE_HZ 5.0 UDM event publish rate
BATCH_SIZE 10 Events per HTTP batch request

ROS 2 Graph Integrity

PhyTrace signs what the bridge receives. A process on the robot can start its own node between a driver and the topic everyone reads, for example a "speed governor" that reads /base/odom_raw and publishes altered /odom, and the values are wrong before they are ever signed. That kind of interposition changes the ROS 2 computation graph: there is a new node, a new subscriber on the raw topic, and a new or different publisher on the watched topic. ROS 2 discovery announces all of it.

With a graph policy configured, the bridge compares the graph with a baseline and sends PhyUDM ros_graph events through the same signed path as the telemetry:

Event When
security.ros_graph_baseline Once the bridge is armed (after PHYTRACE_GRAPH_ARM_AFTER_SEC), or on start with a saved baseline. It carries the manifest and its SHA-256.
security.ros_graph_changed Each time the set of changes since the baseline differs from the last one reported. An empty set means the graph is back to the baseline.
security.ros_graph_unobservable When the graph cannot be read, or no other node has been visible for PHYTRACE_GRAPH_UNOBSERVABLE_AFTER_SEC. Blinding the observer is a signal in its own right.

Each change has a kind and a severity:

Kind Severity
publisher_added or publisher_replaced on a watched topic high
subscriber_added on a raw topic high
publisher_restarted (new endpoint under the same resolved node name; if a name is unresolved, from the same DDS participant) low
publisher_removed medium
subscriber_removed low
node_added / node_removed node_severity (default medium)

Policy

# /etc/phytrace/ros_graph.yaml
policy_id: tb4-odom-1
watch_topics: [/odom, /cmd_vel]   # publishers are tracked
raw_topics: [/base/odom_raw]      # subscribers are tracked
ignore_nodes: ['/dashboard*']     # added to the defaults below
node_severity: medium

Nodes matching /_ros2cli_*, /launch_ros_*, /rviz*, /teleop* and /transform_listener_impl_* are always ignored. The policy may also be JSON.

Variable Default Description
PHYTRACE_GRAPH_POLICY (none: graph watch off) Path to the policy file
PHYTRACE_GRAPH_BASELINE /var/lib/phytrace/ros_graph_baseline.json Where the baseline is kept, so a restart compares with the arm-time graph. Delete it to re-arm.
PHYTRACE_GRAPH_POLL_SEC 1.0 How often the graph is read
PHYTRACE_GRAPH_ARM_AFTER_SEC 3.0 Discovery settling time before the baseline is taken
PHYTRACE_GRAPH_UNOBSERVABLE_AFTER_SEC 30.0 How long the graph may be unreadable or empty

The PhyCloud device trust view shows the graph's current state and raises ROS graph changed: N changes, <severity> severity or ROS graph unobservable.

A new publisher whose node name discovery did not resolve (_NODE_NAMESPACE_UNKNOWN_/_NODE_NAME_UNKNOWN_) is never taken for a restart: it is publisher_added, or publisher_replaced if a baseline publisher is gone.

The bridge waits for discovery to settle before taking the baseline, or before comparing with a saved one after a restart: the graph must look the same for 3 polls in a row (it goes ahead after 60 s if it never settles). A change is reported once it has held for 2 polls in a row, so a node that blinks out of discovery for a moment is not reported.

Limits

  • The ROS graph API reports node names, endpoint GIDs, types and QoS, not network addresses, so participant_unknown changes are not produced yet.
  • Code injected into a running node, or a patched node restarted under its own name, does not change the graph beyond a low-severity publisher_restarted.
  • An attacker with access to the DDS domain can still publish; DDS-Security (SROS 2) is what stops that. Graph integrity tells you that something changed, it does not prevent it.

What happens in PhyCloud

Once telemetry is in PhyCloud it is retained with provenance, added to the hash chain, and available for search, replay and evidence lockers through the API and the phyware CLI. The bridge's events conform to the open PhyUDM schema, so any PhyUDM-compatible tool can consume them too.


Full Onboarding Guide

For complete setup instructions, real-robot deployment, simulation usage, example UDM event payloads, testing, and troubleshooting, see the ROS2 Bridge Onboarding Guide.