Localization with a particle filter and a reference map¶
To localize with a particle filter (PF) you will need:
A metric map (the
.mmfile) of the environment. Built as described in: Build a map.To publish that map using mrpt_map_server.
Launch mrpt_pf_localization and configure it to read from wheels odometry (if they exist), the input sensors (e.g. LiDAR), GPS (GNSS) if present. This node will subscribe to the published metric map and use the sensors to publish updates on the robot pose in the map frame.
Note
Do NOT set the raw LiDAR pointcloud as input for the PF. It is just too large and it must be subsampled first. We can use mrpt_pointcloud_pipeline for such task, as can be seen in the tutorial below.
Tutorial¶
A complete demonstration has been put together on: https://github.com/MOLAorg/mola_warehouse_pf_tutorial
Key points of this tutorial:
The ROS 2 launch file.
A custom sm2mm pipeline file to create a reference point cloud map sparse enough so localizing with a PF is not too slow.
A pipeline for mrpt_pointcloud_pipeline to decimate the input raw 3D scan as input to the PF.
How to run the tutorial
Clone the tutorial package (which already includes a prebuilt .mm), make sure of having all dependencies,
build and run it:
cd ~/ros2_ws/src
git clone https://github.com/MOLAorg/mola_warehouse_pf_tutorial.git
cd ~/ros2_ws
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo
. install/setup.bash
ros2 launch mola_warehouse_pf_tutorial tutorial_launch.py