Issue with failed connection between Isaac Sim and Ros2 docker container

Hi,

I am trying to connect to a host server and execute two separate docker containers with Isaac Sim and ros2 humble running on each. Then, I wanted to use omniverse streaming client to use GUI on my local computer. Lastly, I want to enable ros2 bridge inside Isaac sim docker container so that I could use ros2 commands in ros2 docker container and let it affect Isaac sim and vice versa.

Now several vital errors were found during this process. First, Isaac Sim streaming client was very unstable; it kept on failing after a short period.

Second, I tried to enable ros2 bridge in Isaac Sim streaming client, but it wouldn’t work. The weird thing is, ros1 bridge works just fine, even though I never installed ros1 locally, in the host computer, or in all the docker containers.

I followed all the instructions in the installation documents.

Container installation:

https://docs.omniverse.nvidia.com/isaacsim/latest/installation/install_container.html

ROS & ROS2 installation:

https://docs.omniverse.nvidia.com/isaacsim/latest/installation/install_ros.html#isaac-sim-app-install-ros

While following the document, I encountered another problem.
In ROS & ROS2 installation document, it says:

“If you are using a Isaac Sim ROS2 workspace, a fastdds.xml file is located at the root of the <ros2_ws> folder. Set the environment variable by typing export FASTRTPS_DEFAULT_PROFILES_FILE=<path_to_ros2_ws>/fastdds.xml in all the terminals that will use ROS2 functions, as well as setting it under “Extra Args” when launching Isaac Sim from the NVIDIA Omniverse™ Launcher.”

This instruction only tells us about settings in launching Isaac Sim from NVIDIA Omniverse launcher. How can I change the default setting so that it works just fine in Omniverse streaming client?

1 Like

Hi @device.autopedia,

Regarding the ros2 bridge issue, I just encountered the same issue as you facing.
However, I found the following message from logs when executing runheadless.native.sh -v in docker container.

After exporting both environment variables(i.e. RMW_IMPLEMENTATION and LD_LIBRARY_PATH they mention) and relaunching, the ros2 bridge error disappeared and was already enabled in Isaac Sim streaming client.

@device.autopedia Please try the latest 4.0.0 version and suggestions from @FredericBRH0n9

Let us know if you are still having issues.

I’m currently facing the same issue of connecting between Isaac sim container and ROS2 Container both running on the same AWS EC2 instance.

@FredericBRH0n9
I actually tried setting the environment variable as asked but instead found the this error on running ./runheadless.native.sh

2024-07-25 14:10:15 [34,937ms] [Warning] [omni.isaac.ros2_bridge.scripts.extension] ROS_DISTRO env var not found, Please source ROS2 Foxy, or Humble, before enabling this extension
[35.027s] Using backup internal ROS2 humble distro
[ERROR] [1721916615.516844618] [rcl]: Error getting RMW implementation identifier / RMW implementation not installed (expected identifier of 'rmw_fastrtps_cpp'), with error message 'failed to load shared library 'librmw_fastrtps_cpp.so' due to dlopen error: librmw_fastrtps_cpp.so: cannot open shared object file: No such file or directory, at /workspace/humble_ws/src/rcutils/src/shared_library.c:99, at /workspace/humble_ws/src/rmw_implementation/src/functions.cpp:65', exiting with 1., at /workspace/humble_ws/src/rcl/rcl/src/rcl/rmw_implementation_identifier_check.c:139


[35.085s] To use the internal libraries included with the extension please set the following environment variables to use with FastDDS (default) or CycloneDDS (ROS2 Humble only):
RMW_IMPLEMENTATION=rmw_fastrtps_cpp
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/isaac-sim/exts/omni.isaac.ros2_bridge/humble/lib

OR

RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/isaac-sim/exts/omni.isaac.ros2_bridge/humble/lib
Before starting Isaac Sim
2024-07-25 14:10:15 [34,996ms] [Error] [omni.isaac.ros2_bridge.scripts.extension] ROS2 Bridge startup failed

@Sheikh_Dawood
I’m running the latest 4.0.0 following the tutorials for having 2 containers running.
Kinda finding it difficult to make the environmental variables accessible from one docker to another. I’ve been following this tutorial: Isaac ROS Docker setup and AWS Isaac Sim setup
My Isaac sim works fine but it doesn’t load the ROS2 bridge.

