Skip to content

publish poses at the end of scan#66

Closed
koide3 wants to merge 2 commits intomasterfrom
scanend
Closed

publish poses at the end of scan#66
koide3 wants to merge 2 commits intomasterfrom
scanend

Conversation

@koide3
Copy link
Copy Markdown
Owner

@koide3 koide3 commented Feb 14, 2026

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds dedicated ROS2 topics to publish the estimated IMU pose/odometry at the end of a LiDAR scan, in addition to the existing per-frame pose/odom publications, to improve RViz visualization and downstream consumers that need scan-end timing.

Changes:

  • Add new publishers for scan-end odometry/pose, with both uncorrected and corrected variants.
  • Compute scan-end relative motion from imu_rate_trajectory and publish /odom_scanend* and /pose_scanend* messages using the scan-end timestamp.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/glim_ros/rviz_viewer.cpp Adds scan-end time/transform computation and publishes new scan-end odom/pose topics.
include/glim_ros/rviz_viewer.hpp Declares the new scan-end publishers (regular + corrected).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +247 to +248
if (std::abs(imu_end_time - new_frame->stamp) < 1e-3) {
logger->warn("Scan end time is too close to the frame time (imu_end_time={}, frame_time={})", imu_end_time, new_frame->stamp);
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

The scan-end warning condition looks backwards/noisy: std::abs(imu_end_time - new_frame->stamp) < 1e-3 will be true whenever imu_rate_trajectory is empty (or has a single sample), causing a WARN every frame while still publishing a scan-end pose identical to the frame pose. Consider warning only when imu_rate_trajectory is missing (or when the time delta is unexpectedly large), and/or downgrade to DEBUG/throttle so normal operation doesn’t spam logs.

Suggested change
if (std::abs(imu_end_time - new_frame->stamp) < 1e-3) {
logger->warn("Scan end time is too close to the frame time (imu_end_time={}, frame_time={})", imu_end_time, new_frame->stamp);
if (std::abs(imu_end_time - new_frame->stamp) > 1e-3) {
logger->warn("Scan end time differs significantly from the frame time (imu_end_time={}, frame_time={})", imu_end_time, new_frame->stamp);

Copilot uses AI. Check for mistakes.
Comment on lines +247 to +248
if (std::abs(imu_end_time - new_frame->stamp) < 1e-3) {
logger->warn("Scan end time is too close to the frame time (imu_end_time={}, frame_time={})", imu_end_time, new_frame->stamp);
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

std::abs is used here for doubles, but this file doesn’t include <cmath>. Relying on transitive includes can break builds depending on compiler/standard library; please include <cmath> explicitly (or switch to std::fabs).

Copilot uses AI. Check for mistakes.

odom_scan_end_pub->publish(odom);

logger->debug("published odom (stamp={})", new_frame->stamp);
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

The debug log after publishing scan-end odometry logs new_frame->stamp and uses the same message as the regular odom publisher. This is misleading because the published message is timestamped with imu_end_stamp; consider logging imu_end_time (and differentiating it as scan-end odom) so users can diagnose timing correctly.

Suggested change
logger->debug("published odom (stamp={})", new_frame->stamp);
logger->debug("published scan-end odom (imu_end_time={}, stamp={})", imu_end_time, imu_end_stamp);

Copilot uses AI. Check for mistakes.
Comment thread src/glim_ros/rviz_viewer.cpp Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@koide3 koide3 closed this Feb 28, 2026
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.

2 participants