Skip to content

Mapping and Exploration

Emiliano Borghi edited this page Apr 3, 2021 · 12 revisions

The following page covers how to run mapping algorithms with both the simulator (Gazebo) and the real robot:

Exploration packages:


hector_slam + map_server

Gazebo

export LOCALIZATION=hector_mapping
export RVIZ=true
export LASER=rplidar
roslaunch ca_gazebo create_house.launch

On another console, move the robot around:

roslaunch ca_tools keyboard_teleop.launch

Map the environment and when finished, save the map:

rosrun map_server map_saver -f <NAME_OF_THE_ENVIRONMENT>

Real robot

# TODO

hector_slam + geotiff

Gazebo

export LOCALIZATION=hector_geotiff
export RVIZ=true
export LASER=rplidar
roslaunch ca_gazebo create_house.launch

On another console, move the robot around:

roslaunch ca_tools keyboard_teleop.launch

Map the environment and when finished, save the map:

roslaunch ca_hector geotiff_map_saver.launch

This will store it under ca_hector/maps with the name _ts.tif and _ts.tfw, where is the name of the mapped environment.

Real robot

# TODO

Octomap is a 3D mapping technique using Octrees:

Hornung, A., Wurm, K.M., Bennewitz, M. et al. OctoMap: an efficient probabilistic 3D mapping framework based on octrees. Auton Robot 34, 189–206 (2013). https://doi.org/10.1007/s10514-012-9321-0

Gazebo

# Select a local planner (optional)
export LOCAL_PLANNER=trajectory_rollout
# Open RViz
export RVIZ=true 
# Octomap mapping is enabled with "octomap" keyword
export LOCALIZATION=octomap
# A 3D camera MUST be selected
export LASER=d435
# Launch an environment in Gazebo
roslaunch ca_gazebo create_sweet_house_5.launch

Real robot

# TODO

Gazebo

# Select method
export LOCALIZATION=rtab
# Select a 3D camera
export LASER=d435
# Open RViz
export RVIZ=true
# Open simulator with RViz
roslaunch ca_gazebo create_sweet_house_5.launch

Real robot

# Select method
export LOCALIZATION=rtab
# Select a 3D camera
export LASER=d435
# Open RViz
export RVIZ=true
# Bring up robot with RViz
roslaunch ca_bringup complete.launch

In order to create a map, you'll need to setup slam_gmapping in the robot. The description for that is described here.

For controlling the robot during the mapping process is recommended to move the robot with any of these methods:

# Use the keyboard
roslaunch ca_tools keyboard_teleop.launch
# Use the joystick
roslaunch ca_tools joy_teleop.launch

After creating a map, you can generate the PGM and YAML files with map_server:

rosrun map_server map_saver -f my_map

To automatically build a map, you can send the robot to explore the environment. This can be done with explore_lite which is a greedy frontier-based exploration package.

Launch the robot in a cave with a mapping/SLAM algorithm:

export LOCALIZATION=hector_mapping
export RVIZ=true
export LASER=rplidar
roslaunch ca_gazebo create_cave.launch

Then, run the exploration node:

roslaunch ca_mapping_exploration explore_lite.launch

Note: Cartographer doesn't work with exploration because how it represents the map.