Skip to content

feat(robots): consolidate canonical CDR robot and simulation adapters - #4738

Draft
TomCC7 wants to merge 12 commits into
cc/feat/cdr-unit-controlfrom
cc/feat/cdr-unit-robots
Draft

TomCC7 wants to merge 12 commits into
cc/feat/cdr-unit-controlfrom
cc/feat/cdr-unit-robots

Conversation

@TomCC7

@TomCC7 TomCC7 commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

What this adds

Migrate Go2, G1, R1, whole-body, simulation, DimSim and LeRobot message boundaries to generated CDR types. Keep conversions at driver APIs.

Base: #4736. ROS types use a registry-checked adapter and native ROS serialization. DimSim uses the existing LCM transport with the shared CDR codec.

Validation and limits

Fresh cleanup checks: 60 boundary tests passed, including a minimal headless MuJoCo model. Two DimSim TypeScript/physics cases were skipped. Repository hooks passed.

WIP: real ROS, full simulator scenes, standalone installed-layer execution, Nix and hardware were not verified. Drone, Habitat and other legacy graphs still need migration.

Review report: file map, scope and verification

Shared CDR foundation

Standard ROS definitions are fetched and verified through the existing source lock and generation pipeline in #4366. Native SDK support is included in #4722. Shared Python value implementations and regressions are reviewed in #4800–#4803 before the #4734 caller migration. SDK and consumers use the same generated Rust message crate, including Time, TransformStamped and TFMessage; there is no separate TF schema package or generation command. Camera/depth callers migrate in #4734 and mapping/navigation callers in #4737.

The external CDR and transforms library pins remain unchanged. Local verification passed 122 SDK tests, all existing native consumer suites, and all 24 real native/DimSim/port acceptance tests without skips. Seven staged Nix source layouts resolve exactly one message crate with locked Cargo metadata. This is not a full Nix build or hardware validation. Fresh CI runs verify #4722 independently and the combined stack tip.

Stack #4804 contains the 12 original feature PRs and four separately reviewed adapter/buffer PRs (#4800–#4803). The redundant #4774 is superseded by #4722. No feature PR has been merged into main; existing conflicts with main and the WIP cutover failures in #4739 remain.

@TomCC7

TomCC7 commented Oct 21, 2026 •

Copy link
Copy Markdown
Member Author

Review report

Updated: 2026-10-21. Direct predecessor: #4736.

  • Head: bb22c6cfee7aaebc09c6227a1c966673486a9fef
  • Named base branch: cc/feat/cdr-unit-control at 0a72a633dc4d5b1593cbe7457e9701d627895886
  • PR-recorded base: 0a72a633dc4d5b1593cbe7457e9701d627895886; diff merge base: 0a72a633dc4d5b1593cbe7457e9701d627895886

What changes and why the diff is large

Adapt Go2, G1, R1, whole-body and simulation edges to generated messages. It also adds ROS-native object conversion, DimSim browser/Deno CDR support over the existing LCM envelope, and LeRobot boundary adaptation.
Robot and simulation boundaries retain their current behavior; imports now use shared utilities. The unrelated control test fix moved to #4736 and no longer appears in this unit.

Review map

Suggested entry points: dimos/msgs/driver.py, dimos/protocol/pubsub/impl/rospubsub_conversion.py, dimos/core/transport.py, dimos/robot/unitree/go2/connection.py, dimos/robot/galaxea/r1pro/connection.py, misc/DimSim/cli/bridge/cdr.ts, native/python/lerobot/dimos_lerobot/runtime.py.
All 54 changed files are accounted for below. Grouping is by file role, not a claim that the implementation is minimal.

Complete file map

Implementation (32)

