This repo shows examples of using Drake and ROS 2 together.
It uses the pydrake API and is of prototype quality.
For a similar effort in ROS 1, see EricCousineau-TRI/repro drake_ros1_hacks
.
Most of this is being merged into https://github.com/RobotLocomotion/drake-ros so see that repo for futher development and examples
- Ubuntu Focal (20.04)
- ROS 2 Rolling
- Some Drake binary installation from October 2020
Install ROS 2 Rolling using the Linux binary instructions and enable the ROS 2 testing apt repo.
Install the apt packages ros-rolling-desktop
and ros-rolling-sdformat-urdf
.
Extract the Drake binary installation, install it's prerequisites, and use this Python virutalenv trick.
Once the prerequisites are met, install drake_ros
into the Drake virtualenv.
. path/to/drake/bin/activate
cd path/to/this/repo
cd drake_ros/
python setup.py develop
This demo shows RViz visualizing a single UR10 robot being simulated by Drake. Set up two terminals: one for launching RViz, and another for launching the Drake simulation.
. /opt/ros/rolling/setup.bash
cd path/to/this/repo
AMENT_PREFIX_PATH="$AMENT_PREFIX_PATH:$(pwd)" rviz2 -d view.rviz
. /opt/ros/rolling/setup.bash
. path/to/drake/bin/activate
cd path/to/this/repo
AMENT_PREFIX_PATH="$AMENT_PREFIX_PATH:$(pwd)" ./ros2_demo.py
This demonstrates using interactive markers to control an iiwa14 being simulated by Drake. Set up two terminals: one for launching RViz, and another for launching the Drake simulation.
. /opt/ros/rolling/setup.bash
cd path/to/this/repo
AMENT_PREFIX_PATH="$AMENT_PREFIX_PATH:$(pwd)" rviz2 -d interactive_demo.rviz
. /opt/ros/rolling/setup.bash
. path/to/drake/bin/activate
cd path/to/this/repo
AMENT_PREFIX_PATH="$AMENT_PREFIX_PATH:$(pwd)" ./interactive_demo.py
There is a definition file for a Singularity container.
First build and install Singularity. Afterwards, build a Singularity sandbox from the definition file.
singularity build --fakeroot --sandbox ~/drake-ros2-demos.sandbox demos.singularity.def
Create a shell with access to an NVidia graphics card and run one of the RViz configs for your chosen demo.
$ singularity shell --nv --writable-tmpfs ~/drake-ros2-demos.sandbox
Singularity> rviz2 -d view.rviz
Create a shell into the sandbox and run one of the demos.
$ singularity shell --writable ~/drake-ros2-demos.sandbox
Singularity> ./ros2_demo.py