Make ROS1CameraHelper publish headers with system time and not simulation time

Hello, the ROS1CameraHelper publishes messages with a header that contains the current time, the problem is this time is simulation time and not system time. How do I change it.

Thanks!

What ROS1CameraHelper are you referring to?

The ROS1CameraHelper node in the action graph as shown in the image below

Moving this question to Isaac Sim.

Hi @montanacaleb - The timestamp in the header of the ROS messages is typically set to the current simulation time in many robotics simulation environments. This is because the simulation might not run in real-time, so using the system time could lead to inconsistencies between the simulation and the ROS messages.

If you want to change the timestamp to the system time, you would need to modify the code of the ROS1CameraHelper class (or whichever class is responsible for publishing the ROS messages).

Here’s a general idea of how you might do it:

  1. Find the part of the code where the ROS message is created and the timestamp is set. This might look something like this:
msg.header.stamp = rospy.Time.now()
  1. Replace rospy.Time.now() with a call to get the current system time. This might look something like this:
msg.header.stamp = rospy.Time.from_sec(time.time())

In this line, time.time() returns the current system time in seconds since the epoch (January 1, 1970), and rospy.Time.from_sec() converts this to a rospy.Time object.

Please note that this is a general suggestion and the actual code might look different depending on how the ROS1CameraHelper class is implemented.

1 Like

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