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

Fix timestamp: subtract packet time instead of full scan time #125

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MichaelGrupp
Copy link
Contributor

The previous timestamp patch in PR #104 subtracted the full scan time from the last point time of the first packet to determine the scan timestamp.

It has to be the time for a single packet instead. Otherwise, the timestamp is too far in the past.

This is especially noticeable when the scan frequency is in a lower range like 10Hz, i.e. the scan timestamp would be 100ms off compared to other sensor modalities.

The previous timestamp patch in PR PepperlFuchs#104 subtracted the full scan time
from the last point time of the _first_ packet to determine the scan
timestamp.

It has to be the time for a single packet instead. Otherwise, the
timestamp is too far in the past.

This is especially noticeable when the scan frequency is in a lower
range like 10Hz, i.e. the scan timestamp would be 100ms off compared to
other sensor modalities.
@@ -68,11 +68,16 @@ void PFDataPublisher::to_msg_queue(T& packet, uint16_t layer_idx, int layer_incl
msg->header.frame_id.assign(frame_id_);
msg->header.seq = packet.header.header.scan_number;
msg->scan_time = static_cast<float>(scan_time.toSec());
msg->header.stamp = packet.last_acquired_point_stamp - scan_time;
msg->angle_increment = packet.header.angular_increment / 10000.0 * (M_PI / 180.0);

{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

off-topic: why is this part in its own scope?

MichaelGrupp added a commit to magazino/pf_lidar_ros_driver that referenced this pull request May 22, 2024
This is almost the same as the patch for master, but the timestamping
has changed between these versions (and both are wrong).

Patch for master: PepperlFuchs#125
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

Successfully merging this pull request may close these issues.

1 participant