Skip to content

Latest commit

 

History

History
executable file
·
71 lines (57 loc) · 4.24 KB

setup_docker_ros2_with_isaac_sim.md

File metadata and controls

executable file
·
71 lines (57 loc) · 4.24 KB

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

Prerequisites

Step 1: Setup docker environment

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.

Step 2: Create and Run the Docker Container

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

Step 3: Configure ROS 2 with Isaac Sim

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 

Step 4: Launch Isaac Sim with ROS 2 Support

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. image

Step 5: Verify the Setup

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

docker network issue in China Mainland

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