Author: Shiyuan Yang
Email: [email protected]
This tutorial will guide you through the steps to set up Docker ROS 2 to work with local Isaac Sim.
It only tested on docker terminal version, using docker desktop may need additional configurations
For more information: https://github.com/YangSY0628/how_to_use_isaac_sim
- Docker Ros2: Ensure Docker is installed on your system. You can download and install Docker from Docker's official website. For information on how to set up Docker for ROS, you can also refer to this blog post.
- Isaac Sim: refer to https://docs.omniverse.nvidia.com/isaacsim/latest/installation/install_ros.html#isaac-sim-app-enable-ros
Ideally, you should use a Dockerfile to manage the environment. A Dockerfile automates the setup of consistent, reproducible environments, reducing errors from manual configuration. It ensures applications run identically across development, testing, and production. Additionally, it allows version control of configurations, enabling better infrastructure management.
Simply run the following command in the directory containing the Dockerfile:
docker build -t my-python-app .
If you are at the very beginning without a Dockerfilepull,you start with FROM osrf/ros:humble-desktop-full
to build one.
Run the Docker container with the necessary environment variables and volume mounts to enable GUI applications and access to your local files.
docker run -it \
--name ros2-humble-container \
--network host \
--env="DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--volume="/home:/home" \
osrf/ros:humble-desktop-full \
rqt
after created container, next time run below to start it:
# Allow local connections to the X server
docker inspect --format='{{ .Config.Hostname }}' ros2-humble-container
docker start ros2-humble-container
docker exec -it ros2-humble-container /bin/bash
In the docker container you just created, ensure that your ROS 2 is properly configured to communicate with Isaac Sim. You may need to set environment variables and source the ROS 2 setup script. You can put these commands into .bashrc.
# Must be identical to Isaac Sim ROS_DOMAIN_ID, set RMW_IMPLEMENTATION for Isaac Sim ros2 bridge
export ROS_DOMAIN_ID=0
source /opt/ros/humble/setup.bash
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
# or use
# export FASTRTPS_DEFAULT_PROFILES_FILE=/home/robot_repo/humble_ws/fastdds.xml
When launching Isaac Sim from the NVIDIA Omniverse Launcher, set export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
under "Extra Args" to ensure it uses the correct ROS 2 configuration.
To verify that everything is set up correctly, you can run a simple ROS 2 node and check if it communicates with Isaac Sim.
ros2 run demo_nodes_cpp talker
In Isaac Sim, click play and you should be able to see the ROS 2 topics being published and subscribed to.
image
If you encounter connection issues while building Docker images in China mainland and you are already using a proxy, refer to the Docker proxy settings to set docker go through the proxy.
You are very likely to use docker pull
to pull the image before docker build
, since directly running docker pull
may report connection faliure.
You may also need to docker login to pull image