feat: Add ROS2 simulation support#119
Open
fanyahao1 wants to merge 1 commit into
Open
Conversation
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add ROS2 topic-based Unitree MuJoCo sim2sim bridge
Summary
This PR adds a ROS2 topic-based
sim2simpath for Unitree MuJoCo, built on top of the existing Unitree ROS2 message interface and Unitree MuJoCo simulator.The new implementation enables policies, controllers, and onboard ROS2 nodes that already communicate through Unitree low-level ROS2 topics to run directly against the MuJoCo simulator. This makes it possible to test the same ROS2 topic contract used on robot hardware in simulation, without requiring direct SDK-level integration in the policy code.
Motivation
Previously, sim-to-sim or simulation testing with Unitree MuJoCo required tighter coupling to the simulator-side Python bridge or SDK-style interfaces. For ROS2-based onboard stacks, this created a gap between:
This PR closes that gap by introducing a ROS2 topic version of Unitree MuJoCo
sim2sim, allowing the simulator to publish and consume Unitree-compatible ROS2 messages.This is especially useful for:
What Changed
Added ROS2-based MuJoCo bridge
Introduces a ROS2 bridge under simulate_python_ros2 that connects Unitree MuJoCo simulation with ROS2 topics.
Key responsibilities include:
Added simulator entry point
Adds a ROS2-enabled simulation entry point in unitree_mujoco_ros2.py.
This provides a runnable path for launching the MuJoCo simulation while exposing the robot through ROS2 topics.
Added ROS2 bridge logic
Adds the main ROS2 bridge implementation in unitree_ros2_bridge.py.
The bridge is responsible for the conversion and synchronization layer between:
Design Notes
The implementation keeps the simulator bridge separate from the existing onboard agent and ROS node logic.
This preserves the current project architecture:
This means existing ROS2 controllers can target either:
with minimal changes to the higher-level control stack.
Why This Is Useful
This PR enables a more realistic and convenient development workflow:
This reduces iteration time and improves safety by allowing ROS2-level behavior to be tested in simulation first.
Validation
Suggested manual validation:
Compatibility
This feature is intended for environments where the Unitree ROS2 message packages and MuJoCo Python simulation dependencies are available.
It should not affect the existing non-ROS2 Unitree MuJoCo simulation path or the onboard hardware execution path.
Risk / Notes
Checklist