1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

filterekf: changed mag variance to 1/1000000 to compensate for normalization, as it was done on old AHRS

This commit is contained in:
Corvus Corax 2013-05-25 23:06:30 +02:00
parent 7bf58f09c5
commit e82a52e8ff

View File

@ -233,9 +233,10 @@ static int32_t filter(stateFilter *self, stateEstimation *state)
if (this->init_stage == 0) { if (this->init_stage == 0) {
// Reset the INS algorithm // Reset the INS algorithm
INSGPSInit(); INSGPSInit();
INSSetMagVar((float[3]) { this->ekfConfiguration.R[EKFCONFIGURATION_R_MAGX], // variance is measured in mGaus, but internally the EKF works with a normalized vector. Scaling factor from old AHRS code (1000*1000)
this->ekfConfiguration.R[EKFCONFIGURATION_R_MAGY], INSSetMagVar((float[3]) { this->ekfConfiguration.R[EKFCONFIGURATION_R_MAGX] / 1e6f,
this->ekfConfiguration.R[EKFCONFIGURATION_R_MAGZ] } this->ekfConfiguration.R[EKFCONFIGURATION_R_MAGY] / 1e6f,
this->ekfConfiguration.R[EKFCONFIGURATION_R_MAGZ] / 1e6f }
); );
INSSetAccelVar((float[3]) { this->ekfConfiguration.Q[EKFCONFIGURATION_Q_ACCELX], INSSetAccelVar((float[3]) { this->ekfConfiguration.Q[EKFCONFIGURATION_Q_ACCELX],
this->ekfConfiguration.Q[EKFCONFIGURATION_Q_ACCELY], this->ekfConfiguration.Q[EKFCONFIGURATION_Q_ACCELY],