Complementary filtering for height estimation and control of a drone

STUDENTS : Alessandro Avi, Matteo Zuccatti – SUPERVISOR : Luca Maule

The main focus of this project is the implementation of a key concept belonging to the sensor fusion theory which is Complementary filtering in a Unity game.

In this case the goal is to fuse the measurament coming from an incremental sensor such as an accelerometer with the measurament of a barometer, namely an absolute sensor, to estimate the flying altitude of a drone. The sensor fusion algorithm, as well as the filtering processes of the measurements, are carried out in Matlab, which is connected to Unity through the ZMQ library. The drone is equipped with ideal sensors (e.g. ideal gyroscopes),  as well as realistic sensors such as the ones which are used for the sensor fusion. The simulation takes into account multiple aspects of the incremental and absolute sensors, such as drift phenomenas, sampling frequencies, noises and repetabilities, in order to have a more accurate rapresentation of a real sensor.

The game has been further developed by coding additional functions such as stabilization and full control of the drone in space, as well as path-tracking and landing capabilites. The dynamic model of the drone has been manually implemented in C# and every task affecting its dynamics is being carried out through a PD control. The position and attitude of the drone, by design, are not independent each other, thus making the control of its pose not a trivial task.
Multiple dynamical tasks can be executed simultaneously (e.g. landing the drone while stabilizing it along its axis), thus multiple input variable must be controlled at once. This is especially critical when the two tasks are not independant, for example the stabilization and the trajectory tracking.

Once the drone has landed, a series of plots are automatically generated in Matlab, showing  few important aspects of the simulation. These plots analyse the raw and filtered measurements coming from the two sensor and the effectiveness of the sensor fusion procedure, as well as showing the motion of the drone in a 3D plot and the tracking errors.  The Unity game is also equipped with a dedicated explanatory section, where the theoretical aspects of the project are illustrated and thoroughly explained.


Code SummaryGame Source Code FolderReport