To perform gmapping, we have to execute the following commands.
The following command starts the robot driver in the ChefBot terminal:
$ roslaunch ChefBot_bringup robot_standalone.launch
The following command starts the gmapping process. Note that it should be executed on the ChefBot terminal:
$ roslaunch ChefBot_bringup gmapping_demo.launch
Gmapping will only work if the odometry value that is received is proper. If the odometry value is received from the robot, we will receive the following message for the preceding command. If we get this message, we can confirm that gmapping will work fine:
To start the keyboard teleoperation, use the following command:
$ roslaunch ChefBot_bringup keyboard_teleop.launch
To view the map that is being created, we need to start RViz on the remote system using the following command:
$ roslaunch ChefBot_bringup view_navigation.launch
After viewing the robot in RViz, you can move the robot using the keyboard and see the map being created. When it has mapped the entire area, we can save the map using the following command on the ChefBot PC terminal:
$rosrun map_server map_saver -f ~/test_map
In the preceding code, test_map is the name of the map being stored in the home folder. The following screenshot shows the map of a room created by the robot:
After the map is stored, we can work with the localization and autonomous navigation functionalities using ROS.