On the ROS2 Docker setup side I’m getting the following errors;

  1. rocker command isn’t showing the container in the docker ps. The commands is rocker --nvidia --x11 --privileged --network host --name <container name> osrf/ros:humble-desktop-full-jammy
  2. Setting the FASTRTPS_DEFAULT_PROFILES_FILE env in ROS2 and Isaac sim docker doesn’t make the difference too. Tried to set this variable in docker run adding this line too:
    -e "FASTRTPS_DEFAULT_PROFILES_FILE=/home/ubuntu/IsaacSim-ros_workspaces/humble_ws/fastdds.xml" \
    But still it doesn’t work.
    Please do let me know if you need any more information and make the solution work as @device.autopedia asked for.

EDIT 1: @FredericBRH0n9 method worked for me for enabling ROS2 Bridge:

  1. docker run Isaac sim
  2. export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
  3. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/isaac-sim/exts/omni.isaac.ros2_bridge/humble/lib
  4. ./runheadless.native.sh -v

Still I’m looking to make ROS2 in a different container with Isaac sim.

Hi @syedjawadakhtar,

I was successfully able to get ROS docker containers to talk to each other and to the Isaac Sim Container on the same AWS EC2 instance. I used Isaac Sim 4.1.0 although 4.0.0 should work too.

Here is what I did:

Run the steps 1-4 below as you have indicated in your previous post to run the Isaac Sim container.

  1. docker run Isaac sim
  2. export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
  3. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/isaac-sim/exts/omni.isaac.ros2_bridge/humble/lib
  4. ./runheadless.native.sh -v

Next, we must create a fastdds.xml file. We can either clone the Isaac Sim workspaces repo to obtain the file or make one from the installation documentation.

Run a ROS2 Docker container with the flags as shown below (I have assumed that the workspace repo was cloned). We are mounting the humble workspace inside the docker at the location /humble_ws.

  1. docker run -it --rm --net=host --env="DISPLAY" -v ~/IsaacSim-ros_workspaces/humble_ws:/humble_ws osrf/ros:humble-desktop-full
  2. Within the docker: source /opt/ros/humble/setup.bash
  3. Within the docker: export FASTRTPS_DEFAULT_PROFILES_FILE=/humble_ws/fastdds.xml
  4. The ROS2 Docker container is now setup to communicate with Isaac Sim container.

For a quick test:

  1. In the Isaac Sim container run a ROS2 standalone example: ./python.sh standalone_examples/api/omni.isaac.ros2_bridge/clock.py
  2. In the ROS2 docker container run either: ros2 topic echo /manual_time rosgraph_msgs/msg/Clock or ros2 topic echo /sim_time rosgraph_msgs/msg/Clock

You should be able to see messages coming from Isaac Sim!

Please let us know if this works for you!

Hi @Ayush_G

Thanks for the detailed reply.

I followed everything as you asked, I guess I was missing to import the fastdds.xml in the ROS2 container. But yes everything worked until I reached to test your provided example. It gave me the following error:

  • On a new terminal: docker exec -it isaac-sim bash; export the variables again; run command: ./python.sh standalone_examples/api/omni.isaac.ros2_bridge/clock.py. It gives me the following list of errors:
[14.785s] Simulation App Startup Complete
[14.803s] [ext: omni.isaac.ros2_bridge-2.26.4] startup
2024-08-07 08:56:13 [14,795ms] [Warning] [omni.isaac.ros2_bridge.scripts.extension] ROS_DISTRO env var not found, Please source ROS2 Foxy, or Humble, before enabling this extension
[14.807s] Using backup internal ROS2 humble distro
[ERROR] [1723020973.759777380] [rcl]: Error getting RMW implementation identifier / RMW implementation not installed (expected identifier of 'rmw_fastrtps_cpp'), with error message 'failed to load shared library 'librmw_fastrtps_cpp.so' due to dlopen error: librmw_fastrtps_cpp.so: cannot open shared object file: No such file or directory, at /workspace/humble_ws/src/rcutils/src/shared_library.c:99, at /workspace/humble_ws/src/rmw_implementation/src/functions.cpp:65', exiting with 1., at /workspace/humble_ws/src/rcl/rcl/src/rcl/rmw_implementation_identifier_check.c:139


[14.822s] To use the internal libraries included with the extension please set the following environment variables to use with FastDDS (default) or CycloneDDS (ROS2 Humble only):
RMW_IMPLEMENTATION=rmw_fastrtps_cpp
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/isaac-sim/exts/omni.isaac.ros2_bridge/humble/lib

OR

RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/isaac-sim/exts/omni.isaac.ros2_bridge/humble/lib
Before starting Isaac Sim
2024-08-07 08:56:13 [14,810ms] [Error] [omni.isaac.ros2_bridge.scripts.extension] ROS2 Bridge startup failed
[15.168s] [ext: omni.isaac.ros2_bridge-2.26.4] shutdown
2024-08-07 08:56:14 [15,303ms] [Warning] [omni.ext._impl._internal] omni.isaac.ros2_bridge-2.26.4 -> <class 'omni.isaac.ros2_bridge.scripts.og_shortcuts.og_shortcut_menu.Extension'>: extension object is still alive, something holds a reference on it. References: ["[0]:type: <class 'method'>, id: 139763788293184", "[1]:type: <class 'method'>, id: 139767457879680", "[2]:type: <class 'method'>, id: 139764038081664", "[3]:type: <class 'method'>, id: 139764038076928", "[4]:type: <class 'method'>, id: 139764038088320", '[*] ...']
Traceback (most recent call last):
  File "/isaac-sim/standalone_examples/api/omni.isaac.ros2_bridge/clock.py", line 28, in <module>
    import rclpy
ModuleNotFoundError: No module named 'rclpy'

But I tried importing the ROS2 Clock in the Isaac sim and then ros2 echo worked in my container. Also, I tried ros2 echo for published /cmd_vel worked too. Thank you so much!

P.S.: Can you help me make VS Code work in a similar environment? Maybe you can check this discord conversation when I was trying to solve it: Discord

Hi @syedjawadakhtar,

Just to clarify, you do not need to run ./runheadless.native.sh -v before running ./python.sh. So I would suggest to run either runheadless.native.sh or ./python.sh at a time in the first terminal!

Will take a look at Discord :)

Thanks,
Ayush

Hi @Ayush_G,
Thanks again for the reply!

Running the ./python.sh gives the following error:

[12.277s] app ready
2024-08-08 16:38:02 [12,906ms] [Warning] [omni.kit.imgui_renderer.plugin] _createExtendCursor: No windowing.
2024-08-08 16:38:02 [12,906ms] [Warning] [omni.kit.imgui_renderer.plugin] _createExtendCursor: No windowing.
[13.864s] Simulation App Startup Complete
[13.881s] [ext: omni.isaac.ros2_bridge-2.26.4] startup
2024-08-08 16:38:03 [13,872ms] [Warning] [omni.isaac.ros2_bridge.scripts.extension] ROS_DISTRO env var not found, Please source ROS2 Foxy, or Humble, before enabling this extension
[13.883s] Using backup internal ROS2 humble distro
[13.927s] Attempting to load system rclpy
[13.927s] Could not import system rclpy: No module named 'rclpy'
[13.927s] Attempting to load internal rclpy
[13.948s] rclpy loaded
2024-08-08 16:38:03 [14,238ms] [Warning] [omni.fabric.plugin] No source has valid data array=0x2051ac60 usdValid=0 cpuValid=0
2024-08-08 16:38:05 [15,331ms] [Warning] [omni.timeline.plugin] Deprecated: direct use of ITimeline callbacks is deprecated. Use ITimeline::getTimeline (Python: omni.timeline.get_timeline_interface) instead.
2024-08-08 16:38:05 [15,331ms] [Warning] [omni.fabric.plugin] No source has valid data array=0xbf229c0 usdValid=0 cpuValid=0
sim time: builtin_interfaces.msg.Time(sec=0, nanosec=216666677)
manual stepped sim time: builtin_interfaces.msg.Time(sec=0, nanosec=216666677)
sim time: builtin_interfaces.msg.Time(sec=0, nanosec=400000020)
manual stepped sim time: builtin_interfaces.msg.Time(sec=0, nanosec=400000020)
sim time: builtin_interfaces.msg.Time(sec=0, nanosec=450000023)
sim time: builtin_interfaces.msg.Time(sec=0, nanosec=483333358)
sim time: builtin_interfaces.msg.Time(sec=0, nanosec=516666693)
sim time: builtin_interfaces.msg.Time(sec=0, nanosec=550000028)
sim time: builtin_interfaces.msg.Time(sec=0, nanosec=583333363)
manual stepped sim time: builtin_interfaces.msg.Time(sec=0, nanosec=566666696)
sim time: builtin_interfaces.msg.Time(sec=0, nanosec=633333366)
sim time: builtin_interfaces.msg.Time(sec=0, nanosec=666666701)
sim time: builtin_interfaces.msg.Time(sec=0, nanosec=700000036)
2024-08-08 16:38:09 [19,509ms] [Warning] [carb.windowing-glfw.plugin] GLFW initialization failed.
2024-08-08 16:38:09 [19,509ms] [Warning] [carb] Failed to startup plugin carb.windowing-glfw.plugin (interfaces: [carb::windowing::IGLContext v1.0],[carb::windowing::IWindowing v1.4]) (impl: carb.windowing-glfw.plugin)
2024-08-08 16:38:09 [19,726ms] [Warning] [omni.usd] Unexpected reference count of 2 for UsdStage 'anon:0x15a7dd20:World0.usd' while being closed in UsdContext (this may indicate it is still resident in memory).
[19.890s] Simulation App Shutting Down

