Skip to content

A ROS 2 package for launching MuJoCo simulation instances that interface with ROS 2.

License

Notifications You must be signed in to change notification settings

ipab-rad/mujoco_ros

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mujoco_ros

MuJoCo simulation instances that are compatible with the ROS 2 ecosystem. For environment generation see mujoco_robot_environments; for example use cases of this package see ros2_robotics_research_toolkit.

Example Usage

import os
import time

import mujoco
import mujoco.viewer

import mujoco_ros
from mujoco_ros.franka_env import FrankaEnv

model_filepath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'models', 'franka_controller_test.mjb')

if __name__=="__main__":

    m = mujoco.MjModel.from_binary_path(model_filepath)
    d = mujoco.MjData(m)

    with mujoco.viewer.launch_passive(
        model=m, 
        data=d,
        show_left_ui=False,
        show_right_ui=False,
        ) as viewer:

        # instaniate mujoco_ros environment
        env = FrankaEnv(
            m, 
            d, 
            command_interface="effort",
            control_steps=10, 
            control_timer_freq=1e-2,
            )

        # run interactive viewer application
        while viewer.is_running():
            time.sleep(0.01) # only wish to sync periodically
            env.is_syncing = True
            viewer.sync()
            env.is_syncing = False 

Environment Examples [MoveIt + ROS2 Control Examples to be Published Shortly]

Screencast.from.05-16-2024.01_56_12.PM.webm

About

A ROS 2 package for launching MuJoCo simulation instances that interface with ROS 2.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 67.0%
  • CMake 29.3%
  • Python 3.7%