Extend ROS2 capabilities

I want to use a ROS topic to manipulate specific USD properties. In particular, I would like publish something like a ‘enabled’ or ‘disabled’ on a ROS topic to set a specific collider on a mesh in Isaac Sim to ‘Collision enabled’ or ‘Collision disabled’.

My impression is that there is no feature in ROS2Bridge that supports this at the moment. I might be interested in implementing something using the Isaac API using Python, if it is not too difficult.

Could someone give me some directions on how to proceed? I have some very basic knowledge of the Omniverse/Isaac Python API.

Thanks
Bruno

Hi @bruno.vetter

There is a user-extension that supports getting a setting the attributes of USD prims using ROS services

There are versions for both ROS and ROS2
ROS: External Extensions: ROS Bridge (add-on)
ROS2: External Extensions: ROS2 Bridge (add-on)

I hope it will be useful

Here is an example video for collision enabling/disabling

I’d love to try it, but am struggling with getting the extensions to be selectable in the extensions manager. I put this in my omni.isaac.sim.base.kit

folders.'++' = [
    "${app}/../exts",
    "git+https://github.com/Toni-SM/omni.usd.schema.add_on.git?branch=main&dir=exts",
    "git+https://github.com/Toni-SM/omni.add_on.ros_bridge_ui.git?branch=main&dir=exts", 
    "git+https://github.com/Toni-SM/omni.add_on.ros2_bridge.git?branch=main&dir=exts"
] 

but unfortunately they are not visible. I have omni.kit.extpath.git enabled, by the way.

Any help appreciated.
Bruno

Hi @bruno.vetter

Have you tried to add them manually in the Extension window?

No. I had not known of this. Now it works, thanks a lot. I will try out your extensions. It might be exactly what I need.

I need some advice setting this up. I was able to activate the extension in Isaac Sim. When Isaac is running, I see some services:

brunovetter@brunovetter-Blade-17-Mid-2021-RZ09-0406:~$ ros2 service list
/OmniAddOnRos2Bridge/describe_parameters
/OmniAddOnRos2Bridge/get_parameter_types
/OmniAddOnRos2Bridge/get_parameters
/OmniAddOnRos2Bridge/list_parameters
/OmniAddOnRos2Bridge/set_parameters
/OmniAddOnRos2Bridge/set_parameters_atomically

I do not see any service like /get_prims yet. Looking at the README, I do not understand completely what to do next. I would like to make a simple service call from the ros2 cli.

My knowledge about ROS2-Services is at a basic tutorial level.

The README tells me:
The ROS2 package add_on_msgs contains the definition of the messages (download and add it to a catkin workspace).

Is this the missing part? I have a ROS2 workspace that I use with colcon. I put the add_on_msgs folder below my src folder and executed a colcon build (never used catkin).

After that, under /install/add_on_msgs, I get this directory structure:

.
├── include
│   └── add_on_msgs
│       ├── msg
│       └── srv
│           └── detail
│               └── dds_fastrtps
├── lib
│   └── python3.8
│       └── site-packages
│           └── add_on_msgs
│               ├── __pycache__
│               └── srv
│                   └── __pycache__
└── share
    ├── add_on_msgs
    │   ├── cmake
    │   ├── environment
    │   ├── hook
    │   └── srv
    ├── ament_index
    │   └── resource_index
    │       ├── package_run_dependencies
    │       ├── packages
    │       ├── parent_prefix_path
    │       └── rosidl_interfaces
    └── colcon-core
        └── packages

But I see nothing like a service node providing something like /set_attribute.

Any advice much appreciated.
Bruno

I think part of what I was missing is the ‘RosAttribute’. I just created one in my scene and now I see the missing services (also found that the simulation must be running). Let me check if I can proceed now.

Bruno

Ok collision enabling/disabling works now.

Great, thanks!!!

Only trouble is I get the following errors from Isaac every time I issue a service call like this:

ros2 service call /set_attribute add_on_msgs/srv/SetPrimAttribute '{path: "/World/track_colliders/TrackColliders/s01l/s01l", attribute: "physics:collisionEnabled", value: "true"}'
2022-01-13 12:46:20 [4,562,001ms] [Error] [omni.physx.plugin] PhysX error: PxShape::setFlag() not allowed while simulation is running. Call will be ignored., FILE /buildAgent/work/c6f19e3bba7d41ab/source/physx/src/NpShape.cpp, LINE 719
2022-01-13 12:46:20 [4,562,001ms] [Error] [omni.physx.plugin] PhysX error: PxShape::setFlag() not allowed while simulation is running. Call will be ignored., FILE /buildAgent/work/c6f19e3bba7d41ab/source/physx/src/NpShape.cpp, LINE 719
2022-01-13 12:46:20 [4,562,001ms] [Error] [omni.physx.plugin] PhysX error: PxScene::resetFiltering() not allowed while simulation is running. Call will be ignored., FILE /buildAgent/work/c6f19e3bba7d41ab/source/physx/src/NpScene.cpp, LINE 2439

Hi @bruno.vetter

There is an update of the extension in which this problem is fixed.
Please, upgrade the current version of your extension and let me know if everything is working good :)

Hi toni.sm,

I have updated the extensions via the extensions manager and restarted Isaac Sim. After the update, I cannot access the attribute anymore. On the command line, this is what I get:

brunovetter@brunovetter-Blade-17-Mid-2021-RZ09-0406:~/dev_ws$ ros2 service call /set_attribute add_on_msgs/srv/SetPrimAttribute '{path: "/World/track_colliders/TrackColliders/s01s/s01s", attribute: "physics:collisionEnabled", value: "false"}' && ros2 service call /set_attribute add_on_msgs/srv/SetPrimAttribute '{path: "/World/track_colliders/TrackColliders/s01l/s01l", attribute: "physics:collisionEnabled", value: "true"}'
waiting for service to become available...
requester: making request: add_on_msgs.srv.SetPrimAttribute_Request(path='/World/track_colliders/TrackColliders/s01s/s01s', attribute='physics:collisionEnabled', value='false')

response:
add_on_msgs.srv.SetPrimAttribute_Response(success=False, message='The timeout (2.5s) for setting the attribute value has been reached')

Removing and reinstalling the extension does not help, unfortunately.

These are the extension paths I have added:

git+https://github.com/Toni-SM/omni.usd.schema.add_on.git?branch=main&dir=exts
git+https://github.com/Toni-SM/omni.add_on.ros_bridge_ui.git?branch=main&dir=exts
git+https://github.com/Toni-SM/omni.add_on.ros2_bridge.git?branch=main&dir=exts

Hi @bruno.vetter

Is Isaac Sim simulating when you call the service?

Could you please share the .usd you are using to test on it?

The simulation is on when this happens.

I probably may not share the usd. When I find time, I will try to set up a new scene and try to reproduce.