https://github.com/rxdu/mujoco_sim_ros2
Mujoco simulate app with ROS2 integration.
https://github.com/rxdu/mujoco_sim_ros2
jazzy mujoco ros2 ros2control
Last synced: 5 months ago
JSON representation
Mujoco simulate app with ROS2 integration.
- Host: GitHub
- URL: https://github.com/rxdu/mujoco_sim_ros2
- Owner: rxdu
- Created: 2025-01-22T14:04:54.000Z (over 1 year ago)
- Default Branch: devel
- Last Pushed: 2025-04-23T13:50:08.000Z (about 1 year ago)
- Last Synced: 2025-04-23T14:40:58.944Z (about 1 year ago)
- Topics: jazzy, mujoco, ros2, ros2control
- Language: C++
- Homepage:
- Size: 213 KB
- Stars: 5
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mujoco Simulate App with ROS2 Integration

This package utilizes the [pluginlib](https://github.com/ros/pluginlib) to make the [`simulate`](https://github.com/google-deepmind/mujoco/tree/main/simulate) app from mujoco easily extendable. With this plugin support, [mujoco_ros2_control](https://github.com/rxdu/mujoco_ros2_control) is integrated to enable a flexible control interface of the simulated robot and sensors with the ros2_control framework. You can use this package together with the [mujoco_ros2_control](https://github.com/rxdu/mujoco_ros2_control) package to get a similar setup as the [gz_ros2_control](https://github.com/ros-controls/gz_ros2_control) package for Gazebo.
The following environment and software versions are supported and regularly tested:
* Ubuntu 24.04
* ROS2 Jazzy
* Mujoco 3.3.0
Notes on design and maintenance considerations of this package:
* `simulate` provides a good out-of-box user experience and is sufficient for most applications. Thus, I try to avoid re-inventing the wheels (i.e. maintaining a different setup of the simulation loop and GUI).
* It's a lot easier to maintain a ROS-native version of the `simulate` app outside of the `mujoco` package. Minimum changes are applied (mainly the plugin support) to the original app and in general it doesn't require a strict version match with the main library.
* Future changes in the ROS part will be applied at the top (newest) of the git commit history. In case of a code sync of the `simulate` app, a rebase will be performed at the bottom (oldest) of the commit history. This strategy makes it easy to keep `simulate` up-to-date but the rebase will rewrite the git history.
## Build the packages
It's recommended to clone and build the `mujoco_demo_robot` package to get a working example of the simulation setup.
The demo robot model `test_cart.xml` is defined in `mujoco_ros2_control` and the `mujoco_demo_robot` package
demonstrates how to start the simulation as well as the ros2 controllers.
```bash
cd /src
git clone -b 3.3.0 https://github.com/google-deepmind/mujoco.git
git clone https://github.com/rxdu/mujoco_sim_ros2.git
git clone https://github.com/rxdu/mujoco_ros2_control.git
git clone https://github.com/rxdu/mujoco_demo_robot.git
cd
colcon build --symlink-install
```
Now you can start the simulation with the demo robot.
```bash
ros2 launch mujoco_demo_robot cart_effort.launch.py
```

You can check the ros2_control setup by listing available hardware and controllers:


You can test the controller by sending a command to the effort controller:
```bash
ros2 run mujoco_ros2_control_demos example_effort
```
