Issue with message timestamps [ROS1 noetic]
Hello dear forum users,
I subscribe to three sensors (2x Camera 30 Hz, 1x LiDAR 10 Hz) and use ApproximateTimeSynchronizer with a slop of 0.025 to synchronize them. The images are processed (at about 100FPS) and published as a new topic. Before publishing this topic, I manually set the header timestamp to the same timestep of the incoming message, for post processing purposes.
This should mean, that evaluation of the saved ROSbags contains the timestamps of incoming messages. The maximum deviation (30Hz - 10Hz) should be 0,0667s. The actual maximum deviation between the ROS timestamps of a camera and the LiDAR is 0.01 seconds, which seems very low. However practically, at the speed the setup is moving, I should only see a mismatch of about 2.7 cm, but I get about 8 cm. This indicates that the delay is far greater than the timestamps of the ROSmessages indicate.
I have a few questions:
- Does ROS stamp the messages when incoming (so its not the actual stamp from the sensor)?
- Does the ApproximateTimeSynchronizer change the message timestamps at all?
- Does the publisher timestamp affect the Synchronizer?
- Is there any possibility of reducing the latency between sensors using ROS, e.g. Clock synchronization?
- Does the Queue size on the Subscriber have any effect?
I am grateful for any help. Best Regards, L
__EXAMPLE CODE__
sub1 = message_filters.Subscriber(image_color, Image)
sub2 = message_filters.Subscriber(image_color, ImageB)
sub3 = message_filters.Subscriber(image_color, Lidar)
output = rospy.Publisher("output_topic", Image,
queue_size = 60)
ats = message_filters.ApproximateTimeSynchronizer([sub1, sub2, sub3], queue_size=300, slop=0.025)
ats.registerCallback(run,
output) rospy.spin()
def run(*args):
timestamp = sub.header.stamp
... Processing
output.header.stamp = timestamp
output.publish(processed_image)