9、RTAB-Map 3D mapping navigation
9、RTAB-Map 3D mapping navigation
9.1、Introduction
9.2、Navigation
9.3、Navigation obstacle avoidance
9.4、Node rtabmap
9.4.1、Subscribed Topics
9.4.2、Published Topics
9.4.3、Services
9.4.4、Parameters
9.4.5、tf transform
9.5、Node rtabmapviz
9.5.1、Subscribed Topics
9.5.2、Parameters
9.5.3、Required tf Transforms
wiki:http://wiki.ros.org/rtabmap_ros
9.1、Introduction
This software package is the ROS function package of RTAB Map, which is an RGB-D SLAM method
based on a global loop closure detector with real-time constraints. The software package can be
used to generate a three-dimensional point cloud of the environment and create a two-
dimensional occupancy grid map for navigation.
Start the command of the bottom layer, map building or navigation
roslaunch transbot_nav transbot_bringup.launch # Astra + laser + Transbot
roslaunch transbot_nav astra_bringup.launch # Astra + Transbot
roslaunch transbot_nav transbot_rtabmap.launch open_rviz:=False # mapping
roslaunch transbot_nav transbot_rtabmap_nav.launch open_rviz:=False # navigation
Note: Astra + laser + Transbot is the fusion of depth camera and lidar; Astra + Transbot refers to
pure vision, mainly using the function package depthimage_to_laserscan to convert the depth
image into lidar data (the scanning range is different from lidar), and its mapping function Same
as lidar.
Start visualization
roslaunch transbot_nav view_rtabmap.launch # mapping visualization
roslaunch transbot_nav view_rtabmap_nav.launch # navigation visualization
View tf tree
rosrun rqt_tf_tree rqt_tf_tree
Viewn node
rqt_graph
Keyboard control node
rosrun teleop_twist_keyboard teleop_twist_keyboard.py # system integration
9.2、Navigation
After starting up according to the above method, you can choose any method to control the map
creation (handle control is recommended); the slower the map creation, the better the effect
(especially the angular speed); the robot is full of the area to be created.
Handle control
Keyboard control
When the map is completed, directly ctrl+c to exit the map node, the system will automatically
save the map.
The default save path of the map is [~/.ros/rtabmap.db].
9.3、Navigation obstacle avoidance
Note: [R2] on the handle can cancel the target point.
When the navigation mode is turned on, the system automatically loads a 2D raster map, and
cannot directly load a 3D map. It needs to be loaded manually.
Load the 3D map (1, 2, 3), 4 is to add the rviz debugging tool.
Steps for usage
Place the robot at the origin and start the navigation function, the system will automatically
match the position of the robot.
Single-point navigation:
Click the 【2D Nav Goal】 of the 【rviz】tool. Then use the mouse to select a target point on
the map model where there are no obstacles. Release the mouse to start the navigation.
Only one target point can be selected. Finally, robot car will move towards the target point
form, after reaching the target point, the car will stop.
Multi-point navigation:
Click 【Publish Point】of the 【rviz】tool. Then select a target point where there are no
obstacles on the map model, release the mouse to start navigation. You can click 【Publish
Point】again, then select others point. Finally, robot car will cruise from point to point.
9.4、Node rtabmap
9.4.1、Subscribed Topics
Name Type Analyze
Odometry stream. Required if
parameters subscribe_depth or
odom nav_msgs/Odometry
subscribe_stereo are true and
odom_frame_id is not set.
rgb/image sensor_msgs/Image RGB/Mono image
rgb/camera_info sensor_msgs/CameraInfo RGB camera metadata.
depth/image sensor_msgs/Image Registered depth image.
scan sensor_msgs/LaserScan Laser scan stream.
scan_cloud sensor_msgs/PointCloud2 Laser scan point cloud stream.
left/image_rect sensor_msgs/Image Left RGB/Mono rectified image.
left/camera_info sensor_msgs/CameraInfo Left camera metadata
right/image_rect sensor_msgs/Image Right Mono rectified image.
right/camera_info sensor_msgs/CameraInfo Right camera metadata
Plan a path to reach this goal using
goal geometry_msgs/PoseStamped
the current online map.
RGB-D synchronized image, only
rgbd_image rtabmap_ros/RGBDImage
when subscribe_rgbd is true .
9.4.2、Published Topics
Name Type Analyze
info rtabmap_ros/Info RTAB-Map's info.
RTAB-Map's graph and latest
mapData rtabmap_ros/MapData
node data.
mapGraph rtabmap_ros/MapGraph RTAB-Map's graph only.
Occupancy grid generated
grid_map nav_msgs/OccupancyGrid
with laser scans
DEPRECATED: use /grid_map
proj_map nav_msgs/OccupancyGrid topic instead with
Grid/FromDepth=true .
3D point cloud generated
cloud_map sensor_msgs/PointCloud2 from the assembled local
grids
3D point cloud of obstacles
cloud_obstacles sensor_msgs/PointCloud2 generated from the
assembled local grids
3D point cloud of ground
cloud_ground sensor_msgs/PointCloud2 generated from the
assembled local grids.
3D point cloud generated with
scan_map sensor_msgs/PointCloud2
the 2D scans or 3D scans
Convenient way to show
labels visualization_msgs/MarkerArray
graph's labels in RVIZ.
Poses of the planned global
global_path nav_msgs/Path path. Published only once for
each path planned.
Upcoming local poses
corresponding to those of the
local_path nav_msgs/Path
global path. Published on
every map update.
Status message if the goal is
goal_reached std_msgs/Bool
successfully reached or not.
Current metric goal sent from
the rtabmap's topological
planner. For example, this can
goal_out geometry_msgs/PoseStamped
be connected
move_base_simple/goal to
move_base。
Get an OctoMap. Available
octomap_full octomap_msgs/Octomap only if rtabmap_ros is built
with octomap.
Name Type Analyze
Get an OctoMap. Available
octomap_binary octomap_msgs/Octomap only if rtabmap_ros is built
with octomap.
A point cloud of the occupied
space (obstacles and ground)
octomap_occupied_space sensor_msgs/PointCloud2 of the OctoMap. Available
only if rtabmap_ros is built
with octomap.
A point cloud of the obstacles
of the OctoMap. Available
octomap_obstacles sensor_msgs/PointCloud2
only if rtabmap_ros is built
with octomap.
A point cloud of the ground of
the OctoMap. Available only if
octomap_ground sensor_msgs/PointCloud2
rtabmap_ros is built with
octomap.
A point cloud of empty space
of the OctoMap. Available
octomap_empty_space sensor_msgs/PointCloud2
only if rtabmap_ros is built
with octomap.
The projection of the
OctoMap into a 2D occupancy
octomap_grid nav_msgs/OccupancyGrid grid map. Available only if
rtabmap_ros is built with
octomap.
9.4.3、Services
Name Type Analyze
Call this service to get the
get_map rtabmap_ros/GetMap
standard 2D occupancy grid
Call this service to get the map
get_map_data rtabmap_ros/GetMap
data
Call this service to publish the
publish_map rtabmap_ros/PublishMap
map data
list_labels rtabmap_ros/ListLabels Get current labels of the graph.
The node will update with
update_parameters std_srvs/Empty current parameters of the
rosparam server
reset std_srvs/Empty Delete the map
pause std_srvs/Empty Pause mapping
resume std_srvs/Empty Resume mapping
trigger_new_map std_srvs/Empty The node will begin a new map
Backup the database to
backup std_srvs/Empty "database_path.back" (default
~/.ros/rtabmap.db.back)
set_mode_localization std_srvs/Empty Set localization mode
set_mode_mapping std_srvs/Empty Set mapping mode
Set a label to latest node or a
set_label rtabmap_ros/SetLabel
specified node.
Set a topological goal (a node id
set_goal rtabmap_ros/SetGoal
or a node label in the graph).
Get an OctoMap. Available only if
octomap_full octomap_msgs/GetOctomap rtabmap_ros is built with
octomap.
Get an OctoMap. Available only if
octomap_binary octomap_msgs/GetOctomap rtabmap_ros is built with
octomap.
9.4.4、Parameters
Name Type Default value Analyze
subscribe_depth bool true Subscribe to depth image
subscribe_scan bool false Subscribe to laser scan
Subscribe to laser scan point
subscribe_scan_cloud bool false
cloud
subscribe_stereo bool false Subscribe to stereo images
subscribe_rgbd bool false Subsribe to rgbd_image topic
The frame attached to the
frame_id string base_link
mobile base.
The frame attached to the
map_frame_id string map
map.
The frame attached to
odom_frame_id string ‘’
odometry.
When odom_frame_id is used,
the first 3 values of the
odom_tf_linear_variance double 0.001
diagonal of the 6x6 covariance
matrix are set to this value.
When odom_frame_id is used,
the last 3 values of the
odom_tf_angular_variance double 0.001
diagonal of the 6x6 covariance
matrix are set to this value.
Size of message queue for
queue_size int 10
each synchronized topic.
Publish TF from /map to
publish_tf bool true
/odom.
tf_delay double 0.05
tf_prefix string ‘’ Prefix to add to generated tf.
Wait (maximum
wait_for_transform_duration
wait_for_transform bool true
sec) for transform when a tf
transform is not still available.
Wait duration for
wait_for_transform_duration double 0.1
wait_for_transform.
Path of a config files containing
RTAB-Map's parameters.
config_path string ‘’ Parameters set in the launch
file overwrite those in the
config file.
Path of the RTAB-Map's
database_path string .ros/rtabmap.db
database.
Name Type Default value Analyze
Generate laser scans from
depth images (using the
middle horizontal line of the
gen_scan bool false
depth image). Not generated if
subscribe_scan or
subscribe_scan_cloud are true.
Maximum depth of the laser
gen_scan_max_depth double 4.0
scans generated.
Use approximate time
synchronization of input
messages. If false, note that
approx_sync bool false the odometry input must have
also exactly the same
timestamps than the input
images.
Number of RGB-D cameras to
use (when subscribe_rgbd is
rgbd_cameras int 1 true). Well for now, a
maximum of 4 cameras can be
synchronized at the same time.
Use actionlib to send the
use_action_for_goal bool false
metric goals to move_base.
Adjust image and scan poses
odom_sensor_sync bool false relatively to odometry pose for
each node added to graph.
Generate depth image from
scan_cloud projection into RGB
camera, taking into account
gen_depth bool false
displacement of the RGB
camera accordingly to
odometry and lidar frames.
Scale down image size of the
gen_depth_decimation int 1 camera info received (creating
smaller depth image).
Fill holes of empty pixels up to
this size. Values are
gen_depth_fill_holes_size int 0 interpolated from neighbor
depth values. 0 means
disabled.
Maximum depth error (m) to
gen_depth_fill_iterations double 0.1
interpolate.
Number of iterations to fill
gen_depth_fill_holes_error int 1
holes.
Name Type Default value Analyze
Filter nodes before creating
the maps. Only load data for
map_filter_radius double 0.0 one node in the filter radius
(the latest data is used) up to
filter angle (map_filter_angle).
Angle used when filtering
nodes before creating the
map_filter_angle double 30.0 maps. See also
map_filter_radius. Used for all
published maps.
If there is no subscription to
any map cloud_map, grid_map
map_cleanup bool true
or proj_map, clear the
corresponding data.
If true, the last message
published on the map topics
latch bool true will be saved and sent to new
subscribers when they
connect.
Always update the occupancy
map_always_update bool true grid map even if the graph has
not been updated
Do ray tracing to fill unknown
space for invalid 2D scan's rays
(assuming invalid rays to be
map_empty_ray_tracing bool true
infinite). Used only when
map_always_update is also
true.
9.4.5、tf transform
Preparation:
base_link → sensor
odom → base_link
Provide:
map → odom
9.5、Node rtabmapviz
This node starts the visualization interface of RTAB-Map. It is a wrapper for the RTAB-MapGUI
library. Its purpose is the same as rviz, but with RTAB-Map specific options.
9.5.1、Subscribed Topics
Name Type Analyze
Odometry stream. Required if
parameters subscribe_depth or
odom nav_msgs/Odometry
subscribe_stereo are true and
odom_frame_id is not set.
RGB/Mono image. Should be rectified
when subscribe_depth is true. Not
rgb/image sensor_msgs/Image
required if parameter subscribe_stereo
is true (use left/image_rect instead).
RGB camera metadata. Not required if
rgb/camera_info sensor_msgs/CameraInfo parameter subscribe_stereo is true (use
left/camera_info instead).
Registered depth image. Required if
depth/image sensor_msgs/Image
parameter subscribe_depth is true.
Laser scan stream. Required if
scan sensor_msgs/LaserScan
parameter subscribe_scan is true.
Laser scan stream. Required if
scan_cloud sensor_msgs/PointCloud2
parameter subscribe_scan_cloud is true.
Left RGB/Mono rectified image.
left/image_rect sensor_msgs/Image Required if parameter subscribe_stereo
is true.
Left camera metadata. Required if
left/camera_info sensor_msgs/CameraInfo
parameter subscribe_stereo is true.
Right Mono rectified image. Required if
right/image_rect sensor_msgs/Image
parameter subscribe_stereo is true.
Right camera metadata. Required if
right/camera_info sensor_msgs/CameraInfo
parameter subscribe_stereo is true.
Odometry info. Required if parameter
odom_info rtabmap_ros/OdomInfo
subscribe_odom_info is true.
info rtabmap_ros/Info RTAB-Map's statistics info.
mapData rtabmap_ros/MapData RTAB-Map's graph and latest node data.
RGB-D synchronized image, only when
rgbd_image rtabmap_ros/RGBDImage
subscribe_rgbd is true.
9.5.2、Parameters
Default
Parameters Type Analyze
value
subscribe_depth bool false Subscribe to depth image
subscribe_scan bool false Subscribe to laser scan
subscribe_scan_cloud bool false Subscribe to laser scan point cloud
subscribe_stereo bool false Subscribe to stereo images
subscribe_odom_info bool false Subscribe to odometry info messages
subscribe_rgbd bool false Subsribe to rgbd_image topic.
frame_id string base_link The frame attached to the mobile base.
The frame attached to odometry. If empty,
rtabmapviz will subscribe to odom topic to
odom_frame_id string ‘’
get odometry. If set, odometry is got from
tf.
tf_prefix string ‘’ Prefix to add to generated tf.
Wait (maximum 1 sec) for transform when
wait_for_transform bool false
a tf transform is not still available.
Size of message queue for each
queue_size int 10
synchronized topic.
Number of RGB-D cameras to use (when
subscribe_rgbd is true). Well for now, a
rgbd_cameras int 1
maximum of 4 cameras can be
synchronized at the same time.
9.5.3、Required tf Transforms
base_link →Sensor coordinate system
odom → base_link
map → odom