Mapping in simulated environment

Before going in the real world, many tasks are first done in a simulation to prevent unwanted damage to the robot and it’s surroundings. In this section, we will use different ROS packages to map a simulated environment.

Launching the simulation

In separate terminals, run:

  1. roslaunch robotont_description gazebo_teleop_keyboard.launch world:=$(rospack find turtlebot3_gazebo)/worlds/turtlebot3_world.world
    

    This will launch the simulation environment. Also, from this terminal, you can use keyboard teleop.

  2. roslaunch robotont_description display_2dmapping.launch
    

    This will launch RViz, that shows the generated map.

gmapping

gmapping is a popular 2D SLAM software in ROS. It uses laserscans to build a 2D map.

rosrun gmapping slam_gmapping

This will launch the gmapping mapping software.

Drive around, using your keyboard, and map the world.

To configure gmapping, refer to http://wiki.ros.org/gmapping .

To use your own parameters, add them to rosrun command like this:

rosrun gmapping slam_gmapping _map_update_interval:=1.0

Notice the underscore before the parameter. This example will change map update interval to 1 second (default is 5 seconds).

Google Cartographer

Kill the gmapping process.

Google Cartographer also uses odometry data.

  1. Find out what topic has odometry data, using ROS tools e.g. rostopic list, rostopic echo etc.

  2. If you have determined the correct topic, launch

    roslaunch robotont_teleop teleop_sim_cartographer_2d.launch odom_topic:=<YOUR ODOMETRY TOPIC>
    
  3. Try mapping.