aboutsummaryrefslogtreecommitdiff
path: root/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2014-06-04 10:31:23 +0200
committerLorenz Meier <lm@inf.ethz.ch>2014-06-04 10:31:23 +0200
commit5aef22310e0dbec9f758e4cf1df5ad93cbd989ad (patch)
treed1f24fe08d9d79161ebb9dc5fab9fbb3458e5942 /src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp
parent19154f29d822afdc0a33bf3be55fab63b32f23c5 (diff)
downloadpx4-firmware-5aef22310e0dbec9f758e4cf1df5ad93cbd989ad.tar.gz
px4-firmware-5aef22310e0dbec9f758e4cf1df5ad93cbd989ad.tar.bz2
px4-firmware-5aef22310e0dbec9f758e4cf1df5ad93cbd989ad.zip
Ensure states are actually copied in non-error mode
Diffstat (limited to 'src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp')
-rw-r--r--src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp
index 1e2582952..0fea362c5 100644
--- a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp
+++ b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp
@@ -1042,33 +1042,30 @@ FixedwingEstimator::task_main()
if (_ekf_logging || check) {
rep.timestamp = hrt_absolute_time();
- rep.nan_flags |= (((uint8_t)ekf_report.angNaN) << 0);
- rep.nan_flags |= (((uint8_t)ekf_report.summedDelVelNaN) << 1);
- rep.nan_flags |= (((uint8_t)ekf_report.KHNaN) << 2);
- rep.nan_flags |= (((uint8_t)ekf_report.KHPNaN) << 3);
- rep.nan_flags |= (((uint8_t)ekf_report.PNaN) << 4);
- rep.nan_flags |= (((uint8_t)ekf_report.covarianceNaN) << 5);
- rep.nan_flags |= (((uint8_t)ekf_report.kalmanGainsNaN) << 6);
- rep.nan_flags |= (((uint8_t)ekf_report.statesNaN) << 7);
-
- rep.health_flags |= (((uint8_t)ekf_report.velHealth) << 0);
- rep.health_flags |= (((uint8_t)ekf_report.posHealth) << 1);
- rep.health_flags |= (((uint8_t)ekf_report.hgtHealth) << 2);
-
- rep.timeout_flags |= (((uint8_t)ekf_report.velTimeout) << 0);
- rep.timeout_flags |= (((uint8_t)ekf_report.posTimeout) << 1);
- rep.timeout_flags |= (((uint8_t)ekf_report.hgtTimeout) << 2);
+ rep.nan_flags |= (((uint8_t)ekf_report.angNaN) << 0);
+ rep.nan_flags |= (((uint8_t)ekf_report.summedDelVelNaN) << 1);
+ rep.nan_flags |= (((uint8_t)ekf_report.KHNaN) << 2);
+ rep.nan_flags |= (((uint8_t)ekf_report.KHPNaN) << 3);
+ rep.nan_flags |= (((uint8_t)ekf_report.PNaN) << 4);
+ rep.nan_flags |= (((uint8_t)ekf_report.covarianceNaN) << 5);
+ rep.nan_flags |= (((uint8_t)ekf_report.kalmanGainsNaN) << 6);
+ rep.nan_flags |= (((uint8_t)ekf_report.statesNaN) << 7);
+
+ rep.health_flags |= (((uint8_t)ekf_report.velHealth) << 0);
+ rep.health_flags |= (((uint8_t)ekf_report.posHealth) << 1);
+ rep.health_flags |= (((uint8_t)ekf_report.hgtHealth) << 2);
+
+ rep.timeout_flags |= (((uint8_t)ekf_report.velTimeout) << 0);
+ rep.timeout_flags |= (((uint8_t)ekf_report.posTimeout) << 1);
+ rep.timeout_flags |= (((uint8_t)ekf_report.hgtTimeout) << 2);
// Copy all states or at least all that we can fit
- unsigned i = 0;
unsigned ekf_n_states = (sizeof(ekf_report.states) / sizeof(ekf_report.states[0]));
unsigned max_states = (sizeof(rep.states) / sizeof(rep.states[0]));
rep.n_states = (ekf_n_states < max_states) ? ekf_n_states : max_states;
- while ((i < ekf_n_states) && (i < max_states)) {
-
+ for (unsigned i = 0; i < rep.n_states; i++) {
rep.states[i] = ekf_report.states[i];
- i++;
}
if (_estimator_status_pub > 0) {