livox_ros_driver icon indicating copy to clipboard operation
livox_ros_driver copied to clipboard

Packet time offset calculation is wrong when packet timestamp decreases

Open vvnekb opened this issue 3 years ago • 0 comments

I've encoutered a problem when collecting lidar data in Livox customized data package format (that includes timebase and time offset for each point). Our lidar is Livox MID-100.

The problem is illustrated on the following screenshot:

image

It can be seen clearly that at some moment the point offset jumps more than 4 second forward. Coincidentally, the offset value is very close to maximum value of unsigned 32-bit integer.

It looks like the problem is at this line: https://github.com/Livox-SDK/livox_ros_driver/blob/d05c78483981d49e4f1e509366a583a0a775b53e/livox_ros_driver/livox_ros_driver/lddc.cpp#L430

When we iterate over the packets and the next packet (somehow) have a timestamp that is earlier than the timebase - we get a negative value at this line which is then casted to unsigned int, yielding very large value.

What is the reason for the packet timestamp decrease is a different question. I assume this could be related to time synchronization routine? The decrease is about 7-10 ms in our case, which is quite a lot to be attributed to time drift which was then corrected by PPS, leading to timestamp decrease.

vvnekb avatar Aug 27 '21 10:08 vvnekb