Simultaneous Localization and Mapping SLAM Using RTAB Map
Simultaneous Localization and Mapping SLAM Using RTAB Map
ISSN 2229-5518
Abstract— This paper implements Simultaneous Localization and Mapping (SLAM) technique to construct a map of a given environment.
A Real Time Appearance Based Mapping (RTAB-Map) approach was taken for accomplishing this task. Initially, a 2d occupancy grid and
3d octomap was created from a provided simulated environment. Next, a personal simulated environment was created for mapping as well.
In this appearance based method, a process called Loop Closure is used to determine whether a robot has seen a location before or not.
In this paper, it is seen that RTAB-Map is optimized for large scale and long term SLAM by using multiple strategies to allow for loop
closure to be done in real time and the results depict that it can be an excellent solution for SLAM to develop robots that can map an
environment in both 2d and 3d.
Index Terms— Localization, Mapping, Occupancy Grid Mapping, RTAB-Map, SLAM, Graph SLAM
—————————— ——————————
1 INTRODUCTION
IJSER
the map nor the robot poses are provided making this prob-
lem a 'chicken or a egg' problem. With noise in the robot's mo-
tion and measurements, the map and robot's pose will be un-
certain, and the errors in the robot's pose estimates and map
will be correlated. The accuracy of the map depends on the
accuracy of the localization and vice versa. Given a series of
sensor observations over discrete time steps, the SLAM prob-
lem is to compute an estimate of the agent’s location and a
map of the environment.
In this paper, two simulation environments were provided
where SLAM was performed. The robot was successfully able Figure 2: Kitchen - Dining world
to localize itself and map the 3d world. The benchmark envi-
ronment is called kitchen-dining Figure 1 and the second envi-
2 BACKGROUND
ronment is that of a cafeteria called sagar-cafe Figure 2.
SLAM algorithms generally fall into 5 categories:
With grid mapping algorithm, the environment can be difference allows it to consider dependencies between current
modeled using grid maps without predefining any landmark and previous poses. One of the benefits of graph SLAM is the
position. So by extending the FastSLAM algorithm to reduced need for significant on-board processing capability.
occupancy grid maps, the SLAM problem can now be solved Another is graph SLAM's increased accuracy over fast SLAM.
in an arbitrary environment. While mapping the real world Fast SLAM uses particles to estimate the robot's most likely
environment, mobile robots equipped with range sensors can pose. However, at any point in time, it is possible that there is
be used and the FastSLAM algorithm can be extended to solve not a particle in the most likely location. In fact, chances are
the SLAM problem in terms of grid maps. slim to none especially in large environments. Since graph
SLAM solves the full SLAM problem, this means that it can
2.1.1 Grid based FastSLAM techniques work with all of the data at once to find the optimal solution.
Adapting the FastSLAM algorithm to grid maps is altered in In graph SLAM, the idea is to organize information in a graph.
IJSER
the grid based FastSLAM algorithm. Since the grid based A node in the graph represents either a robot pose xt at a spe-
FastSLAM algorithm uses a particle filter approach and repre- cific time step t or the location of a feature in the environment
sents the world in terms of grid maps, both MCL (Monte Carlo denoted as m(i) with i = 1. . . . α. An edge in the graph repre-
Localization) and Occupancy Grid Mapping algorithm are sents either a measurement constraint between a pose and a
combined. Now three different techniques are needed which feature or a motion constraint between two successive poses.
are represented by 3 probability functions to adapt FastSLAM Since the spatial constraints are soft, they can be considered as
to grid mapping. These techniques are known as: springs connecting two masses. In this analogy, the full SLAM
problem can be solved as a global graph optimization prob-
1.
[k ]
Sampling motion P ( xt | xt −1 , u t ) : Estimates the cur- lem. The optimal graph configuration is the one where the
rent pose given the kth particle's previous pose and springs are relaxed, and the forces on each of the nodes are
controls u (MCL). minimized.
[k ] [k ]
2. Map Estimation P ( mt | z t , xt , mt −1 ) : Estimates the
current map given the current measurements, the cur- The Maximum Likelihood Principle (MLE) is used to optimize
rent kth particle's pose and the previous kth particle the graph. When applied to SLAM, likelihood tries to estimate
map (use Occupancy Grid Mapping). the most likely configuration of state and feature locations
[k ] [k ]
3. Importance weight P ( z t | xt , m ) : Estimates the given the motion and measurement observations. The meas-
current likelihood of the measurement given the cur- urement update at time step t is given by
rent kth particle pose and the current kth particle map
(MCL). z t := xt + mt(i ) (1)
The sampling motion, map estimation and importance weight which represents for instance a laser range finder measuring
techniques are the essence of the grid based FastSLAM algo- the distance to the landmark m(i) . Equivalently, a motion up-
rithm. Grid based FastSLAM implements them to estimate date can be defined as
both the map and the robot's trajectory, given the measure-
ments and the control. The grid based FastSLAM algorithm x t := xt −1 + u t (2)
looks very similar to Monte Carlo localization algorithm with
some additional statements concerning the map estimation. which could be realized as a control command instructing the
Figure 3 denotes the Grid based FastSLAM algorithm. robot to move a certain distance ut . The updates are assumed
to have Gaussian noise. The corresponding probability distri-
butions are given by
2.2 GraphSLAM
1 / 2σ m2
e − ( zt − zt )
2
Graph SLAM is a SLAM algorithm that solves the full SLAM pu ( xt ) = (3)
problem. This means that the algorithm recovers the entire σ m 2π
path and map, instead of just the recent pose and map. This
Figure 3: Grid based FastSLAM algorithm 1 / 2σ u2
e −( xt − xt )
2
pm ( zt ) = (4)
σ u 2π
IJSER © 2018
http://www.ijser.org
International Journal of Scientific & Engineering Research Volume 9, Issue 8, August-2018 1720
ISSN 2229-5518
IJSER
be broken down into two sections. The front-end and the back-
end.
2.2.2 Using RTAB-Map for 3D Graph SLAM The URDF folder contains the files sagar_bot.xacro defining
the links and joints of the robot model used for physics
RTAB-Map (Real Time Appearance Based Mapping) [4] is a
simulation and visualization as well as the file
IJSER © 2018
http://www.ijser.org
International Journal of Scientific & Engineering Research Volume 9, Issue 8, August-2018 1721
ISSN 2229-5518
sagar_bot.gazebo specifying the Gazebo plugins for define the casters, and therefore no joints to connect them. The
differential drive, RGB-D camera and laser range finder. casters do, however, have friction coefficients defined for
Section 3.1 goes into more details about the robot model. them, and are set to 0, to allow for free motion while moving.
Besides the provided kitchen-dining world, the worlds
Two wheels were attached to the robot. Each wheel is repre-
directory contains a file named sagar_cafe.world defining a sented as a link and is connected to the base link (the chassis)
custom indoor cafeteria environment in SDF format. Section with a joint. For each wheel, a "collision", "inertial" and "visu-
3.2 discusses this in more details. The image and mesh files al" elements are present. The joint type is set to "continuous"
necessary to model the Hokuyo laser and Kinect camera are and is similar to a revolute joint but has no limits on its rota-
downloaded from the Gazebo model database and stored in tion. It can rotate continuously about an axis. The joint will
the meshes folder. The launch folder contains four ROS node have its own axis of rotation, some specific joint dynamics that
launch configurations, as detailed in section 3.3. The config correspond to the physical properties of the joint like "fric-
tion", and certain limits to enforce the maximum "effort" and
directory contains the RViz configuration file, and a script for
"velocity" for that joint. The limits are useful constraints in
tele-operating the rover can be found in scripts. regards to a physical robot and can help create a more robust
robot model in simulation as well. To enable the robot to per-
3.1 Robot Model form appearance based mapping using visual odometry, the
Figure 1 and 2 depicts the robot model inside the Gazebo sim- generic RGB camera of the original model is upgraded to a
ulation environments of both the provided and the custom Kinect RGB-D camera. The camera is mounted to the front of
made one. The URDF specification can be found in the file the chassis to allow for unobstructed view, facing in forward
sagar_bot.xacro. The transform tree associated with the robot direction. The mesh files for the Kinect camera model are
is shown in Figure 5. downloaded from the Gazebo model database and included in
the slam_project/meshes folder. Like the original model, the
IJSER
rover is fitted with a Hokuyo 2D laser range finder. The corre-
sponding hokuyo link is mounted with a fixed joint on the top
of the chassis, to let the laser beans rotate without hitting any
part of the robot. the laser range finder provides more precise
localization and thereby refines geometric constraints The dif-
ferential drive plugin is configured in the sagar_bot.gazebo
file to publish control commands to the /cmd_vel topic and
odometry messages to the /odom topic. The camera plugin is
configured to publish raw RGB images to
/camera/rgb/image_raw and raw depth images to
/camera/depth/image_raw. The laser plugin is configured to
publish messages of type LaserScan to the /scan topic. A
For this project, the robot from [5] was taken as a starting Figure 6: RQT graph of the topics after all the nodes are launched
point. The xacro file provides the shape and size of the robot Figure 7: Close up view of the robot model
in macro format. For the sagar_bot, a fixed base is used. A sin-
gle link, with the name defined as "chassis", encompassed the 3.2 Design of the world
base as well as the caster wheels. Each link has specific ele- As the second part of the project, the custom world is created
ments, such as the inertial or the collision elements. The chas- in Gazebo. This world is based on the cafe model inside Gaze-
sis is a cuboidal (or box), whereas the casters are spherical as bo database. The base model is customized with different ob-
denoted by their "geometry" tags. Each link (or joint) has an jects like tables, beer can, people, trees etc. These objects serve
origin (or pose) defined as well. Every element of that link or as distinctive elements in the base world for the robot to dis-
joint will have its own origin, which will be relative to the tinguish and map. In this world, the kitchen cannot be entered
link's frame of reference. by the robot. A bird's eye view of this world is provided in
Figure 8.
For this base, as the casters are included as part of the link (for
stability purposes), there is no need for any additional links to
IJSER © 2018
http://www.ijser.org
International Journal of Scientific & Engineering Research Volume 9, Issue 8, August-2018 1722
ISSN 2229-5518
IJSER
scene in a wide variety of environments, ranging from small cloud map was created by using the Export 3d Clouds function-
hand-held sequences to a car driven around several city ality. Figure 11 depicts the reconstructed 3D point cloud data.
blocks. It is able to close large loops and perform global re- It can be seen that most features in the world like the chairs
localization in real-time and from wide baselines. Finally, the and tables are reconstructed properly and are distinctive. Fig-
rviz.launch file starts visualization of the rover, sensor data, as ure 12 shows the RViz result of the same world after the end
well as map and camera topics in RViz.Figure 9 depicts RViz
view of the world at the starting point.
During the mapping of the environment, the mapping data is At the end of the map, the loop closures can be seen in the
saved in the rtabmap.db database. The localization.launch file rtabmap_kitchen_dining.db. Figure 13 shows one of them.
can be started in order to localize the robot during the run.
4.1 Sagar-cafe world
In the custom made world - sagar_cafe.world, the robot per-
formed well. As the robot is very short, some of the taller ob-
4 RESULTS
jects like the people, trees are not fully mapped. The kitchen
The mapping was done by the robot controlled by the teleop also could not be traveled by the robot. Figure 14 and 15 de-
keyboard. In order to be able to have more than 3 loop closure picts the RTAB-map view and the RViz view of this world
detection, which was the project's benchmark, the robot was respectively at the end of the mapping.
navigated through the full environment of both the worlds so
that it could collect more images.
IJSER © 2018
http://www.ijser.org
International Journal of Scientific & Engineering Research Volume 9, Issue 8, August-2018 1723
ISSN 2229-5518
er antennas.
IJSER
15. One of the possible explanations might be that there is a
height difference of the floor between the living room and the
kitchen. Another possible explanation might be that there is a
transparent door separating those two rooms and hence the robot
couldn't pass through.
7 END SECTIONS
7.1 Acknowledgements
The author sincerely thanks Udacity for their support and cri-
tiques throughout the project. The kitchen-dining world was
provided by them.
REFERENCES
Figure 13: Loop Closure detection
[1] M. Montemerlo, S. Thrun, D. Koller and B. Wegbreit, “FASTSLAM: A FAC-
TORED SOLUTION TO THE SIMULTANEOUS LOCALIZATION AND
The generated 2d and 3d maps can be improved by doing more
MAPPING PROBLEM,” In Proceedings of the AAAI National Conference on Arti-
mapping runs which cover the environment in a more complete
ficial Intelligence, pp. 593-598, 2002, AAAI.
manner and by optimizing the loop closure detection further.
[2] S. Thrun and M. Montemarlo, “THE GRAPH SLAM ALGORITHM WITH
APPLICATIONS TO LARGE SCALE MAPPING OF URBAN STRUC-
6 CONCLUSION/FUTURE WORK TURES,” The International Journal of Robotics Research volume 25, issue 5-6, pp.
An interesting future work would be to explore the RTAB-Map 403-429, 2006, IJRR
package's visualization section in more details. The obstacle de- [3] G. Grisetti, C. Stachniss and Wolfram Burgard, “IMPROVED TECHNIQUES
tection feature can be deployed in order to extracts obstacles and FOR GRID MAPPING WITH RAO-BLACKWELLIZED PARTICLE FIL-
the ground from your point cloud. With this information in hand, TERS,” IEEE Transactions on robotics, volume 23, issue 1, pp. 34-46, 2007, (IEEE
these obstacles can be avoided when executing a desired path. transactions)
Another potential area would be Wifi signal strength mapping. [4] M. Labbe and F. Michaud, “ONLINE GLOBAL LOOP CLOSURE DETEC-
This feature allows the user to visualize the strength of your ro- TION FOR LARGE SCALE MULTI-SESSION GRAPH BASED SLAM,”
bot’s WiFi connection. This can be important in order to deter- IEEE/RSJ International Conference on Intelligent Robots and systems (2014), pp.
mine where the robot may lose its signal, therefore dictating it to 2661-2666, doi: 10.1109/IROS.2014.6942926
avoid certain areas. The situation can also be remedied with larg- [5] S. Das, “ROBOT LOCALIZATION IN A MAPPED ENVIRONMENT US-
IJSER © 2018
http://www.ijser.org
International Journal of Scientific & Engineering Research Volume 9, Issue 8, August-2018 1724
ISSN 2229-5518
IJSER
IJSER © 2018
http://www.ijser.org