1

I'm implementing different IMU methods in a project of mine and I'm currently experimenting with the well known Madgwick's implementation of Mayhony's AHRS algorithm (MahonyAHRS.c)

So far it works around as good as my self implemented one which is based on Vector rotation and an running average sensor fusion (often called complementary).

However, I would like to get 360 degree of freedom out of it and I currently use this function:

void imu_mahony_getRollPitchYaw(float *roll_, float *pitch_, float *yaw_) 
{
    *yaw_ = fast_atan2f(2*q1*q2 - 2*q0*q3, 2*q0*q0 + 2*q1*q1 - 1); 
    *pitch_ = -asin(2*q1*q3 + 2*q0*q2); 
    *roll_ = atan2f(2*q2*q3 - 2*q0*q1, 2*q0*q0 + 2*q3*q3 - 1);
}

However, that results in the 90 degree issues. What I would like is to receive pitch and roll in a form of 0-359 degrees.

4

0 回答 0