# Simultaneous Localization and Mapping

• Last Updated : 18 Nov, 2021

SLAM is the estimation of the pose of a robot and the map of the environment simultaneously. SLAM is hard because a map is needed for localization and a good pose estimate is needed for mapping

• Localization: inferring location given a map.
• Mapping: inferring a map given locations.
• SLAM: learning a map and locating the robot simultaneously.

SLAM problem is hard because it is kind of a paradox i.e :

• In order to build a map, we need now the position.
• To determine our position, we need a map.

It is like a chicken-egg problem.

SLAM has multiple parts and each part can be executed in many different ways:

• Landmark detection
• Data association
• State Estimation
• State Update
• Landmark Update

### SLAM step by step

SLAM step 1

>SLAM step 2

SLAM step 3

SLAM step 4

• SLAM process consists of the following steps:
• In the first step, it uses the environment to update the position of the robot. We can use Odometry but it can be erroneous, we cannot only rely directly on odometry.
• We can use laser scans of the environment to correct the position of the robot. But, it won’t work in some environments like underwater.
• Thus, the position of the robot can be better identified by extracting features from the environment.

### Extended Kalman Filter

The Extended Kalman Filter (EKF) is the core of the SLAM process. It is an estimation of non-linear processes or measurement relationships. It is responsible for updating where the robot thinks it is based on the Landmarks.

### Laser and Odometry data

Laser data is the reading obtained from the scan whereas, the goal of the odometry data is to provide an approximate position of the robot. The difficult part about the odometry data and the laser data is to get the timing right.

Landmarks: Landmarks are the features that can easily be re-observed and distinguished from the environment. These are used to localize the robot. Landmark  should be easily available, distinguishable from each other, should be abundant in the environment and stationary

### Landmark Extraction

After selecting and deciding on the landmarks, we need to extract landmarks from inputs of robot sensors. The two basic landmark extraction used are Spikes and RANSAC.

• Spikes

Spike landmarks rely on the landscape changing a lot between two laser beams. This means that the algorithm will fail in smooth environments.

Spike

• RANSAC (Random sampling and consensus):

RANSAC finds the landmarks by randomly sampling the laser readings and then using the using a least-squares approximation to find the best fit line that runs through these readings.

RANSAC consensus

The main idea behind this classifying each of the points as outliers and inliers while only using inliers to find the best fit for the line and discarding the outliers.

### Data Association

Data association or data matching is that of matching observed landmarks from different (laser) scans with each other. There are some challenges associated with the Data Association,

• The algorithm might not re-observe landmarks in every frame.
• The algorithm wrongly associates a  landmark to a previously observed landmark.

There are few approaches to perform data association, we will be discussing the nearest neighbor algorithm first:

• First, when you get the data from the laser scan use landmark extraction to extract all visible landmarks.
• After that, we associate all the extracted landmarks to the closest landmark that can be observed >N times.
• Now, we input the list of extracted landmarks and list of previously detected landmarks that are in the database, if the landmark is already in the database then, we increase the their count by N, and if they are not present then set their count to 1.

After the above step, we need to perform the following update steps:

• State Estimation: In this step, we use the odometery data to get the current state estimate.
• State update: In this stage, we update our new estimated state by re-observing landmarks.
• Landmarks update:  In this step, we add new landmarks that are detected in current stage.

### Applications of SLAM

• SLAM problem is fundamental for getting robots autonomous. It has wide variety of application where we want to represent surroundings with a map such as Indoor, Underwater, Outer space etc.

### References:

My Personal Notes arrow_drop_up