Skip to content

Latest commit

 

History

History

rrbot_example

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

MuJoCo_ROS RRBot Example

  • Author: David P. Leins [email protected]
  • License: GNU General Public License, version 3 (GPL-3.0)

Prerequisites

  • MuJoCo 2.3.6
  • MuJoCo python bindings (pip install mujoco and make sure the bindings match the MuJoCo version!)
  • python3-vcstool

Installing

  1. Create catkin workspace (mkdir -p mj_ros_demo_ws/src && cd mj_ros_demo_ws && catkin init)
  2. Clone the demo repository into the workspace with git clone https://github.com/ubi-agni/mujoco_ros_demos src/mujoco_ros_demos
  3. Download ros package dependencies into catkin workspace src folder with vcs import src < src/mujoco_ros_demos/rrbot_example/rrbot.deps
  4. Build catkin workspace with catkin b rrbot_mujoco and source the devel space
  5. Run roslaunch rrbot_mujoco rrbot_launch use_sim_time:=true

by streaming to the joint position controller command topics (check the boxes in the spawned rqt window for a sine signal) the two joints of the robot can be controlled.

rrbot_launch

Set use_urdf2mjcf:=true to generate the MuJoCo xml directly from the URDF with urdf2mjcf. Set rviz:=true to start an rviz visualization.

Warning The MuJoCo model loading API changed and currently does not support loading models from string until this announced change is implemented. Thus use_urdf2mjcf:=true is not functional at the moment. As a workaround, a dynamic model can be written to file (with absolute paths to meshes, textures, etc.) and then be loaded as usual through the modelfile parameter.

Explanation

To use a robot model in both MuJoCo and ROS (rviz, ROS Control, ...) we need both the original URDF model, which is used by the ROS ecosystem and (as long as MuJoCo is not able to sufficiently handle URDF) a MuJoCo xml model, that is as consistent with the URDF as possible.

The rrbot_description package contains a urdf subdirectory where the original xacro files that generate the URDF are located. The xml subdirectory contains the port to mujoco which also uses xacro.

Warning Whenever you use xacro to generate a MuJoCo xml model, keep in mind, that MuJoCo is unable to handle the root tag that is always generated by xacro. We use a bash script which pipes the xacro output into head and tail commands to remove the tags that are not interpretable by MuJoCo.

Roadmap

[x] basic tutorial
[x] xacro parameterization
[x] camera integration
[ ] laser sensor integration