Skip to content

refactor(sim): route MuJoCo control through module ports - #3682

Draft
TomCC7 wants to merge 1 commit into
mainfrom
cc/feat/sim-zenoh-shm
Draft

refactor(sim): route MuJoCo control through module ports#3682
TomCC7 wants to merge 1 commit into
mainfrom
cc/feat/sim-zenoh-shm

Conversation

@TomCC7

@TomCC7 TomCC7 commented Aug 25, 2026

Copy link
Copy Markdown
Member

Summary

  • make MuJoCo a normal connection module with typed motor-command and robot-state ports
  • use the same port-backed control coordinator contract for real and simulated G1, xArm, and Piper stacks
  • remove the custom shared-memory transports, RPC layer, simulation registries, and Unitree MuJoCo subprocess IPC
  • make the existing xArm keyboard-teleop blueprints simulation-aware
  • enable Zenoh shared memory in the native Rust module

Architecture

ControlCoordinator
        |
        | typed module ports
        v
real connection  or  MuJoCo connection module

The coordinator keeps the synchronous hardware-adapter interface needed by the control loop. The connection module holds the latest command, applies it on each physics step, and publishes state through ordinary DimOS streams. Transport selection remains a blueprint/runtime concern.

Manual test

Until #3617 lands, select Zenoh explicitly:

dimos --simulation mujoco --transport zenoh run keyboard-teleop-xarm7

The existing keyboard controls should work without a simulator-specific teleop path.

Validation

  • ./bin/pytest-fast: 4,554 passed, 33 skipped; the only failure was the blueprint generator's expected dirty-worktree check
  • blueprint generation in CI comparison mode: passed
  • focused control, transport, and simulation tests: 151 passed
  • xArm keyboard-teleop tests: 12 passed
  • simulation blueprint wiring and joint-count smoke checks: passed
  • ruff check, ruff format --check, compileall, and git diff --check: passed
  • cargo check --manifest-path native/rust/dimos-module/Cargo.toml: passed

Dependency

This stacks with #3617, which changes the default transport to Zenoh. This PR does not duplicate that default change.

Addresses #3671.

@mintlify

mintlify Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
dimensional 🔴 Failed Aug 25, 2026, 5:22 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.02959% with 211 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
dimos/simulation/mujoco/locomotion_sim.py 17.28% 67 Missing ⚠️
dimos/hardware/manipulators/port_adapter.py 64.16% 35 Missing and 8 partials ⚠️
dimos/robot/unitree/mujoco_connection.py 67.74% 32 Missing and 8 partials ⚠️
dimos/simulation/engines/mujoco_sim_module.py 58.66% 25 Missing and 6 partials ⚠️
...nitree/g1/blueprints/basic/unitree_g1_groot_wbc.py 46.66% 8 Missing ⚠️
dimos/control/port_coordinator.py 77.27% 5 Missing ⚠️
dimos/hardware/whole_body/port_adapter.py 94.44% 2 Missing and 2 partials ⚠️
dimos/hardware/manipulators/test_port_adapter.py 95.16% 3 Missing ⚠️
dimos/robot/manipulators/xarm/blueprints/teleop.py 78.57% 2 Missing and 1 partial ⚠️
dimos/control/tick_loop.py 66.66% 1 Missing and 1 partial ⚠️
... and 3 more
@@            Coverage Diff             @@
##             main    #3682      +/-   ##
==========================================
+ Coverage   77.74%   77.79%   +0.05%     
==========================================
  Files        1286     1286              
  Lines      123225   122325     -900     
  Branches    10818    10751      -67     
==========================================
- Hits        95801    95166     -635     
+ Misses      24291    24057     -234     
+ Partials     3133     3102      -31     
Flag Coverage Δ
OS-ubuntu-24.04-arm 72.71% <74.94%> (+<0.01%) ⬆️
OS-ubuntu-latest 74.58% <74.94%> (+0.02%) ⬆️
Py-3.10 74.58% <74.94%> (+0.02%) ⬆️
Py-3.11 74.58% <74.94%> (+0.02%) ⬆️
Py-3.12 74.58% <74.94%> (+0.02%) ⬆️
Py-3.13 74.58% <74.94%> (+0.01%) ⬆️
Py-3.14 74.59% <74.94%> (+0.03%) ⬆️
Py-3.14t 74.58% <74.94%> (+0.01%) ⬆️
SelfHosted-Large 30.02% <30.51%> (+0.01%) ⬆️
SelfHosted-Linux 35.21% <30.80%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
dimos/cli/cameracalibrate/cameracalibrate.py 78.16% <ø> (ø)
dimos/cli/commands/cameracalibrate.py 23.52% <ø> (ø)
dimos/cli/spy/core.py 98.18% <ø> (ø)
dimos/constants.py 71.42% <ø> (-4.58%) ⬇️
dimos/control/hardware_interface.py 71.59% <100.00%> (-2.10%) ⬇️
dimos/control/test_port_coordinator.py 100.00% <100.00%> (ø)
dimos/control/test_tick_readiness.py 100.00% <100.00%> (ø)
dimos/core/coordination/module_coordinator.py 86.56% <ø> (ø)
dimos/core/stream.py 82.95% <ø> (ø)
dimos/core/transport.py 72.96% <100.00%> (+3.98%) ⬆️
... and 31 more

... and 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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