-
Notifications
You must be signed in to change notification settings - Fork 598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect timestamp #75
Comments
The timestamp is assigned right after grabbing the frame:
https://github.com/ros-drivers/usb_cam/blob/develop/src/usb_cam.cpp#L1087 Instead it probably should be done right after the I wonder what is happening on the other side of that |
I haven't duplicated your webcam setup but all I could account for when moving the timestamping to immediately after the select was about 5-15ms depending on the resolution of the image. |
The v4l2_buffer which exists for My buf.flags is 0x12003 which means |
Try out my lucasw/usb_cam timestamp branch and see if that fixes the issue. I observed an average 60 ms difference between the time select() returned and the timestamp inside the v4l2_buffer for a 640x480 image, that sounds very close to the time differences you are seeing. |
I tried out the webcam recording the current ros time on a terminal method and I'm seeing time stamp differences like
Without knowing the exposure time it could be rolling shutter that is responsible for time difference between the top and bottom of the frame, the above was captured at the bottom of the frame. |
Thank you so much for your help! I ran the same experiment with the exact same setup on your branch and the offset is indeed much smaller (around 30ms to be more specific). |
@flajolet we've included this update into the new if you have time do you think you could take a look at the new changes and see if you are still seeing the time offset? would be great to look at some data on the delay we are seeing with the current code. |
Closing as resolved |
Hi!
I ran a simple experiment to evaluate the accuracy of the timestamps issued by usb_cam when publishing the images. It seems that the timestamps are not necessarily very accurate. Does anybody know how to fix this?
SETUP:
I have a node publishing to a topic the current rostime which is then printed to the screen with rostopic echo. My usb camera is facing the screen and I use usb_cam to stream the images. The raw (compressed) images are written to a file with rosbag. The point of the setup is to compare the timestamp that can be seen on the image (acquisition time) with the timestamp of the corresponding image message when replaying the rosbag. The parameters input into usb_cam (width=1280, height=1024, fps=30, and pixel_format="mjpeg") are consistent with what is prescribed by v4l2-ctl --list-formats-ext.
RESULT:
There is systematically a significant offset (around 0.15s for this setup) between the timestamp and the actual time acquisition time as can be seen below. This offset varies as function of the resolution of the image and the selected fps.
The text was updated successfully, but these errors were encountered: