diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-06-29 12:05:27 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-06-29 12:05:27 +0200 |
commit | ccdfb19a4ac7c83643a013e3acf11ff745bd975f (patch) | |
tree | 2c0021a5a282bb2f49fc1e66aa6a08aeba4f374a | |
parent | b64c64d5a3d71a085b603e6f86dfe785a03c6129 (diff) | |
download | px4-firmware-ccdfb19a4ac7c83643a013e3acf11ff745bd975f.tar.gz px4-firmware-ccdfb19a4ac7c83643a013e3acf11ff745bd975f.tar.bz2 px4-firmware-ccdfb19a4ac7c83643a013e3acf11ff745bd975f.zip |
estimator: Fix double promotion warnings by appropriate constants / casts.
-rw-r--r-- | src/modules/ekf_att_pos_estimator/estimator_23states.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/modules/ekf_att_pos_estimator/estimator_23states.cpp b/src/modules/ekf_att_pos_estimator/estimator_23states.cpp index 8c30521e3..7a34c82f9 100644 --- a/src/modules/ekf_att_pos_estimator/estimator_23states.cpp +++ b/src/modules/ekf_att_pos_estimator/estimator_23states.cpp @@ -1103,7 +1103,7 @@ void AttPosEKF::FuseVelposNED() // Calculate the Kalman Gain // Calculate innovation variances - also used for data logging varInnovVelPos[obsIndex] = P[stateIndex][stateIndex] + R_OBS[obsIndex]; - SK = 1.0/varInnovVelPos[obsIndex]; + SK = 1.0/(double)varInnovVelPos[obsIndex]; for (uint8_t i= 0; i<=indexLimit; i++) { Kfusion[i] = P[i][stateIndex]*SK; @@ -1413,7 +1413,7 @@ void AttPosEKF::FuseMagnetometer() } // Check the innovation for consistency and don't fuse if > 5Sigma - if ((innovMag[obsIndex]*innovMag[obsIndex]/varInnovMag[obsIndex]) < 25.0) + if ((innovMag[obsIndex]*innovMag[obsIndex]/varInnovMag[obsIndex]) < 25.0f) { // correct the state vector for (uint8_t j= 0; j < indexLimit; j++) @@ -2130,7 +2130,7 @@ bool AttPosEKF::GyroOffsetsDiverged() // Protect against division by zero if (delta_len > 0.0f) { float cov_mag = ConstrainFloat((P[10][10] + P[11][11] + P[12][12]), 1e-12f, 1e-8f); - delta_len_scaled = (5e-7 / cov_mag) * delta_len / dtIMU; + delta_len_scaled = (5e-7 / (double)cov_mag) * (double)delta_len / (double)dtIMU; } bool diverged = (delta_len_scaled > 1.0f); |