First, make sure the Oculusprime Server Application is running on the robot (if it isn’t already), with telnet enabled, and make sure you have ROS networking set up.
Position the robot in the pose (location, direction) that you want to represent the point 0,0 on the map (docked in the charging station is the recommended location). Then,
ssh into the robot and enter:
roslaunch oculusprime make_map.launch
Now, to monitor the map building progress on your workstation, enter:
rosrun rviz rviz -d `rospack find oculusprime`/gmapping.rviz
Now, also on the workstation, open a browser window and connect to the robot.
Drive around the area you want to map. You’ll notice driving is a bit different than usual: the robot forces full stops between direction changes (this is required for accurate odometry when using skid steering).
While driving, watch the map building progress in the Rviz window.
Map Making Driving Tips:
- Start by driving around the perimeter of the first room the robot is in, at least 3 laps in the same direction
- Then branch out into other areas and do a few laps there, then come back to the original area
- It helps to keep distinguishing features such as corners within view as much as possible (imagining a horizontal scan as seen from top view)
- Once you’ve driven in one direction a few times around the perimeter of an area, turn around and go in the opposite direction to fill in the missing scans
When you’re satisfied with the level of map detail, you can save the map.
Leave the ‘
make_map.launch’ process running. In a separate robot terminal window, enter:
rosrun map_server map_saver
This will save the map as ‘
map.pgm’ and ‘
map.yaml’ in the current directory. Move them into the maps folder so the navigation launch file can find them:
mv map.pgm maps/
mv map.yaml maps/
Now you can terminate all processes; your map is ready to test out with the navigation stack. The resulting
.pgm file is a standard bitmap; you might find you need to use a bitmap editor to add black pixels in certain areas to improve navigation.
NEXT: Tutorial: Drive Using Teleop-Twist-Keyboard