Skip to content

Woolfrey/interface_mujoco_ros2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MuJoCo-ROS2 Interface

Note

This project is a work-in-progress, so new features will be added slowly. Feel free to contribute your own improvements.

This class establishes communication between a MuJoCo simulation and ROS2.

It publishes a sensor_msgs::msg::JointState topic for you to use, and allows commands to the joints via a std_msgs::msg::Float64MultiArray topic:

It can run in POSITION, VELOCITY, or TORQUE mode which may be set via the config and/or launch file(s).

Tip

You can download MuJoCo robot models here.

Features

  • Launches a MuJoCo simulation.
  • Creates a ROS2 node for communication.
  • Publishes joint state information over ROS2.
  • Provides real-time visualization of the robot and its environment.
  • Allows manual interaction with the simulation.

⬆️ Back to top.

Dependencies

  • ROS2 (Humble Hawksbill or later)
  • MuJoCo
  • GLFW
  • Standard C++ libraries

⬆️ Back to top.

Installation

Prerequisites

Ensure that you have ROS2 and MuJoCo installed on your system.

  1. Install ROS2: Follow the ROS2 installation guide for your operating system.

  2. Install MuJoCo: Download and install MuJoCo from the official website.

  3. Install GLFW:

   sudo apt-get install libglfw3-dev

⬆️ Back to top.

Building the Project

Clone the repository:

git clone https://github.com/Woolfrey/interface_mujoco_ros2
cd interface_mujoco_ros2

Build the package:

colcon build

Source the ROS2 workspace:

source install/setup.bash

⬆️ Back to top.

Usage

Launching the Interface

There are 2 different control modes currently available:

To run velocity control, you can launch:

ros2 launch mujoco_interface velocity_mode.py

This requires that the topic /joint_commands contains an array of velocites (in rad/s).

To run torque control, you can launch:

ros2 launch mujoco_interface torque_mode.py

This requires that the topic /joint_commands contains an array of torques (Nm).

Tip

In torque mode, gravity and Coriolis torques are automatically compensated for.

⬆️ Back to top.

Contributing

Contributions are welcome! Please fork the repository and submit pull requests.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

⬆️ Back to top.

License

Distributed under the GNU General Public License. See LICENSE for more information. Contact

Jon Woolfrey - [email protected]

⬆️ Back to top.

About

Allows for communication between MuJoCo and ROS2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published