Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

srb real_agent — Sim-to-Real Bridge

The srb real_agent family inspects simulated Gymnasium environments from the Space Robotics Bench, generates their lightweight real-world counterparts (registered under srb_real/), and exposes the same agent verbs (zero, rand, teleop, ros, train, eval, collect) for hardware execution. The generated environments do not depend on Isaac Sim and can be installed on the deployment target alongside the user’s chosen hardware backends.

Sub-Subcommands

srb real_agent <action> [options]
SubcommandPurpose
genGenerate the real-world counterpart for a simulated environment.
sim2real_genAlias for gen.
zeroRun a real agent with zero-valued actions.
randRun a real agent with random actions.
teleopManually teleoperate the real agent, directly or through a trained policy.
rosDrive the real agent from ROS 2 / Space ROS action topics.
trainTrain a reinforcement-learning policy directly against hardware.
evalEvaluate a trained policy on hardware.
collectRecord real-world demonstration datasets from human, policy, random, or zero controllers.
validateRun a structured real-hardware validation protocol with telemetry and pass/fail output.
rebuild-summaryRebuild validation summary.json and report.md from a session directory.
replay-twinOpen a Rerun replay comparing a validation session against a baseline .rrd.

srb real_agent gen

srb real_agent gen --env ENV_ID [options]
OptionDescriptionDefault
-e/--env/--task ENV_IDName of the simulated environment to generate the real-world counterpart for. Can be ALL to generate for every registered (non-template) environment.REQUIRED
--cfg PATHHydra config YAML override (DEFAULT/IGNORE/NONE/NULL recognised)DEFAULT
--hardware/--hw [HW …]Default hardware interfaces (for example, ros_cmd_vel, ros_tf, ros_mw, ros_depth_heightmap, ros_imu) to link with the generated environment[]
--checkDeterministic freshness gate: render a candidate, byte-compare it with the checked-in module, print a unified diff, and exit non-zero on drift without overwritingFalse

The command inspects the Gymnasium spec of ENV_ID, asks the RealEnvGenerator for a real-world counterpart, and writes the resulting Python module to srb/interfaces/sim_to_real/env/<env_id>.py. From that point on, the same --env ID is recognised by every other srb real_agent subcommand.

Example

srb real_agent gen --env waypoint_navigation env.robot=leo_rover \
  --hardware ros_cmd_vel ros_tf ros_mw

If the environment passed to a non-gen subcommand has not yet been registered under srb_real/, the runner triggers the generation step automatically (in a sub-process) and asks you to re-run the original command.

--check — the freshness gate

--check never writes. It renders a fresh candidate beside the target, formats it, byte-compares it against the checked-in module, prints a unified diff, and exits non-zero on drift. Because the comparison is against a formatted file, it requires the repository’s pinned formatter (ruff) on PATH; without one it raises a typed FormatterUnavailableError naming the pinned formatter rather than reporting drift that an unformatted candidate would manufacture.

--env ALL --check runs the gate across every cached environment and exits non-zero if any has drifted — or if the environment cache is empty, since a gate that inspected nothing is not a pass. Generated modules whose task is no longer registered are absent from the cache and therefore outside the batch’s reach.

Landscaping task IDs

Terrain landscaping has two task IDs, and each generates its own module. They must never be conflated: the general task has no fixed target manifest and must never be relabelled with the crater’s hash.

Task IDTarget manifestGenerated module
terrain_landscaping_craterfixed crater manifest, hash pinned in the modulesrb/interfaces/sim_to_real/env/terrain_landscaping_crater.py
terrain_landscapingper-episode mission manifest; the module declares REQUIRES_RUNTIME_TARGET_MANIFEST = Truesrb/interfaces/sim_to_real/env/terrain_landscaping.py
srb real_agent gen --env terrain_landscaping_crater
srb real_agent gen --env terrain_landscaping

srb real_agent gen --env terrain_landscaping_crater --check
srb real_agent gen --env terrain_landscaping --check

Both run unqualified — no env.particles_height override belongs in them. Generating a bridge module does not make either task deployable: construction of the landscaping RealEnv still fails closed on missing hardware capability tags. See Terrain Landscaping Training Readiness.

Shared Options for the Other Sub-Subcommands

