Setting Up Docker ROS 2 with Local Isaac Sim - MohismLab/MohismLab_HomePage GitHub Wiki
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 <YOUR_IMAGENAME> .
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 <YOUR_CONTAINER_NAME> \
--network host \
--env="DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--volume="<YOUR_PATH>/humble_ws:/root/humble_ws" \
<YOUR_IMAGENAME> \
rqt
For the students in E11 GPU-lab, rqt may need to be disabled. After created container, next time run below to start it:
docker start <YOUR_CONTAINER_NAME> && docker exec -it <YOUR_CONTAINER_NAME> /bin/bash
If rviz
is needed, run the following command to allow local connections to the X server from the specified Docker container:
xhost +local:$(docker inspect --format='{{ .Config.Hostname }}' <YOUR_CONTAINER_NAME>) && docker start <YOUR_CONTAINER_NAME> && docker exec -it <YOUR_CONTAINER_NAME> /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. It has also been added into DOCKERFILE.
# 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 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, you should be able to see the ROS 2 topics being published and subscribed to.
If you encounter connection issues while building Docker images in China mainland, refer to the Docker proxy settings.
You may also use docker pull
before docker build
, since directly running docker pull
may report connection faliure.
You may also need to docker login to pull image