PaulStoffregen / MahonyAHRS

172 stars 60 forks source link

Confusion! #3

Open brunocannavina opened 7 years ago

brunocannavina commented 7 years ago

Hello Paul, I admire your work.
I'm trying to use the library MahonyAHRS and when I read the example PropShield.ino I see the angle must be in rad/s but when I read the library it says they must be in degrees/s. which is the correct?

I'm from Argentina and sorry for my English :D

PaulStoffregen commented 7 years ago

Both are true. The sensors give degrees. Mahony requires radians. The equation converts.

brunocannavina commented 7 years ago

Exactly but the library seems to requiere degrees/s instead of rad/s.

Look at this picture. It's converting degrees to rad.

El 9 ene. 2017 4:30 PM, "Paul Stoffregen" notifications@github.com escribió:

Both are true. The sensors give degrees. Mahony requires radians. The equation converts.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PaulStoffregen/MahonyAHRS/issues/3#issuecomment-271383034, or mute the thread https://github.com/notifications/unsubscribe-auth/AGW5ifMv9lwo_3Yqk6B2iHTmaHNfX8Uwks5rQordgaJpZM4Len_g .

brunocannavina commented 7 years ago

void Mahony::update(float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz) { float recipNorm; float q0q0, q0q1, q0q2, q0q3, q1q1, q1q2, q1q3, q2q2, q2q3, q3q3; float hx, hy, bx, bz; float halfvx, halfvy, halfvz, halfwx, halfwy, halfwz; float halfex, halfey, halfez; float qa, qb, qc;

// Use IMU algorithm if magnetometer measurement invalid
// (avoids NaN in magnetometer normalisation)
if((mx == 0.0f) && (my == 0.0f) && (mz == 0.0f)) {
    updateIMU(gx, gy, gz, ax, ay, az);
    return;
}

// Convert gyroscope degrees/sec to radians/sec
gx *= 0.0174533f;
gy *= 0.0174533f;
gz *= 0.0174533f;

PaulStoffregen commented 7 years ago

Oh, I see what you mean. I'll reopen this issue and put it on my list of stuff to investigate. Realistically, it might be a few weeks or even a month or more until I can really look into this.

brunocannavina commented 7 years ago

Thank Paul you are a genius ;) I really appreciate what you do

El 9 ene. 2017 5:10 PM, "Paul Stoffregen" notifications@github.com escribió:

Oh, I see what you mean. I'll reopen this issue and put it on my list of stuff to investigate. Realistically, it might be a few weeks or even a month or more until I can really look into this.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/PaulStoffregen/MahonyAHRS/issues/3#issuecomment-271393725, or mute the thread https://github.com/notifications/unsubscribe-auth/AGW5iesatHSqWnTodqQth6p8y3zC8Ktgks5rQpQigaJpZM4Len_g .