This guide provides step-by-step instructions for installing the RoboMaster Simulation running in CoppeliaSim using Pixi.
- Download CoppeliaSim for Apple Silicon or Intel
- Unzip and move to
/Applications/coppeliaSim.app - Right-click on
coppeliaSim.app-> Open -> Open - Add the following to the
pixi.tomlin your pixi project:[activation.env] COPPELIASIM_ROOT_DIR = "/Applications/coppeliaSim.app/Contents/Resources"
- CoppeliaSim must be launched from the Terminal (this will become important later):
/Applications/coppeliaSim.app/Contents/MacOS/coppeliaSim
- Download CoppeliaSim for Ubuntu 22.04 or Ubuntu 24.04
- Extract CoppeliaSim in a directory of your choice, for example in your
COURSE_FOLDER:cd <COURSE_FOLDER> tar xvf CoppeliaSim_Edu_V4_7_0_rev4_Ubuntu<UBUNTU_VERSION>.tar.xz
- Add to
pixi.toml:[activation.env] COPPELIASIM_ROOT_DIR = "<PATH_TO_COPPELIA>/CoppeliaSim_Edu_V4_7_0_rev4_Ubuntu<UBUNTU_VERSION>"
- CoppeliaSim must be launched from the Terminal (this will become important later):
<PATH_TO_COPPELIA>/CoppeliaSim_Edu_V4_7_0_rev4_Ubuntu<UBUNTU_VERSION>/coppeliaSim.sh
We prepared a Pixi project for you with all required dependencies for using the RoboMaster in CoppeliaSim. You can set it up by cloning this repository:
git clone git@github.com:idsia-robotics/robotics-lab-usi-robomaster.git --recursiveUbuntu: You need to customize the COPPELIASIM_ROOT_DIR in the pixi.toml of this repo to point to your CoppeliaSim installation.
Now enter the repository, compile and install the packages:
cd robotics-lab-usi-robomaster
pixi install
pixi shell
colcon build --symlink-installYou can launch CoppeliaSim with this command. This is important to ensure that Coppelia is started with the correct environment variables to see the ROS packages installed in this repo:
pixi run coppeliaYour installation is complete! π
The following instructions walk you through the process of setting up a Pixi project from scratch. We leave them here as a reference, in case you need to do it yourself in the future for new projects.
You don't need to go through them right now!
This is a fork of the official DJI RoboMaster Python API modified to solve some issues in using these robots with ROS2.
Inside the <ROS_PROJECT_FOLDER>.
pixi shell
pixi add libopus
pixi add --pypi "robomaster@git+https://github.com/jeguzzi/RoboMaster-SDK.git"
pixi add --pypi "libmedia_codec@git+https://github.com/jeguzzi/RoboMaster-SDK.git#subdirectory=lib/libmedia_codec"This package provides RoboMaster models for CoppeliaSim. It includes 3D graphics, dynamics and sensors models and a control interface that mimics the real RoboMaster's network protocol.
Inside the <ROS_PROJECT_FOLDER>.
pixi shell
pixi add spdlog boost cmake ffmpeg libxslt xmlschemaCreate a pixi-toolchain.cmake file in your <ROS_PROJECT_FOLDER> with the following content:
# Force CMake to look for all shared libraries (spdlog, Boost, etc.) inside the pixi environment
set(CMAKE_FIND_ROOT_PATH "$ENV{CONDA_PREFIX}")
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
# Force Coppelia to load the exact version of the dylibs used at build time, instead of letting
# the OSes to resolve a version at runtime with their usual opaque logic.
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH True)Add the following to your pixi.toml so that CMake finds the toolchain file:
[activation.env]
CMAKE_TOOLCHAIN_FILE = "$PIXI_PROJECT_ROOT/pixi-toolchain.cmake"mkdir -p src
cd src
git clone git@github.com:jeguzzi/robomaster_sim.gitcd ..
colcon build --symlink-installThe symlink install option install Python ROS2 packages using symlink from the install to the src folder making them editable. This only applies to Python files and not to config or launch files.
- Open CoppeliaSim.
- Add RoboMaster via:
Model browser (the left sidebar) -> robots -> mobile -> RoboMasterEP - Press play and ensure no errors are printed in the Coppelia log (Bottom).
With CoppeliaSim running and a Robomaster in the scene.
cd src/robomaster_sim/examples
pixi shell
python discover.pyThis script should find the RoboMaster in the scene, print some info about it, and close itself.
This package provides ROS drivers for the RoboMaster, whether real or simulated. Inside the <ROS_PROJECT_FOLDER>:
pixi shell
pixi add ros-humble-xacro ros-humble-launch-xml ros-humble-cv-bridge ros-humble-launch-testing-ament-cmake ros-humble-robot-state-publisher ros-humble-joint-state-publisher ros-humble-joint-state-publisher-gui ros-humble-joy
pixi add --pypi numpy-quaternioncd src
git clone https://github.com/jeguzzi/robomaster_ros.gitcd ..
colcon build --symlink-installSource the setup file:
source install/setup.zshor
source install/setup.bashSourcing this file add your custom packages to the available ROS2 packages (sourced using pixi shell) allowing you to launch them.
Launch the RoboMaster driver ROS nodes:
ros2 launch robomaster_ros ep.launchIn another terminal, inside the <ROS_PROJECT_FOLDER>.
pixi shell
ros2 topic pub /cmd_vel geometry_msgs/msg/Twist "{linear: {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.5}}"The robot should start to rotate counter-clockwise.
Use this command to stop it:
ros2 topic pub /cmd_vel geometry_msgs/msg/Twist "{linear: {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}}"Finally, let's install the CoppeliaSim ROS2 plugin. This allows to interact with the simulation from ROS2, providing topics and services to start and stop the simulation, read the simulation clock, etc.
cd src
git clone git@github.com:jeguzzi/simExtROS2.git -b iron-4.6pixi shell
colcon build --symlink-install