SICKAG / sick_scan_xd

Based on the sick_scan drivers for ROS1, sick_scan_xd merges sick_scan, sick_scan2 and sick_scan_base repositories. The driver supports both Linux (native, ROS1, ROS2) and Windows (native and ROS2).
Apache License 2.0
105 stars 86 forks source link

about timestamp #120

Closed dlutjwh closed 2 years ago

dlutjwh commented 2 years ago

thanks for your apply for anwser for https://github.com/SICKAG/sick_scan_xd/issues/119#issue-1412769021, but i'm still confued for the code: 2022-10-19 10-46-10 的屏幕截图

the code set the timestamp after accept the datagram, so why the time is not the timestamp of the last point ,since the timestamp of the last point is laster than the first point。(ROS2.0,Tim5XX ) By the way,what is the param use_generation_timestamp used for, does it effect the timestamp of /sensor_msgs/laser_scan? thanks sincerely.

michael1309 commented 2 years ago

The information you are looking for can be found in the following explanation:

In a nutshell: The lidars do not work with absolute time stamps but with "ticks". There are two types of tick timestamps:

With the help of this straight line equation, one can now calculate the system time at which the data is generated in the lidar.

Summary:

  1. lidar: stamp with ticks the generation (first shot in the scan) (TICK_GEN)
  2. lidar: stamp with ticks the sending of the scan message (TICK_TRANSMIT)
  3. PC: Stamp with system time the receiving of the message
  4. PC: Calculate back to system time of generation: System time of generation = System time of receiving - (TICK_TRANSMIT - TICK_GEN)/TICK_FREQUENCY