tier4 / ros2_v4l2_camera

Forked from https://gitlab.com/boldhearts/ros2_v4l2_camera
Apache License 2.0
40 stars 16 forks source link

Problems with timestamps #18

Open zymouse opened 5 months ago

zymouse commented 5 months ago

I'm testing on orin, can you tell me why?

cat: /sys/devices/system/clocksource/clocksource0/offset_ns: No such file or directory

Thank you very much 🙏

knzo25 commented 5 months ago

@manato do you have any idea?

zymouse commented 5 months ago

I'm very sorry that I didn't describe it well.

Problem Description:

When I use use_v4l2_buffer_timestamps_=true, the fetched buf_stamp time timestamp and the system timestamp (CLOCK_REALTIME) always differ by a fixed value.

image

I suspect it's because I can't find this file(/sys/devices/system/clocksource/clocksource0/offset_ns)

image

My purpose.

I'm doing camera time synchronization and triggering, and I feel like it would make more sense to use use_v4l2_buffer_timestamps_=true for timestamps!

zymouse commented 5 months ago

How do the camera and LIDAR collect data at the same time after time synchronization? The camera can send one frame of PPS signal and acquire one frame of image. Use this to synchronize multiple cameras. What method do you guys use to make the camera and lidar synchronized for acquisition.

image What does buf.timestamp have to do with the timestamp when the camera captures a frame? I'm not sure how the buf.timestamp timestamp relates to the exposure timestamp of the camera.?

image

Very much looking forward to your reply, it will help me a lot. These questions have been bothering me for a long time

manato commented 5 months ago

@knzo25 Thank you for reminding me.

@zymouse Regarding /sys/devices/system/clocksource/clocksource0/offset_ns, it looks to depend on the jetpack version because some orin-based ECUs of our side have the file but some don't. The content of the file is used to correct timestamp values based on v4l2-buffer time into the system clock time. This is the first time that we meet the issue, so we don't have concrete solutions so far (we appreciate your sharing the issue). If you have a fixed value of the difference between v4l2 and system timestamp and would like to set v4l2 timestamp to the same scale of the system time, using timestamp_offset parameter would be a temporal solution.

In terms of synchronization, we often use LiDARs which support PTP synchronization. Once LiDARs synchronize to the ECU and are configured properly, we can calculate when the LiDARs scan the camera direction. By sending shutter trigger signals based on the calculation result, LiDARs and cameras scan the same field temporarily.