This repository contains various tutorials for mc_rtc, an interface for simulation and robot control systems. Each tutorial is organized in its own folder, with code examples and explanations to help users understand different aspects of mc_rtc. Currently, two tutorials are available:
- dual_arm_controller: This tutorial demonstrates how to implement a dual-arm controller using C++ and Python. It showcases the control of two robotic arms working together to perform tasks.
- mobile_arm_controller: This tutorial focuses on controlling a mobile manipulator robot using C++ and Python. It illustrates how to manage both the mobility and manipulation capabilities of the robot.
Mujoco description for UR5e and Kinova robots are also provided to run controller with mc_mujoco, a MuJoCo interface for mc_rtc.
Clone this repository to your local machine:
git clone --recursive https://github.com/isri-aist/mc_rtc_tutorials.gitTo easily set up the environment for running the tutorials, you can use Docker. Follow these steps:
- Install Docker Engine and Docker Compose on your system if you haven't already.
- Navigate to the
dockerfilesdirectory of cloned repository and build, run the Docker container using Docker Compose:cd mc_rtc_tutorials/dockerfiles docker compose up -d - Access the running container:
docker exec -it mc_rtc_tutorials bash
It is not recommended to run the tutorials without Docker since it is mixed between independent CMake projects and ROS2 packages. However, if you want to run the tutorials without Docker, make sure to follow these steps:
- Install mc_rtc on your system.
- Build
robots_descriptionROS2 packages in a colcon workspace (assuming you have ROS2 Humble installed, and sourced):Remember to source the workspace after building:cd robots_description/ colcon buildsource install/setup.bash - Navigate to the tutorial directories and build them using CMake for C++ examples or run the Python scripts directly.
mkdir build && cd build cmake .. make && make install
In one terminal, run RVIZ2 for visualization:
ros2 launch mc_rtc_ticker display.launchIn a separate terminal, use mc_rtc_ticker to run the tutorials.
mc_rtc_ticker -f ~/config/dual_arm_controller.yamlPYTHONPATH=<path_to_mc_rtc_tutorials>/controllers/dual_arm_controller/python mc_rtc_ticker -f ~/config/dual_arm_controller_python.yamlIf you are using docker: PYTHONPATH=${HOME}/mc_rtc_ws/dual_arm_controller/python mc_rtc_ticker -f ~/config/dual_arm_controller_python.yaml
mc_rtc_ticker -f ~/config/mobile_arm_controller.yamlPYTHONPATH=<path_to_mc_rtc_tutorials>/controllers/mobile_arm_controller/python mc_rtc_ticker -f ~/config/mobile_arm_controller_python.yamlIf you are using docker: PYTHONPATH=${HOME}/mc_rtc_ws/mobile_arm_controller/python mc_rtc_ticker -f ~/config/mobile_arm_controller_python.yaml
You can add controllers of your own and build it easily.
Put your new controller inside controllers directory. If you have never work with mc_rtc before, you can find several tutorials to get started here.
cd controllersList your new controller in ~/controllers/CMakeLists.txt.
You can exit the container and recompose it.
docker compose up -d
docker exec -it mc_rtc_tutorials bashIf you are not using Docker or do not want to exit your container. Navigate to the build directory and rebuild the project.
cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build --parallel -j$(nproc)
cmake --install buildWith the provided mc_mujoco descriptions, you can run dual_arm_controller with mc_mujoco
mc_mujoco -sf ~/config/dual_arm_controller.yamlYou can add other controllers for UR5e and Kinova and simulate them with mc_mujoco using the same command.
mc_mujoco -sf <path_to_config_file>The project also provides a mc_rtc robot interface, mc_rtde. To run this, you can use the config file rtde.yaml
MCControlRtde -f ~/config/rtde.yamlFor both mc_rtc_ticker, mc_mujoco, and MCControlRtde, you can run them with flag -h or --help to see all available options.
This tutorial includes many submodules which are updated frequently. If you have any building issues. Consider update github submodules.
git submodule update --remote --recursive