File Change Purpose
dimos/core/transport.py modified Allow registry-owned generated ROS message classes and preserve transport options when pickled.
dimos/hardware/drive_trains/transport/adapter.py modified Use generated PoseStamped, Twist, Vector3 in _on_odom.
dimos/hardware/whole_body/transport/adapter.py modified Use generated MotorCommandArray, Imu, JointState in write_motor_commands.
dimos/imitation/policy/lerobot/module.py modified Use generated Image, JointState, UInt32 in preflight_rollout, start_rollout.
dimos/msgs/driver.py added Legacy numerical driver values to generated wire messages; includes legacy cloud/camera wrappers.
dimos/protocol/pubsub/impl/rospubsub.py modified Connect generated values through the ROS adapter, retaining native ROS topic lifecycle.
dimos/protocol/pubsub/impl/rospubsub_conversion.py modified Adapt generated values to/from ROS-native message objects at the ROS boundary.
dimos/robot/galaxea/r1pro/blueprints/basic/r1pro_coordinator.py modified Declare/use generated MotorCommandArray, PoseStamped, Twist at this boundary.
dimos/robot/galaxea/r1pro/connection.py modified Use generated Time, MotorCommandArray, Point in _stamp_nanoseconds, __init__.
dimos/robot/galaxea/r1pro/head_cameras.py modified Use generated CameraInfo in start, _run.
dimos/robot/galaxea/r1pro/lio.py modified Use generated Point, Pose, PoseStamped in transforms, _on_odometry.
dimos/robot/unitree/dimsim_connection.py modified Use generated PoseStamped, Quaternion, Transform in _odom_to_tf, __init__.
dimos/robot/unitree/g1/blueprints/basic/unitree_g1_coordinator.py modified Declare/use generated MotorCommandArray, Imu, JointState at this boundary.
dimos/robot/unitree/g1/blueprints/basic/unitree_g1_groot_wbc.py modified Use generated MotorCommandArray, Twist, Path in _g1_nav_path.
dimos/robot/unitree/g1/connection.py modified Use generated Twist in _driver_twist, start.
dimos/robot/unitree/g1/g1_rerun.py modified Use generated PoseStamped, OccupancyGrid in g1_costmap, g1_odometry_tf_override.
dimos/robot/unitree/g1/g1_tf_publisher.py modified Use generated TFMessage in _init_lowstate_subscriber, _publish_loop.
dimos/robot/unitree/g1/mujoco_sim.py modified Use generated Point, Pose, PoseStamped in start, _publish_camera_info_loop.
dimos/robot/unitree/g1/wholebody_connection.py modified Use generated Time, MotorCommandArray, Quaternion in _imu_from_unitree_wxyz, start.
dimos/robot/unitree/go2/blueprints/basic/unitree_go2_basic.py modified Use generated LineSegments3D, PoseArray, PoseStamped in _convert_camera_info, _convert_global_map.
dimos/robot/unitree/go2/connection.py modified Use generated Point, Pose, PoseStamped in start, stop.
dimos/simulation/engines/mujoco_sim_module.py modified Use generated Point, Pose, PoseStamped in __init__, get_color_camera_info.
dimos/spec/perception.py modified Declare/use generated CameraInfo, Image, PointCloud2 at this boundary.
misc/DimSim/cli/bridge/cdr.ts added Foxglove CDR readers/writers from the schema artifact; retain LCM packet framing.
misc/DimSim/cli/bridge/cdr_schemas.json added Committed generated ROS2 schema text shared by the DimSim browser and Deno bridge.
misc/DimSim/cli/bridge/lidar.ts modified Adapt lidar browser/simulation command or sensor handling to this unit's message flow.
misc/DimSim/cli/bridge/physics.ts modified Adapt physics browser/simulation command or sensor handling to this unit's message flow.
misc/DimSim/cli/bridge/server.ts modified Adapt server browser/simulation command or sensor handling to this unit's message flow.
misc/DimSim/cli/cli.ts modified Adapt cli browser/simulation command or sensor handling to this unit's message flow.
misc/DimSim/src/bridge.ts modified Adapt bridge browser/simulation command or sensor handling to this unit's message flow.
misc/DimSim/src/engine.js modified Adapt engine browser/simulation command or sensor handling to this unit's message flow.
native/python/lerobot/dimos_lerobot/runtime.py modified Use generated Image, JointState, UInt32 in _on_color_image, _on_joint_state.

Build and dependency metadata (4)

File Change Purpose
misc/DimSim/cli/deno.json modified Declare or package the dependencies/assets used by this unit.
misc/DimSim/cli/deno.lock modified Update the dependency lock snapshot; LFS-managed contents were not hydrated in this report pass.
misc/DimSim/package-lock.json modified Update the dependency lock snapshot; LFS-managed contents were not hydrated in this report pass.
misc/DimSim/package.json modified Declare or package the dependencies/assets used by this unit.

Tests (15)