Apparently, when running the ./runheadless.native.sh also showed that it’s using its native humble distros and it didn’t find any ROS env. So now I’m confused… Is the Isaac Sim container not detecting the ROS2 container? But it’s the ROS2 container that seems to be connected all the time.

Hi @syedjawadakhtar, it is possible that the ROS2 container running FastDDS is not able to find the ROS 2 traffic from the Isaac Sim container. Could you verify that you are defining the FASTRTPS_DEFAULT_PROFILES_FILE variable with the path to fastdds.xml file in both containers? As outlined here in the preparation section.

Hi @Ayush_G ,

Thanks for pointing out about the FASTRTPS_DEFAULT_PROFILES_FILE to be exported on the Isaac Sim container too. So following these steps on the website to add a new file fastdds.xml on the Isaac sim container:

  1. cd ~/.ros
  2. touch fastdds.xml and past the given snippet.
  3. export FASTRTPS_DEFAULT_PROFILES_FILE=~/.ros/fastdds.xml
    and then running the example: ./python.sh standalone_examples/api/omni.isaac.ros2_bridge/clock.pystill gives the same error.
    Btw how do we source the ROS2 workspace in Isaac Sim as it asks on the website for each terminal?

My method is below.

  1. make fastdds.xml

    mkdir ros
    touch ros/fastdds.xml # and past the given snippet
    
  2. launch isaac container

    docker run --name isaac-sim --entrypoint bash -it --runtime=nvidia --gpus all -e "ACCEPT_EULA=Y" --rm --network=host \
     -e "PRIVACY_CONSENT=Y" \
     -v ~/docker/isaac-sim/cache/kit:/isaac-sim/kit/cache:rw \
     -v ~/docker/isaac-sim/cache/ov:/root/.cache/ov:rw \
     -v ~/docker/isaac-sim/cache/pip:/root/.cache/pip:rw \
     -v ~/docker/isaac-sim/cache/glcache:/root/.cache/nvidia/GLCache:rw \
     -v ~/docker/isaac-sim/cache/computecache:/root/.nv/ComputeCache:rw \
     -v ~/docker/isaac-sim/logs:/root/.nvidia-omniverse/logs:rw \
     -v ~/docker/isaac-sim/data:/root/.local/share/ov/data:rw \
     -v ~/docker/isaac-sim/documents:/root/Documents:rw \
     -v $(pwd)/ros:/root/ros:rw
     nvcr.io/nvidia/isaac-sim:4.0.0 
    
  3. start app with headless mode

    export RMW_INPLEMENTATION=rmw_fastrtps_cpp
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/isaac-sim/exts/omni.isaac.ros2_bridge/humble/lib
    export FASTRTPS_DEFAULT_PROFILES_FILE=~/ros/fastdds.xml
    ./runheadless.native.sh
    
  4. launch Omniverse Streaming Clinet

  5. make Clock Omni Graph ROS2 Clock — Omniverse IsaacSim latest documentation and start simlation

  6. launch ros 2 container

    docker run --name isaac-sim --entrypoint bash -it --runtime=nvidia --gpus all -e "ACCEPT_EULA=Y" --rm --network=host \
     -v $(pwd)/ros:/root/ros:rw
     ros:humble 
    
  7. list topic

    export RMW_INPLEMENTATION=rmw_fastrtps_cpp
    export FASTRTPS_DEFAULT_PROFILES_FILE=~/ros/fastdds.xml
    source /opt/ros/humble/setup.bash
    ros2 topic list   
    

I could not use standalone_examples/api/omni.isaac.ros2_bridge/clock.py with headless mode. I get default window when I open Omniverse Streaming Client.