ROS2 Bridge add new messages

Hello,
I am trying to create an extension that implements a ROS2 FollowJointTrajectory action server. However it requires the package control_msgs which is not present in ros2_bridge currently. It is installed in my normal ros foxy installation but i can’t source it as it creates conflict with ros2_bridge extension. I tried adding the pacakge inside the ros2_workspace folder inside the isaac sim folder and built it but it was still not detected

tl:dr how can i add new messages type to ros2_bridge

Thanks

Hi,

If you are already successful building your control_msgs in a ros2 workspace, then try manually adding that folder’s install path into the sys.path, like this:

import sys
sys.path.insert(0,"<ros2_workspace>/install/control_msgs/lib/python3.8/site_packages')
from control_msgs import  XXX

If control_msgs hasn’t been built inside a ros2 workspace, then you may need to modify that folder so that it builds. This may involve more than just moving the folder inside a ros2 workspace, you may need to manually add all the message and service types that you need inside a ros2 package, and build it per instructions from ROS2 docs. Once it’s built, then try adding that install path inside Sim.

Hello,

Thanks for the answer, I’ve tried that with the default ros installation ("/opt/ros/foxy/lib/python3.8/site_packages") that has the control_msgs folder inside of it.

I’ve also tried getting it from github and building it and adding it to my path using the way you mentioned but i get the same error.

I’ve also tried using importlib using

from importlib.machinery import SourceFileLoader
module = SourceFileLoader("control_msgs", "/opt/ros/foxy/lib/python3.8/site-packages/control_msgs/__init__.py").load_module()        

but I always get this error:

2022-01-03 15:05:24 [21,513ms] [Error] [omni.ext.plugin] Could not load the dynamic library from /home/ubb/.local/share/ov/pkg/isaac_sim-2021.2.0/exts/omni.isaac.ros2_bridge/bin/libcontrol_msgs__python.so. Error: libcontrol_msgs__rosidl_generator_c.so: cannot open shared object file: No such file or directory

for reference I am importing from control_msgs.action import FollowJointTrajectory

@09ubberboy90 After some more testing there is a bug with the ROS2 bridge that prevent this. We are working on a solution for a future release.

Hi I don’t know if it can help but I figured out that it was because I used python3.8 for the path while isaac expects python3.7. Once i compilled it using python3.7 and imported that instead it worked

1 Like