Install and use homer_navigation package (On Server)
Note
Setting up this package on the server computer is highly recommended for a fluent experience of SLAM and navigation. Setting it up on the RPi should be OK, but the Pi will be struggling.
Install homer_navigation Package
mkdir -p ~/homer_ws/src # create a workspace
cd ~/homer_ws/src # navigate into src/ under the workspace
git clone https://github.com/linzhanguca/homer_navigation.git # download package
cd ~/homer_ws # navigate to workspace root
colcon build # build all packages in workspace
echo "source ~/homer_ws/install/local_setup.bash" >> ~/.bashrc # register package related resources
source ~/.bashrc
Create a Map
-
Set HomeR at a good starting location on the ground.
-
Open a terminal on RPi, launch
homer_interfaceand related resources -
Open a terminal on Server, launch
slam_toolboxunder the "mapping" mode.A Rviz window will be popped out.
-
Open a terminal either on Server or RPi, start
teleop_twist_keyboardto drive the robot around and create the map simultaneously.
Save the Map
- In Rviz, go to "SlamToolboxPlugin" panel, and locate the "Serialize Map" button.
-
Type the absolute path for the map which is intended to be saved in the box next to the "Serialize Map" button.
Info
Use absolute path. For example,
/tmp/test_map. The shortcut,~/, for the home directory will not work. You will need to explicitly express the home directory, for example:/home/<username>/<follow_up_paths>. -
Click "Serialize Map" button, then verify if map files are saved successfully.
Success
Two files will be saved at the location specified in the "SlamToolboxPlugin". One is
<map_name>.data, and the other one is<map_name>.posegraph
Navigation
-
Open localization configuration file
Rebuild the navigation package with the specified map files.$HOME/homer_ws/src/homer_navigation/configs/localization_params.yaml, and editmap_file_namearound line 18. Use the map name you've saved in the previous steps, for example: -
On RPi, launch
homer_interfaceandrplidar_composition -
On Server, launch
slam_toolboxunder the "localization" mode and a collection ofnav2nodes. -
(Optional) If the lidar scan and the map are misaligned, use "2D Pose Estimate" button on the top of the Rviz to set initial pose for HomeR.
-
In Rviz, use "2D Goal Pose" button to set desired ending pose for HomeR.