RoPod/Tutorials/Gmapping
Typically, to define the static part of the environment, you can either draw the entire map yourself (for example using a program like gimp), or you can measure the environment using some SLAM (simultaneous localization and mapping) algorithm is used. For now, gmapping is used in the ropod-project. This algorithm uses the data taken from the laser range finder combined with the odometry-data to create the map. For this purpose, a launch-file is setup which you can use. Take the following steps the create this map:
- log in to the robot using sshpico (ensure you are connected to the AtHome-network) and connect to the sensors:
sshpico pstart
- Run the gmapping algorithm by logging in to the robot in a new terminal:
sshpico roslaunch pico_bringup gmapping.launch
If it is desired to change the parameters, do it in the launch file. This file can be found at ~/catkin_workspace/pico_bringup/launch/gmapping.launch
- Now, drive around with the robot, for example using the teleop:
sshpico teleop pico
The screen indicates which buttons to use. If you want to visualize the process on your own laptop, read the robot-topics(pico-core), open rviz(rosrun rviz rviz) and subscribe to the /map-topic.
- Satisfied with the map you created? Then you need to save it. Ensure, the gmapping-node is still running!
sshpico rosrun map_server map_saver -f /tmp/my_map
Now, a file called "my_map.pgm" is saved in the /tmp-folder of pico, combined with a file called my_map.yaml. The pgm-file is a drawing of the map, while some parameters are stored in the yaml-file. Move these files to a place where you want to store them!
- As typically ghost-points are present in the map created or the map is not entirely correct (try to run through you environment twice), you need to modify the image yourself. Again, gimp can be very useful for that purpose.
- When finished, you can store the model in the object-models library (not created yet!). An example of the yaml-file corresponding the image given in the shape-folder is given below:
type: walls shape: path: shape/heightmap.pgm blockheight: 1.0 resolution: 0.025000 origin_x: -12.20000 origin_y: -15.00000 origin_z: 0.000000