This project compares Least-squares estimator(LSQ) and Extended Kalman Filter(EKF) for sensor fusion using Odometry data collected from simulated environment.
This project uses AirSim, an open-source, and cross platform simulation environment for drones, cars and more, built on Unreal Engine (we now also have an experimental Unity release). It supports collecting simulated data from various sensors such as Camera (Including Depth ), LIDAR, GPS, IMU, etc. The vehicles(car/drone) can be controlled manually with keyboard or remote control (RC). Airsim also provides pre-built Python API to interact with vehicles such as to retrieve images, get current state of vehicle, and control the vehicle.
For the current simulation we used pre-built of Modular Neighborhood Pack, available to download for free at AirSim Releases - v1.2.2 - Windows.
The main packages used are
- AirSim
- Matplotlib
- Numpy
- Pandas
- Scipy
The packages can be installed by running
pip install -r requirements.txt
(Ensure pip corresponds to Python 3.x, alternatively use pip3)
Before launching Airsim, the setting.json
in Documents/Airsim/
should be replaced with /assets/settings.json
. Launching AirSimNH.exe
starts the simulator which looks as follows
Start the simulation environment by running AirSimNH.exe
(In this case neighborhood environment, other environments can also be used). To collect trajectory data run /scripts/generate_traj.py
while running the Airsim environment, which connects to CarClient()
and starts recording the GPS and Image data.
We collected three runs of data presented in the data
folder. The first run includes the car following a straight line and the second and third runs include the car making a loop around the neighborhood. Each run folder consists of raw_images
, ground_truth.csv
, gauss_noise1.csv
, gauss_noise2.csv
which represent the raw image data files collected during the run, ground truth consisting [x,y,vx,vy]
and noisy measurements of two GPS sensors with gaussian noise.
python generate_traj.py
Data is available at /data/straight_line
The first run data is available at /data/loop
and the second run data is available at /data/loop2
Linear Least Squares estimator calculates the estimates of the values of position and velocity using the measurements of the two different Sensors
Run the linear least squares by running the least_squares.py file in scripts folder
python scripts/least_squares.py
Extended Kalman filter (EKF) is the nonlinear version of the Kalman filter which linearizes about an estimate of the current mean and covariance. The python file /scripts/ekf.py
consists of EKF
class, which can be tested using the following
python scripts/ekf_test.py
Run the following code to compare both the non-linear estimators.
cd scripts/
jupyter notebook
Open Compare_lsq_ekf.ipynb
and run all the cells
Run the following code to compare both the non-linear estimators.
cd scripts/
jupyter notebook
Open Compare_nlsq_ekf.ipynb
and run all the cells