HesaiTechnology / HesaiLidar_ROS_2.0

33 stars 39 forks source link

XT32M2X, timestamp is 1589945405.xxxxxxxx . is there any problem? Thanks #1

Open zhuYL8842 opened 11 months ago

zhuYL8842 commented 11 months ago

Hi, Lidar is XT32M2X, the msg timestamp is 1589945405.xxxxxxxx, which convert to real time is 2020-5-20. If i want to use system time, is there anywhere to set the timestamp in code or lidar setting? Thanks.

EduJorquera commented 10 months ago

@zhuYL8842 I'm having the same issue. DId you find any solution?

911527016 commented 9 months ago

没找到具体的解决方法所以我尝试手动修改源码,将每个点的timestamp改为当前系统时间 修改文件 HesaiLidar_ROS_2.0/src/manager/source_driver_ros2.hpp 头文件加一个 #include <rclcpp/clock.hpp> 在218行加入 rclcpp::Clock clock(RCL_ROS_TIME); rclcpp::Time current_time = clock.now(); ros_msg.header.stamp = current_time; int64_t nanoseconds = current_time.nanoseconds(); double timestamp_seconds = static_cast(nanoseconds) * 1e-9; 然后在下面的for循环中插入 frame.points[i].timestamp=timestamp_seconds; 将每个点的timstamp修改为系统时间 再次编译运行就能得到正确的时间戳了 20231221001348

IfReturn commented 6 months ago

雷达时间硬同步没生效,本地部署个ptp服务器就行

saurabh1002 commented 3 months ago

The solution by @911527016 solves the issue. There is just one extra change to make it compile. Can find the complete diff in #8