The current repository contains the code developed for the course Robotic Action and Perception, Masted Degree in Mechatronics Engineering - Department of Industrial Engineering - University of Trento, held by professors De Cecco Mariolino, Luchetti Alessandro. The project is supervised also by Tavernini Matteo, CEO of the startup Robosense
To run the SLAM algorithm is necessary to load a set of data and properly configure the config.m file selecting the correct path. Then the main.m can ben executed
Data inside the Data folder are obtained by means of the gridmap navigation simulator application, an open source software that simulates the mobile robot motion as well as it mesures (with uncertainties); in particular we can generate the following files:
-
simul_LASER_LASER_SIM.txt
: each row contains the measurements of the LIDAR at each time step; in the particular case, the scan has a field of view of 180° that's divided in 361 samples; -
simul_LASER_LASER_SIM_times.txt
: each row contains the absolute acquisition time of the respective LIDAR scan in the previous file; -
simul_ODO.txt
: each line contains the increment of the robot odometry, variables$x,y,\theta$ ; -
simul_ODO_times.txt
: each line contains the absolute acquisition time of the respective odometry increment.
In the Scripts folder there are developed the main script parts that are then imported in the main file:
- load_data: read laserscan and odometry data and performs some basic preprocessing;
- plot_raw_data: given the cellarray of laserscans in
load_data
, it provides some plots to visualize the raw provided data as well as the extracted features; - EKF: contains the main loop of the Ektended Kalman Filter
Different classes are developed to get different levels of abstraction of informations. Naming and ideas mainly obtained by this article (also cited in the references).
Everything has been coded in a Object-Oriented Programming to separate the main function and improve code readibility.
Handles information of a laserscan. It takes as input a the polar measurement and is able to convert them in cartesian space.
Internally embedds an algorithm to extract feature from the cartesian map thus generating a vector of observations for the given data that will be used in the Kalman prediction step as well as in the map update.
Stores information of the odometry system on the robot in order to have easier comput.
Stores current information of the robot, in particular it's state estimate and covariance matrix.
It contains function that allows for a simple calculation of jacobians used in the EKF.
An observation is regarded as a feature extracted in the robot's reference frame and it's characterized by a cartesian position (w.r.t. the robot) and an uncertainty that's computed based on the one of the LiDAR.
A landmark can be regarded as an observation projected into a fixed reference frame; it's described by a cartesian coordinate and it's uncertainty.
The goal of the SLAM is thus to localize the robot based on the landmark that it sees and handling newly seen landmarks.
Handles the structure of the map, storing all landmarks inside it and providing functions aiming at closing the loop and computing the correspondences between current observations and landmarks inside the map itself.
File load_data.m
reads the simulated data and builds cell-arrays of Laserscan
and Odometry
objectes. While loading the laserscans, it also pre-computes the features to reduce the overhead at EKF runtime. Since this is a highly time-consuming operation, the pre-processed cell-arrays are stored in a folder ProcessedData where they can be cleanly loaded each other time. This can be achieved by enabling the following flag in the main script:
load_precomputed_data = true;
If no pre-processed data are present in the folder, still raw data are read and all features are extracted, saving the computation in the ProcessedData folder. If simulation data are replaced, we can so act in two way: by setting the flag load_precomputed_data = false
or by simply deleting the files in ProcessedData.
References for feature extraction:
- A line segment extraction algorithm using laser data based on seeded region growing
- Feature Selection Criteria for Real Time EKF-SLAM Algorithm
References for closure loop:
- A fast, complete, point cloud based loop closure for LiDAR odometry and mapping
- Real-Time Loop Closure in 2D LIDAR SLAM
References for EKF:
- A simple and efficient implementation of EKF - based SLAM relying on laser scanner in complex indoor environment
- Slam with EKF, matlab code -> jaijuneja
- Slam with EKF, matlab code -> fatmakhalil
- Simulataneous localization and mapping with the extended Kalman filter - A very quick guide... with Matlab code!
- SLAM for Dummies
References for building the map: