Skip to content

[Fixes #65] Transform input point cloud to base_frame to support tilted LiDAR#66

Merged
rsasaki0109 merged 8 commits intorsasaki0109:mainfrom
abudori3939:main
Jul 16, 2025
Merged

[Fixes #65] Transform input point cloud to base_frame to support tilted LiDAR#66
rsasaki0109 merged 8 commits intorsasaki0109:mainfrom
abudori3939:main

Conversation

@abudori3939
Copy link
Contributor

Overview

This pull request resolves the issue reported in #65, where using a physically tilted LiDAR resulted in an incorrect pose estimate. The root cause was that the input point cloud was passed to the registration algorithm before being transformed into the robot's base frame.

Implementation Details

This PR introduces a new preprocessing step in the cloudReceived function:

  1. It checks if the header.frame_id of the incoming PointCloud2 message is different from the base_frame_id specified in the parameters.
  2. If they are different, it uses tfbuffer_.lookupTransform to get the transform to the base_frame_id.
  3. The transform is converted into an Eigen 4x4 matrix.
  4. pcl::transformPointCloud is used to transform the entire point cloud into the base_frame_id coordinate system.
  5. This newly transformed point cloud is then used for the subsequent registration (NDT/GICP) process.

This change ensures that localization is always performed consistently relative to the robot's base frame, regardless of the LiDAR's mounting orientation.

Verification

With this fix, I have verified the following:

  1. The ground plane is now correctly represented as level in the map frame, even when using a tilted LiDAR.
  2. As a result of the level representation, obstacles detected by the LiDAR are now reflected with the correct scale in 2D maps.
  3. The TF tree is now correctly constructed, reflecting the proper robot configuration.

@rsasaki0109 rsasaki0109 self-requested a review July 15, 2025 09:08
@rsasaki0109 rsasaki0109 self-assigned this Jul 15, 2025
@rsasaki0109 rsasaki0109 merged commit fb92574 into rsasaki0109:main Jul 16, 2025
2 checks passed
@rsasaki0109
Copy link
Owner

Thanks for the fix! The implementation looks good. LGTM, merged.

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