A simple example: Implementing point cloud alignment and localization using small_gicp
Given a registered pointcloud (based on the odom frame) and prior pointcloud (mapped using pointlio or similar tools), the node will calculate the transformation between the two point clouds and publish the correction from the map
frame to the odom
frame.
- ROS2 Humble
- small_gicp
- pcl
- OpenMP
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone https://github.com/LihanChen2004/small_gicp_relocalization.git
cd ..
-
Install dependencies
rosdepc install -r --from-paths src --ignore-src --rosdistro $ROS_DISTRO -y
-
Build
colcon build --symlink-install -DCMAKE_BUILD_TYPE=release
-
Set prior pointcloud file in launch file
-
Adjust the transformation between
base_frame
andlidar_frame
The
global_pcd_map
output by algorithms such aspointlio
andfastlio
is strictly based on thelidar_odom
frame. However, the initial position of the robot is typically defined by thebase_link
frame within theodom
coordinate system. To address this discrepancy, the code listens for the coordinate transformation frombase_frame
(velocity_reference_frame) tolidar_frame
, allowing theglobal_pcd_map
to be converted into theodom
coordinate system.If not set, empty transformation will be used.
-
Run
ros2 launch small_gicp_relocalization small_gicp_relocalization_launch.py