The non-gen real_agent subcommands accept the same baseline options:

OptionDescriptionDefault
-e/--env/--task ENVName of the real environment (resolved under srb_real/)REQUIRED
--cfg PATHHydra config YAML overrideDEFAULT
--hardware/--hw [HW …]Hardware interfaces to instantiate at runtime[]
--logdir/--logs PATHPath to root logging directorySRB_LOGS_DIR

Additional groups depend on the subcommand:

  • teleop and collect accept the standard teleop arguments (--teleop_device, --pos_sensitivity, --rot_sensitivity, --invert_controls). Teleop devices include keyboard, spacemouse, ros, gamepad, and haptic.
  • collect accepts the standard collection arguments (--collector, --num_episodes, --horizon, --success_only). --collector can be human, policy, random, or zero.
  • train requires --algo (RL). Supported RL choices include dreamer, tdmpc2, and sbx_ppo; training also supports --continue_training / --model.
  • eval requires --algo and/or --model. Evaluation choices include dreamer, tdmpc2, sbx_ppo, robomimic_bc, and robomimic_cql.
  • teleop and collect also accept the optional Teleop Policy group (--algo, --model) for policy-driven rollouts.

eval and policy-driven collect accept SRB model artifact directories as --model values, not only raw checkpoint files. The manifest supplies the algorithm when --algo is omitted, and bundled framework config is reused by adapters that need the original restore context. Real collection records datasets with split=real while keeping the source as controller=human, controller=policy, controller=random, or controller=zero; artifact-backed policy collection records both the resolved checkpoint path and the source model artifact path.

Real Validation

srb real_agent validate --spec SPEC_PATH [options]
OptionDescriptionDefault
--spec PATHPath to validation spec YAML (e.g. hyperparams/validation/excavation.yaml)REQUIRED
--checkpoint PATHOverride the checkpoint field in the specNone
--episodes NOverride the n_episodes field in the specNone
--wandbEnable the optional Weights & Biases summary sinkFalse
--no-tensorboardDisable the TensorBoard scalar sinkFalse
--no-rerun-webDisable the Rerun web viewer (local .rrd recording is still active)False
--post-statusPost the validation pass/fail status as a GitHub commit status (requires gh CLI)False
--storage-rootOverride the session artifact root directorylogs/real_validation
--dry-runSkip environment and policy instantiation to smoke-test the validation wiringFalse

--dry-run never passes. It skips environment and policy instantiation, then finalizes the session with exit_code: 4 (preflight_fail), pass_overall: false, hardware_evidence: false, metrics.n_episodes: 0, and a red badge.json of {"label": "real-eval", "message": "non-hardware evidence", "color": "red"}. All three criteria are reported with status skipped. A dry-run artifact is a wiring smoke test, never a validation result. See Sim-to-Real Transfer for the full exit-code table.

Validation runs the generated real environment, creates telemetry in logs/real_validation/, and calls a policy reset hook at the start of every episode when the loaded policy exposes one. --checkpoint can point to a raw checkpoint or an SRB model artifact; artifact checkpoints reuse the same policy-loading path as eval and collect, including bundled framework config for Dreamer, TD-MPC2, and RSL-RL. When the validation spec omits algo or uses REQUIRED_AT_RUNTIME, an artifact checkpoint supplies the algorithm from its manifest; an explicit conflicting spec algorithm is rejected.

srb real_agent rebuild-summary

Rebuild the summary.json and report.md artifacts for an existing real validation session directory. This is useful when the validation spec has changed, or you wish to adjust metrics or post-processing without re-running the physical hardware validation.

srb real_agent rebuild-summary SESSION_DIR
  • SESSION_DIR: Path to the validation session directory (which must contain a spec.yaml and logged .jsonl / .rrd telemetry).

srb real_agent replay-twin

Open a local Rerun viewer showing a time-aligned comparison of a real hardware validation rollout side-by-side with a simulated baseline rollout (“sim ghost” vs. “real solid”).

srb real_agent replay-twin --session SESSION_DIR --baseline BASELINE_RRD_PATH
  • --session SESSION_DIR: Path to the validation session directory containing rollout.rrd.
  • --baseline BASELINE_RRD_PATH: Path to the baseline .rrd file captured from a Phase 0 simulation run.

See Also