Closed adrianmiriuta closed 6 years ago
i think it needs to be be like this:
#ifndef USE_GYRO_IMUF9001
quaternion vError = VECTOR_INITIALIZE;
quaternion vGyroAverage;
quaternion vAccAverage;
gyroGetAverage(&vGyroAverage);
accGetAverage(&vAccAverage);
DEBUG_SET(DEBUG_IMU, DEBUG_IMU_VACCMODULUS, lrintf((quaternionModulus(&vAccAverage)/ acc.dev.acc_1G) * 1000));
if (accIsHealthy(&vAccAverage)) {
applyAccError(&vAccAverage, &vError);
}
applySensorCorrection(&vError);
imuMahonyAHRSupdate(deltaT * 1e-6f, &vGyroAverage, &vError);
#else
UNUSED(deltaT);
UNUSED(applyAccError);
UNUSED(imuMahonyAHRSupdate);
qAttitude.w = imufQuat.w;
qAttitude.x = imufQuat.x;
qAttitude.y = imufQuat.y;
qAttitude.z = imufQuat.z;
applySensorCorrection(&qAttitude);
quaternionComputeProducts(&qAttitude, &qpAttitude);
#endif
imuUpdateEulerAngles();
because the quaternionComputeProducts call is made within the imuMahonyAHRSupdate function when calculating ACC. if we put it before the imuUpdateEulerAngles it would end up getting called twice, no?
Thank you @adrianmiriuta! I combined this into #118
Included in #118 - Thanks @adrianmiriuta !
@orneryd yes this is better !
HELIOSPRING attitude correction (compute quaternion helper products) fix #116 HEADADJ (hope , cannot test).