lis-epfl / MAVRIC_Library

Software library to build drone autopilots
http://lis-epfl.github.io/MAVRIC_Library/
BSD 3-Clause "New" or "Revised" License
12 stars 21 forks source link

Attitude estimation decays over time #265

Closed mdouglas90 closed 8 years ago

mdouglas90 commented 8 years ago

The attitude estimation seems to decay to an incorrect value once it changes. For example, if you tilt the drone so that it has a roll of 90 degrees, the roll will change to around 90 degrees and then decay to around 40-50 degrees over a few seconds. If you set it to 45 degrees, it will decay to around 20-30 degrees.

This does not appear to be the result of the weird magnetic field inside this building as it still occurs outside. In addition, the decay still occurs when the magnetometer update is commented out in ahrs_ekf.cpp.

jlecoeur commented 8 years ago

@ndousse do you have a documentation for the ekf equations you used (or better how you derived them)?

mdouglas90 commented 8 years ago

In the mean time, I've written the code that sends the ahrs quaternion to the drone from the motion capture system. It currently works by writing over the ahrs quaternion every time the message is received. This also allows us to completely bypass the strange magnetic field that is in the dronedome. The code still calls the ekf update function so there is still some decay but it will jump back when it receives the next mocap message. If this decay is still not wanted and the update rate is not important, you can comment out the body of Ahrs_ekf::update() and the drone will just update the ahrs quaternion at 10 Hz.

The branch locations for this code are:

jlecoeur commented 8 years ago

I opened #266 as the mocap does not really fix this issue.

ndousse commented 8 years ago

Here is the two files (especially the first one) that I used to derive the equations for the EKF: Development_of_a_Planar_Low_Cost_Inertial_Measurement_Unit_for_UAVs_andMAVs(Fux2008).pdf

Quaternions_3D.pdf