# GRAPH SLAM: A Beginner’s Guide to this Groundbreaking Mapping Technology

Last Updated on July 25, 2023 by Editorial Team

Originally published on Towards AI.

## Introduction

‘SLAM’ refers to the method of simultaneous localisation (i.e. position/orientation) of some sensor with respect to its surroundings while at the same time mapping the environment. This is an active area of research in the fields of robotics and autonomous systems.

## ‘Maths behind it’

SLAM (Simultaneous Localisation and Mapping) can be implemented for a 2-dimensional world! It is basically a combination of robot sensor measurements and movement to create /locate a robot and create a map of an environment from only sensor and motion data gathered by a robot over time. SLAM gives you a way to track the location of a robot in the world in real time and identify the locations of landmarks such as buildings, trees, rocks, and other world features.

Building a map with a robot can be challenging due to motion uncertainty and a lack of an existing map. This is where SLAM comes into play, offering a solution to track the robot’s location accurately. Of all the SLAM methods available, GRAPH SLAM stands out as one of the easiest to understand and is a favourite among many experts in the field.

A graph-based SLAM approach constructs a simplified estimation problem by abstracting the raw sensor measurements. These raw measurements are replaced by the edges in the graph which can then be seen as “virtual measurements”.

To understand this in a simple way, let’s assume an initial position of the robot X=0 & Y=0; for this example, assume that there is no concern of heading direction & compass.
Let’s assume the robot moves to the right in the x-direction by 10, so now the location after motion(X1) in a perfect world would be X1= X0+10 and Y1= 0.

But various Kalman Filters have suggested that the motion is actually uncertain, so it’s better to say that the actual location after motion(X1) would be a Gaussian centered around that (10,0), but it’s possible that the robot is somewhere else.

The maths for the X variable goes as follows:
Rather than setting X1 to X0+10, let’s express it in Gaussian, which peaks when these two things are the same. So, if we do X1- X0- 10, put this into a square format and turn this into Gaussian, we’ll get a probability distribution that relates X1 & X0. This can be done equally for Y & since there is no change in Y according to our motion, so Y1 & Y0 shall remain as close as possible.

The product of these two Gaussian is now our constraint. The goal is to maximize the likelihood of position X1, given that position X0 is (0,0). So, what GRAPH SLAM does is it defines the probabilities using a sequence of such constraints.
GRAPH SLAM collects its initial location, which is (0,0) initially (Initial Constraints), then lots of relative constraints that relate each robot pose to the previous robot pose( Relative Motion Constraints). As an example, let’s use landmarks which can be seen by the robot at various locations, which would be Relative Measurement Constraints(every time a robot sees a landmark).

These constraints altogether find the most likely configuration of the robot path along with the location of the landmark, and that is the mapping process.

Reference: Computer Vision nanodegree by Udacity!

For those interested in seeing the implementation of GRAPH SLAM in code, we recommend checking out the ‘Landmark Detection Tracking SLAM’ project on GitHub. This resource provides a hands-on experience with the technology and a deeper understanding of its application:
Code: Landmark Detection Tracking SLAM

## Conclusion

In conclusion, GRAPH SLAM is a cutting-edge technology that is revolutionizing the field of robotics. By providing an efficient and accurate solution to mapping and navigation, it has numerous applications in various industries. Whether you are a seasoned expert or a beginner, the ‘Landmark Detection Tracking SLAM’ project on Github offers a great opportunity to dive into the implementation of GRAPH SLAM and gain a deeper understanding of this exciting technology. As GRAPH SLAM continues to evolve and improve, it is clear that it will play a significant role in shaping the future of robotics and beyond.

Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.

Published via Towards AI