Load_stage.py with ros2

Hi,

I’m encontering a strange behavior (surely it’s logic but :/ )

I’m trying to load a scene via a python script with ROS2_bridge enabled with isaac sim 2023.1.1.

First I started with the template : “standalone_examples/api/omni.isaac.kit/load_stage.py”

Here is the first script I made, I removed the Argparse and the Nucleus one 'cause I don’t need it :

# Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#

import argparse
import sys

import carb
import omni
from omni.isaac.kit import SimulationApp


# This sample loads a usd stage and starts simulation
CONFIG = {"width": 1280, "height": 720, "sync_loads": True, "headless": True, "renderer": "RayTracedLighting"}


# Set up command line arguments

kit = SimulationApp(launch_config=CONFIG)

from omni.isaac.core.utils.extensions import enable_extension
# Default Livestream settings
kit.set_setting("/app/window/drawMouse", True)
kit.set_setting("/app/livestream/proto", "ws")
kit.set_setting("/app/livestream/websocket/framerate_limit", 60)
kit.set_setting("/ngx/enabled", False)

# Note: Only one livestream extension can be enabled at a time
# Enable Native Livestream extension
# Default App: Streaming Client from the Omniverse Launcher
enable_extension("omni.kit.livestream.native")
# enable_extension("omni.isaac.sim.base")

from omni.isaac.core import World
from omni.isaac.core.utils.stage import open_stage

#External lib
import os

scene_path = "/folder/scene.usd"
open_stage(usd_path=scene_path)

kit.update()
kit.update()

print("Loading stage...")
from omni.isaac.core.utils.stage import is_stage_loading

while is_stage_loading():
    kit.update()
print("Loading Complete")
omni.timeline.get_timeline_interface().play()

while kit.is_running():
    # Run in realtime mode, we don't specify the step size
    kit.update()
omni.timeline.get_timeline_interface().stop()
kit.close()

The scene loads correctly in a native streaming isaac with this version.

Then I wanted to add the config for enabling ros2_bridge.
I found in the native_livestream.py that in 2023.1.1 isaac version, ros2_bridge is natively enabled with the extension “omni.isaac.sim.base”.

So I add in my code a line with (it’s commented in the previous snippet) :

enable_extension("omni.isaac.sim.base")

And that where mystery happen. When I enable this extension and run the script, in the log there is some warning but no error and I searched everywhere but nothing that help, ROS2 start well but my usd scene didn’t show up even if in the log the scene is loaded.

Here is the log without “omni.isaac.sim.base” (there is ros2_bridge error but it’s normal):

2024-04-10 11:39:52 [5,743ms] [Warning] [omni.graph.core.plugin] Could not find node type interface for 'omni.isaac.ros2_bridge.ROS2CameraHelper'                                                                                                                           
2024-04-10 11:39:52 [5,744ms] [Warning] [omni.graph.core.plugin] Could not find node type interface for 'omni.isaac.ros2_bridge.ROS2PublishJointState'                                                                                                                      
2024-04-10 11:39:52 [5,744ms] [Warning] [omni.graph.core.plugin] Could not find node type interface for 'omni.isaac.ros2_bridge.ROS2SubscribeJointState'                                                                                                                    
                                                                                                                                                                                                                         
Loading stage...                                                                                                                                                                                                                                                            
Loading Complete

and with it :

