Issues: Can not import custom ROS message in extension

I built msg in isaac_sim-2022.1.0/ros_workspach,and source devel/setup.bash.
I need to import the CustomMsg in my extension.But it can’t load correctly.

 from isaac_ros_messages.msg import CustomMsg
ImportError: cannot import name 'CustomMsg' from 'isaac_ros_messages.msg' (omniverse/pkg/isaac_sim-2022.1.0/exts/omni.isaac.ros_bridge/noetic/lib/python3/dist-packages/isaac_ros_messages/msg/

My system is Ubuntu18.04 with Melodic (Maybe noetic is not compatible with it?&why it is noetic/lib/python3 instead of melodic/lib/2.7?)

Another problem is that I can’t publish my point cloud from generic range sensor in extension.While it works in the Isaac_sim-2021.2.1.

Hi @1324539608,

Isaac Sim runs a custom roscpp build of ROS Noetic internally so that it works properly with the Omniverse framework and Python 3. This is backwards compatible with ROS Melodic .

Isaac Sim uses an internal isaac_ros_messages module so any changes made in ros_workspace/ won’t be reflected in Isaac Sim.

For using custom messages in the standalone workflow you can follow the tutorial here.

We will look into getting custom messages to work in the extension workflow in the future.

Although this is not officially recommended, for now you could try this workaround of providing the full path to your CustomMsg module.
The snippet below is used to import ContactSensor(from the standalone custom msgs tutorial) in extension:

import sys


from _ContactSensor import ContactSensor

contact_msg = ContactSensor()

Hope this helps!

Hi Ayush_G,Thanks for you reply!
Even if I don’t use CustomMsg, I can’t send ROS messages in Extension.
I created a generic range sensor in the extension workflow. Should I fetch and send data from the generic range sensor in another standalone workflow?
I tried to publish ROS message in Extension Scripting by referring to the documentation.
It works in the Isaac_sim-2021.2.1, but not in Isaac_sim-2022.1.0.
Best wishes!

Hi,I found out why publishing ROS messages doesn’t work.I set msg.header.stamp = self._world.current_time.It works after I change it to msg.header.stamp = rospy.Time().now().
While what is the correct way to set the msg.header.stamp to the simulation time?

I resolved it! I should use rospy.Time.from_sec(self._world.current_time) for transform sec to class 'rospy.rostime.Time' .

I find SimulationContext.current_time inconsistent with ActionGraph/isaac_read_simulation_time.It causes the sensor data time to not always match the TF time. How can I get the ActionGraph/isaac_read_simulation_time in my script?

Hi @1324539608,

You could use og.Controller.get() to retrieve values for any OmniGraph node attribute. Does it work for you if you run the following snippet?

import omni.graph.core as og

simTime = og.Controller.get(og.Controller.attribute("/ActionGraph/isaac_read_simulation_time.outputs:simulationTime"))

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.