/mujoco_sim

ROS interface for MuJoCo simulator

Primary LanguageC++MIT LicenseMIT

mujoco_sim

ROS interface for MuJoCo simulator

Overview

mujoco_sim_x4.mp4
spawning.robots.mp4

Key Features

  • Incorporates an advanced physics engine sourced from https://mujoco.org/
  • Supports import and export of URDF and MJCF formats
  • Enables exporting of simulation results in the USD format
  • Integrates controller interfaces, controller managers, and hardware interfaces sourced from http://wiki.ros.org/ros_control
  • Implements PD computed-torque control for enhanced stability
  • Enables spawning and destruction of objects during run-time via rosservice
  • Synchronizes simulation time with real time, with the ability to adjust simulation time for faster or slower execution
  • Provides comprehensive visualization of MuJoCo elements within rviz
  • Offers velocity control for the base
  • Supports mimic joints from URDF format

Installation

  1. Create a workspace
source /opt/ros/<ros-version>/setup.bash    # source ROS
mkdir -p ~/mujoco_ws/src                    # create directory for workspace
  1. Initialize the workspace from this file and update the workspace
wstool init ~/mujoco_ws/src                 # initialize .rosinstall
wstool merge -t ~/mujoco_ws/src https://raw.githubusercontent.com/HoangGiang93/mujoco_ws/main/noetic.rosinstall
wstool update -t ~/mujoco_ws/src            # pull the repositories
  1. Install dependency of all packages in the workspace
rosdep install --ignore-src --from-paths ~/mujoco_ws/src/mujoco_sim/ ~/mujoco_ws/src/mujoco_msgs/ ~/mujoco_ws/src/mujoco_world/  # install dependencies available through apt
  1. Build packages
cd ~/mujoco_ws                              # go to the workspace directory
catkin_make                                 # build packages (or catkin build)
source ~/mujoco_ws/devel/setup.bash         # source new overlay

Troubleshooting

  1. ERROR: gladLoadGL error
  • Solution: sudo apt install nvidia-driver-515
  1. Model errors when using a custom controller
  • Specify the controller in robot.yaml
  • Load the URDF to the parameter server after spawning the mujoco_sim node

Software architecture

Picture