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/SMBU-PolarBear-Robotics-Team/small_gicp_relocalization.git
cd ..-
Install dependencies
rosdepc install -r --from-paths src --ignore-src --rosdistro $ROS_DISTRO -y -
Build
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=release
-
Set prior pointcloud file in launch file
-
Adjust the transformation between
base_frameandlidar_frameThe
global_pcd_mapoutput by algorithms such aspointlioandfastliois strictly based on thelidar_odomframe. However, the initial position of the robot is typically defined by thebase_linkframe within theodomcoordinate system. To address this discrepancy, the code listens for the coordinate transformation frombase_frame(velocity_reference_frame) tolidar_frame, allowing theglobal_pcd_mapto be converted into theodomcoordinate system.If not set, empty transformation will be used.
-
Run
ros2 launch small_gicp_relocalization small_gicp_relocalization_launch.py