2024-04-10 11:36:34 [10,265ms] [Warning] [omni.kit.menu.utils.scripts.layout] Menu Layout not found. Create with; ("menu_index" controls menu order)                                                                                                                        
2024-04-10 11:36:34 [10,265ms] [Warning] [omni.kit.menu.utils.scripts.layout]   self._menu_placeholder = omni.kit.menu.utils.add_menu_items([MenuItemDescription(name="placeholder", show_fn=lambda: False)], name="Layout", menu_index=90)                                 
2024-04-10 11:36:34 [10,318ms] [Warning] [omni.kit.menu.utils.scripts.layout] Menu Layout not found. Create with; ("menu_index" controls menu order)                                                                                                                        
2024-04-10 11:36:34 [10,319ms] [Warning] [omni.kit.menu.utils.scripts.layout]   self._menu_placeholder = omni.kit.menu.utils.add_menu_items([MenuItemDescription(name="placeholder", show_fn=lambda: False)], name="Layout", menu_index=90)                                 
[10.462s] [ext: omni.isaac.assets_check-0.3.3] startup                                                                                                                                                                                                                      
[10.493s] [ext: omni.isaac.sim.base-2023.1.1] startup                                                                                                                                                                                                                       
2024-04-10 11:36:34 [10,587ms] [Warning] [omni.anim.graph.core.plugin] CharacterManager::Shutdown() called without a prior successful call to CharacterManager::Initialize().                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    2024-04-10 11:36:34 [10,712ms] [Warning] [omni.timeline.plugin] Deprecated: direct use of ITimeline callbacks is deprecated. Use ITimeline::getTimeline (Python: omni.timeline.get_timeline_interface) instead.                                                                                                                                                                                                                                                                                    
2024-04-10 11:36:46 [22,959ms] [Warning] [omni.kit.hotkeys.core.registry] [Hotkey] duplicated action as SPACE (On Press) with omni.kit.widget.toolbar.omni.kit.widget.toolbar::toolbar::play!                                                                               
2024-04-10 11:36:46 [22,959ms] [Warning] [omni.kit.hotkeys.core.registry] [Hotkey] Cannot register Global [omni.kit.widget.toolbar] omni.kit.widget.toolbar::toolbar::play.SPACE, error code: Duplicated action definition                                                  
Loading stage...                                                                                                                                                                                                                                                            
Loading Complete                                                                                                                                                                                                                                                                                                                                                          
2024-04-10 11:36:46 [23,008ms] [Warning] [omni.physx.plugin] Detected an articulation at /World/ur10e with more than 4 velocity iterations being added to a TGS scene.The related behavior changed recently, please consult the changelog. This warning will only print once
.                                                                                                                                                                                                                                                                           
2024-04-10 11:36:46 [23,089ms] [Warning] [omni.fabric.plugin] No source has valid data array=0x3654d730 usdValid=0 cpuValid=0                                                                                                                                               
2024-04-10 11:36:47 [23,464ms] [Warning] [omni.timeline.plugin] Deprecated: direct use of ITimeline callbacks is deprecated. Use ITimeline::getTimeline (Python: omni.timeline.get_timeline_interface) instead.                                                             
2024-04-10 11:36:47 [24,123ms] [Warning] [carb.windowing-glfw.plugin] GLFW initialization failed.                                                                                                                                                                           
2024-04-10 11:36:47 [24,123ms] [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-04-10 11:36:47 [24,189ms] [Warning] [carb] Plugin interface for a client: omni.hydratexture.plugin was already released.                                                                                                                                               
2024-04-10 11:36:47 [24,190ms] [Warning] [omni.usd] Unexpected reference count of 2 for UsdStage '/folder/scene.usd' while being closed in UsdContext (this may indicate it is still resident in memory).

I’m pretty sure that I miss something but I don’t know where…

Thanks for your time and have a great day !

Hi @quentin.deyna - Are you following this instruction for enabling ROS2 bridge?
https://docs.omniverse.nvidia.com/isaacsim/latest/installation/install_ros.html#enabling-the-ros-bridge-extension

Hi @rthaker thanks for your response,

Before the 2023.1.1 this was the way I used to start ros2 but in this new version of Isaac ros2_bridge is automatically loaded (if it’s started inside a ros2 env) .

I’m launching this load_stage.py inside a ros2 humble + isaac sim containerized (I should mentionned it in my original post) and I access it by the streaming client.

I want to load a stage with prebuilted action graph with ros2 nodes automatically inside this docker (if you manually start ros2_bridge after the scene, the ros2 node do not repopulate inside the action graph).

The strange beahavior is that the workspace seems loading correctly but disappeared right after the end of the script.
I will rewrite the script from scratch with the original load_stage.py and trying to debug step by step.

Thanks for your interest and help