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.
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 Desktop (or 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.
cd build/
cmake ..
make
sudo make install