Note: This tutorial assumes that you have completed the previous tutorials: RGB-D Hand-Held Mapping With a Kinect, Setup RTAB-Map on Your Robot!. |
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Mapping and Navigation with Turtlebot
Description: This tutorial shows how to use RTAB-Map with Turtlebot for mapping and navigation.Tutorial Level: INTERMEDIATE
Next Tutorial: Stereo Outdoor Mapping
Introduction
(Originally from this post from RTAB-Map's forum)
This page will show how to use rtabmap with navigation stack on a Turtlebot3.
Requirements:
# Noetic: sudo apt install ros-noetic-rtabmap-demos ros-noetic-turtlebot3-simulations ros-noetic-turtlebot3-navigation ros-noetic-dwa-local-planner
Usage:
export TURTLEBOT3_MODEL=waffle roslaunch turtlebot3_gazebo turtlebot3_world.launch export TURTLEBOT3_MODEL=waffle roslaunch rtabmap_demos demo_turtlebot3_navigation.launch
Autonomous Navigation
When a map is created (in mapping mode or localization mode), you can then follow the same steps from 2.3.2 of the Autonomous Navigation of a Known Map with TurtleBot tutorial to navigate in the map.
Normally, you only have to "drop" a navigation goal on the map with RVIZ to see the robot moving autonomously to it. Click on "2D Nav Goal" button in RVIZ to set a goal. You should see a planned path (red line) like this to the goal set (green arrow):
The commands sent by move_base:
$ rostopic echo /mobile_base/commands/velocity
Localization mode
After a mapping session as above, a database is saved here ~/.ros/rtabmap.db. Now restart the demo_turtlebot3_navigation.launch with argument localization:=true:
$ roslaunch rtabmap_demos demo_turtlebot3_navigation.launch localization:=true
Move the robot around until it can relocalize in the previous map, then the 2D map would re-appear again when a loop closure is found.
Issues
On autonomous navigation, if teleop node is also sending commands on the same topic as move_base at the same time, the robot may not move.
If there are many TF warnings, you can try to increase robot_state_publisher's publishing frequency in turtlebot_bringup/launch/includes/robot.launch.xml from 5 to 10 Hz. You can also increase wait_for_transform argument of demo_turtlebot_mapping.launch to 0.2.
If sometimes the robot is planning a straight path through an obstacle, it may be related to this issue. This can be fixed by using rtabmap_costmap_plugins::StaticLayer instead of costmap_2d::StaticLayer here.