> ## Documentation Index
> Fetch the complete documentation index at: https://www.agentworldprotocol.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Wrap a robot

> A streaming adapter over ROS 2 with envelopes, e-stop, clock synchronization, and latency reporting.

<Warning>
  Physical actuation. Implement the [robotics profile](/spec/profiles/robotics) completely before connecting untrusted agents; envelopes and e-stop are not optional.
</Warning>

<Steps>
  <Step title="Topics to channels, actions to actions">
    Camera/joint-state topics → observation channels (`image/jpeg`, `proprio/json`); ROS 2 actions/services → AWP action types. Map tf → the AWP frame tree, publishing dynamic transforms on `awp.tf`.
  </Step>

  <Step title="Enforce envelopes in the adapter">
    Clamp or reject before commands reach the controller (AWP-ENV-001). Do this in the adapter even if the controller has its own limits — the audit log must show protocol-level enforcement.
  </Step>

  <Step title="Wire the e-stop both ways">
    Hardware e-stop → `world.event: e_stop_engaged` + preempt all actions (AWP-EVT-002). Expose a `stop` action type with `preemption: replace` as the software path.
  </Step>

  <Step title="Stamp, synchronize, and report">
    Set `ts_mono_ns` from the sensor's capture time and `ts_send_ns` when the frame leaves the adapter (AWP-OBS-006); answer every `ping` with `receive_ns` and `transmit_ns` taken at the socket (AWP-CLK-007). Send `session.telemetry` once a second from those stamps and from `received_ts_mono_ns` on each submission (AWP-TIM-006). Declare `max_basis_age_ms` and reject any submission without a `basis_ts_mono_ns` or with one older than the bound (AWP-SAF-013, AWP-ROB-005).
  </Step>

  <Step title="Declare and measure the safe state">
    Choose `safety_policy.safe_state.behavior` (`safe_stop` for arms, `hold` for grippers) and a `watchdog_ms` your controller can honor (robotics default 2000 ms). The watchdog runs on the adapter, from the last control message received, and fires whether or not the connection has been declared lost (AWP-SAF-003/004). Test it: kill the agent process mid-motion and measure, on the adapter's clock, last-message → actuator-stop; the number must be within `watchdog_ms` + 100 ms and goes in your conformance report (AWP-SAF-012). The reconnect window only decides how long the session token stays valid; a resumed agent must submit a new action to move again (AWP-SAF-008).
  </Step>
</Steps>

Planned reference implementations (not yet published): [ros2-bridge](/adapters/ros2-bridge) for ROS 2 stacks, [lerobot-bridge](/adapters/lerobot-bridge) for LeRobot-class affordable arms (no ROS required).
