-
-
Notifications
You must be signed in to change notification settings - Fork 38
Mapping and Exploration
The following page covers how to run mapping algorithms with both the simulator (Gazebo) and the real robot:
Note: Multiple robots are not supported yet.
# Run cartographer in mapping mode
export LOCALIZATION=cartographer
# If you want to see RViz, there is a launch file with a predefined setting
export RVIZ_CONFIG=cartographer
# Select sensor type
export LASER=rplidar
# Run gazebo in any environment (like a House)
roslaunch ca_gazebo create_house.launch
# Move around the robot using keyboard teleop
roslaunch ca_tools keyboard_teleop.launch
# Try to close loops with the robot's trajectory
# Once you are satisfied with the map, create the pbstream calling the proper service
rosservice call /write_state "filename: '<NAME>.pbstream'"
# Set the robot unique identifier
export ID=1
# Run cartographer in mapping mode
export LOCALIZATION=cartographer
# Select sensor type
export LASER=astra
# Run the real robot with the whole navigation stack
roslaunch ca_bringup complete.launch
# Debugging
export RVIZ_CONFIG=cartographer
roslaunch ca_tools rviz.launch
# Move around the robot using keyboard teleop
roslaunch ca_tools keyboard_teleop.launch
# Try to close loops with the robot's trajectory
# Once you are satisfied with the map, create the pbstream calling the proper service
rosservice call /write_state "filename: '<NAME>.pbstream'"
Put the map (.pbstream
file) into navigation/ca_cartographer/pbstream
sharing the name with the world file.
If you go and come again to the same start place cartographer
will be able to define a loop closure.
Enabling ceres
(scan matching) improves the map quality.
With slam_gmapping
, after having mapped the environment, you generate a PGM calling a rosservice, in the case of cartographer
the service generates a pbstream. If you want the PGM to use it with, for example, map_server
+ amcl
you can call:
cartographer_pbstream_to_ros_map -pbstream_filename <PbstreamFullPath>
and it will generate a PGM.
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>
# TODO
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.
# TODO
Octomap is a 3D mapping technique using Octrees.
# Select a local planner (optional)
export LOCAL_PLANNER=trajectory_rollout
# Specify the RViz configuration file
export RVIZ_CONFIG=octomap
# Octomap mapping is enabled with "octomap" keyword
export LOCALIZATION=octomap
# A 3D camera must be selected
export LASER=astra
# Launch an environment in Gazebo
roslaunch ca_gazebo create_sweet_house_3.launch
# TODO
# Select method
export LOCALIZATION=rtab
# Select a 3D camera
export LASER=d435
# Open simulator with RViz
RVIZ=true roslaunch ca_gazebo create_sweet_house_5.launch
# Select method
export LOCALIZATION=rtab
# Select a 3D camera
export LASER=d435
# Bring up robot with RViz
RVIZ=true 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 the explore_lite
package.
roslaunch ca_mapping_exploration explore_lite.launch