Merge pull request #80 from luggi/EstNfix

keep EstN from diverging to zero
This commit is contained in:
dongie 2014-04-16 22:48:48 +09:00
commit 45b74bf0b6
1 changed files with 5 additions and 3 deletions

View File

@ -267,10 +267,12 @@ static void getEstimatedAttitude(void)
accMag = accMag * 100 / ((int32_t)acc_1G * acc_1G); accMag = accMag * 100 / ((int32_t)acc_1G * acc_1G);
rotateV(&EstG.V, deltaGyroAngle); rotateV(&EstG.V, deltaGyroAngle);
if (sensors(SENSOR_MAG)) if (sensors(SENSOR_MAG)) {
rotateV(&EstM.V, deltaGyroAngle); rotateV(&EstM.V, deltaGyroAngle);
else } else {
rotateV(&EstN.V, deltaGyroAngle); rotateV(&EstN.V, deltaGyroAngle);
normalizeV(&EstN.V, &EstN.V);
}
// Apply complimentary filter (Gyro drift correction) // Apply complimentary filter (Gyro drift correction)
// If accel magnitude >1.15G or <0.85G and ACC vector outside of the limit range => we neutralize the effect of accelerometers in the angle estimation. // If accel magnitude >1.15G or <0.85G and ACC vector outside of the limit range => we neutralize the effect of accelerometers in the angle estimation.