Skip to content

sunzhon/mujoco_ros

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository realizes a lightweight ROS interface called mujoco_ros, which can be integrated with any version of MuJoCo without modifying its code or CMake configurations. This interface allows MuJoCo to function as a ROS node (e.g., /mujoco_sim), transferring the simulated robot state to a ROS topic (e.g., /ambot_v2/states) and executing commands from another ROS topic (e.g.,/ambot_v2/action ) generated by a custom controller ROS Node (e.g., /controller_node).

image

The controller callback function of mujoco was realized in rosinterface/rosinterface.cc The rostopic utilizes a message named ambot_msgs, which have RobotState and RobotAction for defining the robot states and commands. This repository integrated this rosinterface into mujoco when compile it.

How to compile

mkdir build cd build && cmake .. && cmake --build .

cd _dep/ambot_msgs-build && make

cd ../../

cmake --build .

How to run

  1. open a terminal and run roscore
  2. open a terminal and run cd ./build/bin/ &&./ros_simulate [your_robot_model.xml] [your_command_topic_name]

Trouble shooting

  • compile error: mujoco_ros/rosinterface/rosinterface.h:40:10: fatal error: ambot_msgs/RobotState.h: No such file or directory 40 | #include <ambot_msgs/RobotState.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
  • solution: go to build/_deps/ambot_msgs-build/ and run make, and then cd ./../../ to run cmake --build .
    cd _deps/ambot_msgs-build/ && make && cd ./../../ && cmake --build .
    
    

About

An ROS interface for mujoco

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published