File Change Purpose
dimos/hardware/whole_body/transport/test_adapter.py added Checks adapter default factory reuses g1 canonical motor state imu and command.
dimos/protocol/pubsub/impl/test_cdr_ros_conversion.py added Checks generated values reuse ros cdr without legacy roundtrip.
dimos/robot/galaxea/r1pro/test_cdr_streams.py added Checks wheel feedback preserves exact source stamp and tf ownership.
dimos/robot/galaxea/r1pro/test_head_cameras.py modified Checks each eye defaults to its own node at the sensor mode.
dimos/robot/unitree/g1/test_cdr_boundaries.py added Checks simulated sensor and drive ports use cdr without launching simulator.
dimos/robot/unitree/g1/test_g1_tf_publisher.py modified Checks rest pose offsets match urdf.
dimos/robot/unitree/g1/test_wholebody_connection.py modified Checks soft start is damping first.
dimos/robot/unitree/go2/blueprints/basic/test_unitree_go2_basic.py added Checks camera and pose overrides accept generated port values.
dimos/robot/unitree/go2/test_connection.py modified Checks make connection webrtc forwards aes 128 key.
dimos/robot/unitree/test_dimsim_connection.py added Checks dimsim schema artifact is exactly the canonical package output.
dimos/simulation/engines/test_cdr_streams.py added Checks real headless physics emits canonical odom imu and owns cleanup.
dimos/simulation/engines/test_mujoco_sim_module.py modified Checks ready signal happens after joint state and imu write.
dimos/teleop/hosted/test_go2_driver_cdr.py added Checks framed operator drive crosses real cdr ports to driver adapter.
misc/DimSim/cli/bridge/cdr_test.ts added Regression coverage for cdr test.
native/python/lerobot/dimos_lerobot/runtime_tests.py modified Checks policy predicts and executes one native joint chunk.

Documentation and replay inputs (3)

File Change Purpose
dimos/imitation/policy/lerobot/README.md modified Update the README guide or replay input for the migrated boundaries.
docs/platforms/humanoid/g1/index.md modified Update the index guide or replay input for the migrated boundaries.
misc/DimSim/README.md modified Update the README guide or replay input for the migrated boundaries.

Review focus and scope reductions

  • Audit retained wrapper conversions. cloud_message and camera_info_message accept old dimos.msgs values and construct generated messages. Verify that these are necessary driver API boundaries; prefer direct generated outputs where drivers are under our control. Do not silently keep a general old-message/new-message bridge in the final design.
  • ROS support uses registry-owned generated classes plus ROS-native messages/serialization. Raw CDR alone is not proof of ROS/DDS type identity; the adapter and field fidelity require review.
  • DimSim has schema snapshots and browser/Deno encode/decode code outside the main SDK viewer path. Review schema provenance and whether reusable CDR code can be shared without changing transport framing.
  • Group robot-specific changes by platform. Mocked drivers and protocol tests cannot certify physical hardware, physics-engine or real ROS operation.

Validation

Fresh checks on bb22c6cfee7aaebc09c6227a1c966673486a9fef: 60 ROS conversion, whole-body, G1, DimSim Python, R1 and simulation boundary tests passed. Two DimSim TypeScript/physics interoperability tests were skipped because their Deno/dependency gate was not configured. The suite includes a minimal headless MuJoCo model and mocked driver/ROS boundaries, not physical hardware. All-files hooks passed, and focused hooks passed after replacing obsolete _pubsub assertions with checks that actual owned transports are stopped. Cargo/native lint was excluded.

Reproduction commands, not executed here unless stated above

Run from this PR's own checkout root after installing its documented test dependencies. These are selected review entry points, not a claim of full-stack coverage.

uv run pytest dimos/protocol/pubsub/impl/test_cdr_ros_conversion.py dimos/hardware/whole_body/transport/test_adapter.py dimos/robot/unitree/g1/test_cdr_boundaries.py
uv run pytest dimos/robot/unitree/test_dimsim_connection.py dimos/robot/galaxea/r1pro/test_cdr_streams.py dimos/simulation/engines/test_cdr_streams.py

Remaining work

Real ROS, full simulator scenes, Nix and physical hardware are unverified. The two DimSim TypeScript acceptance cases remain skipped. Driver wrapper conversions still serve active internal callers; drone, Habitat and other graphs remain unmigrated.

@TomCC7
TomCC7 force-pushed the cc/feat/cdr-unit-robots branch from ad31cbc to bb22c6c Compare October 22, 2026 02:34
@TomCC7
TomCC7 removed this pull request from stack #4743 October 22, 2026 18:51
@TomCC7
TomCC7 added this pull request to stack #4776 October 22, 2026 18:52
@TomCC7
TomCC7 removed this pull request from stack #4776 October 23, 2026 08:47
@TomCC7
TomCC7 added this pull request to stack #4799 October 23, 2026 08:47
@TomCC7
TomCC7 removed this pull request from stack #4799 October 23, 2026 09:19
@TomCC7
TomCC7 added this pull request to stack #4804 October 23, 2026 09:19

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant