This repository implements the particle filter algorithm. The implementation is done in C++
. Below is a brief description of source files:
main.cc
: The main source file.mapReader.cc
: To load the map.motionModel.cc
: Implements motion model.resampler.cc
: Implements multinomial and low variance resampler.sensorModel.cc
: Implements sensor mode.
The role of the motion model is to model the state transition of the robot. The model takes into account the previous state and the motion command leading to the robot’s current state. We use an Odometry Motion Model and hence the motion commands are a series of readings from the robot’s odometer. The state is defined by three parameters, the x and y coordinates of the robot and theta – the angular orientation of the robot.
There are 4 noise parameters:
- Angular transition noise: α₁ and α₂
- Translation noise: α₃ and α₄
These parameters are configured to the following values:
Noise coefficient | Value |
---|---|
α₁ | 0.005 |
α₂ | 0.005 |
α₃ | 0.1 |
α₄ | 0.1 |
The sensor model takes into account the prediction of the motion model and corrects it using the sensor readings. In this case, we considered 4 sources of sensor noise:
- Correct range with local measurement noise. This is represented by a Gaussian distribution and is implemented in the function
SensorModel::p_hit
. - Unexpected objects. This is represented by an exponential distribution and is implemented in the function
SensorModel::p_short
. - Failures. This is represented by an Indicator function and is implemented in the function
SensorModel::p_max
. - Random measurements. This is represented by a uniform distribution and is implemented in
SensorModel::p_rand
.
The noise parameters of sensor model are configured as below:
Noise coefficient | Value |
---|---|
z_hit | 0.7 |
z_short | 0.24 |
z_max | 0.0055 |
z_rand | 0.0545 |
sigma_hit | 20 |
lambda_short | 0.01 |
This repo implements both multinomial and low-variance sampling schemes. In general, low-variance sampler performs better.
Ray casting is used within the sensor model to retrieve what the robot is seeing, i.e., the laser readings given the robot’s coordinate. By comparing this with the laser measurements from the log file, we validate the position of random particles and the sensor model accordingly allots weight to particles.
The performance of ray casting is controlled by configuring the parameters shown in table below:
Parameter | Value |
---|---|
dist_step | 1 cm |
theta_step | 5◦ |
particle_threshold | 0.9 |
Table below specifies robot’s convergence time in its own time frame as well as overall C++
code runtime.
Item | Value |
---|---|
Avg Convergence time | 12s |
Avg Code Runtime | 150s |
Our implementation of the particle filter is sufficiently robust as it achieves convergence on all the test log files for the same set of hyper-parameters. We began testing our implementation by using 10000 particles and reduced it down to 3000 as we found it suitable for convergence across all the log files in multiple runs.