I have built a quadcopter from scratch and I am at the stage of optimizing the roll, pitch, yaw angles estimation. To this end, I have implemented both Madgwick and Mahony AHRS filter and at the moment I am using the Madgwick filter to obtain the quaternion orientation at each sampling instant by feeding the filter with the gyroscope, accelerometer and magnetometer measurements. Before executing the filter, I remove the biases from the measurements (I have calibrated the sensors) and pass them afterwards to the filter following the North-East-Down (NED) coordinate frame. In addition, I use simple low pass filters to reduce the noise from the measurements.

I am facing certain issues with the yaw angle estimation. I have managed to eliminate a continuous drift that used to appear but my problem now is the following:

If the quadcopter starts with an initial pitch and/or roll angle, then the yaw estimation does not correspond to the actual rotation along the z-axis. For example, in case I hold the quadcopter at an initial 45 degrees roll angle, if I just rotate it around the x-axis and eliminate the roll angle, then the yaw angle estimate changes. The same is happening with the pitch angle, as well. After some internet search, I came across some sources stating the one should compensate the magnetometer measurements for the roll and pitch angles, but I am not sure what to do and fix this issue, which has appeared to be quite serious when trying to achieve full orientation control.

Should I follow the suggestion in terms of compensating the magnetometer measurements with respect to roll and pitch angles or are there any other intermediate steps that I should follow ?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.