In this tutorial, you will learn how to build a 2D map of an environment using the GMapping SLAM algorithm in ROS1. This process is fundamental for autonomous navigation as it allows the robot to understand and represent its surroundings.
Launch the SLAM node with the following command:
rosrun gmapping slam_gmapping scan:=/scan
To generate a meaningful map, the robot needs to explore the environment. You can use keyboard teleoperation with:
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
Once the robot has sufficiently explored the environment and a good map has been built, save it to your filesystem using:
rosrun map_server map_saver -f ~/gmapping_map
– The map is empty:
check if the LIDAR is publishing correctly and the topic is set properly.
– The map is not accurate:
move the robot slowly and ensure it explores all areas.
– The robot doesn’t move:
verify that teleop commands are sent to the right topic.