srb agent ros — ROS 2 Agent
Control a simulation through ROS 2 middleware.
Usage
srb agent ros --env ENV_ID [options]
Options | Shared Agent Options
| Option | Default | Description |
|---|---|---|
--ros_sync/--ros-sync | false | Wait for a fresh action before each step after the first. Use for closed-loop controllers. |
--ros_action_timeout/--ros-action-timeout SECONDS | Wait indefinitely | Maximum synchronized wait; timeout clears cached commands and applies zero action. |
--ros_unthrottled/--ros-unthrottled | false | Run the default sample-and-hold loop without wall-clock pacing. |
Without --ros_sync, the latest available action is sampled each step and the
loop is paced to env.agent_rate. Slower publishers may therefore reuse an
action. --ros_unthrottled removes pacing; without env.agent_rate, the loop
is unpaced. When wall-clock pacing is enabled, a configured env.agent_rate
must be finite and positive. Action subscriptions are best-effort, keep-last
depth one.
Commands expire after 0.5 seconds of monotonic wall time by default. Fresh
messages renew only their addressed environment and action slices; velocity
and event inputs expire independently. Malformed or non-finite messages do not
refresh commands. Mapped actions must be finite, are clamped to the batched
Box bounds, and those bounds must admit zero. Raw/term overrides own their
slices until expiry or reset. The CLI wait timeout is separate from expiry;
Python embedders may set RosInterface(env, command_timeout_s=0.25) or disable
expiry with None. Velocity and event traffic updates only mapped or
unclaimed slices; a fully overridden mapped update is not counted as applied.
Reset, expiry and action publication are synchronized. Contended reads return
zero. The agent holds action_transaction() across env.step(action); Python
embedders sharing the interface with reset or close callbacks should do the
same and must not retain the borrowed action buffer after the context exits.
Nested reads are rejected. A hung consumer can delay reset; this is not a
watchdog. A busy close retains ingress and dependent endpoints for retry.
Host interleaving checks do not qualify native ROS/CUDA behavior.
Zero action is not a controller watchdog, emergency stop or proof of physical safety. Hardware use requires separate transport and physical-stop acceptance.
RealEnv raw policy input
srb real_agent ros --env ENV_ID accepts flat policy actions on
action/raw (normally /srb/action/raw) as std_msgs/Float64MultiArray, in
the generated environment’s single-action order and bounds. RealEnv applies
its hardware mapping and scales. The real adapter uses this topic; simulator
term, velocity and event mappings do not define real teleoperation semantics.
The subscription is best-effort, volatile, keep-last depth one. Valid first
input must arrive within 5 seconds; commands expire after 0.5 seconds, checked
before dispatch and each prepared hardware command. A positive finite
--ros_action_timeout overrides both deadlines. --ros_sync waits for a
newer message after the first step; if the previous message expires first,
the session aborts. --ros_unthrottled does not bypass expiry or RealEnv’s
action rate.
Missing, malformed, out-of-bounds or expired commands abort the real session; invalid input is not replaced with zero. Cleanup stops the session, closes the command source and RealEnv, then releases the process-owned ROS context. Failed cleanup retains resources for retry. Message age is measured from local callback receipt because messages have no producer timestamp. These checks cannot interrupt a blocked hardware call or provide a watchdog; synthetic transport checks do not establish physical-stop acceptance.
See the ROS 2 Workflow for examples.