images published out of order
Closed this issue · 3 comments
MFernandezCarmona commented
Hi,
I'm using usb_cam_node_exe
node in Humble and image_raw
messages are being published out of (temporal) order.
Steps to reproduce:
-
Plug usb camera (tried two different ones)
-
Run
usb_cam_node_exe
node
ros2 run usb_cam usb_cam_node_exe --ros-args -r __ns:=/camera
3.Create a simple python node to check image timestamps:
import rclpy
from rclpy.node import Node
from sensor_msgs.msg import Image
from rclpy.time import Time
class ImageTimestampSubscriber(Node):
def __init__(self):
super().__init__('image_timestamp_subscriber')
self.subscription = self.create_subscription(
Image,
'/camera/image_raw',
self.image_callback,
10
)
def image_callback(self, msg):
if hasattr(self,'last_time'):
time_diff = Time.from_msg(msg.header.stamp) - self.last_time
if time_diff.nanoseconds<0.0:
self.get_logger().info(f" image ts dif: {time_diff.nanoseconds/1e6} ms")
self.last_time = Time.from_msg(msg.header.stamp)
def main(args=None):
rclpy.init(args=args)
node = ImageTimestampSubscriber()
rclpy.spin(node)
node.destroy_node()
rclpy.shutdown()
if __name__ == '__main__':
main()
4.Python script output shows that some messages are not in order:
[INFO] [1688644345.950392161] [image_timestamp_subscriber]: image ts dif: -964.004 ms
[INFO] [1688644346.950561701] [image_timestamp_subscriber]: image ts dif: -967.999 ms
[INFO] [1688644347.958506978] [image_timestamp_subscriber]: image ts dif: -967.996 ms
[INFO] [1688644348.930496476] [image_timestamp_subscriber]: image ts dif: -964.003 ms
[INFO] [1688644349.938465496] [image_timestamp_subscriber]: image ts dif: -967.999 ms
[INFO] [1688644350.942504378] [image_timestamp_subscriber]: image ts dif: -968.0 ms
[INFO] [1688644351.950476913] [image_timestamp_subscriber]: image ts dif: -967.996 ms
[INFO] [1688644352.958440612] [image_timestamp_subscriber]: image ts dif: -964.004 ms
Any ideas on what might be wrong?
Thanks
MFernandezCarmona commented
Wrong package! My apologies
klintan commented
I was about to say, I have never seen this. But to be honest I haven't tested out the timestamp on the published images in this package either. If you see any other problems with the package let me know :)
MFernandezCarmona commented
Actually, I'll try to reproduce the bug with your package, it could tell us where the problem is.
Cheers