Skip to content
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

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

Open
zhuYL8842 opened this issue Nov 3, 2023 · 4 comments

Comments

@zhuYL8842
Copy link

zhuYL8842 commented Nov 3, 2023

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.

@zhuYL8842 zhuYL8842 changed the title timestamp XT32M2X, timestamp is 1589945405.xxxxxxxx . is there any problem? Thanks Nov 3, 2023
@EduJorquera
Copy link

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

@911527016
Copy link

没找到具体的解决方法所以我尝试手动修改源码,将每个点的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
Copy link

IfReturn commented Mar 29, 2024

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

@saurabh1002
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants