Skip to content

Commit 9146293

Browse files
committed
AP_NavEKF3: use scalar rather than array for state-prediction-allowed
EKF2 needs this for choosing alternate cores. EKF3 does not.
1 parent e4f4868 commit 9146293

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

libraries/AP_NavEKF3/AP_NavEKF3.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -819,19 +819,17 @@ void NavEKF3::UpdateFilter(void)
819819

820820
imuSampleTime_us = AP::dal().micros64();
821821

822-
bool statePredictEnabled[num_cores];
823822
for (uint8_t i=0; i<num_cores; i++) {
824823
// if we have not overrun by more than 3 IMU frames, and we
825824
// have already used more than 1/3 of the CPU budget for this
826825
// loop then suppress the prediction step. This allows
827826
// multiple EKF instances to cooperate on scheduling
827+
bool allow_state_prediction = true;
828828
if (core[i].getFramesSincePredict() < (_framesPerPrediction+3) &&
829829
AP::dal().ekf_low_time_remaining(AP_DAL::EKFType::EKF3, i)) {
830-
statePredictEnabled[i] = false;
831-
} else {
832-
statePredictEnabled[i] = true;
830+
allow_state_prediction = false;
833831
}
834-
core[i].UpdateFilter(statePredictEnabled[i]);
832+
core[i].UpdateFilter(allow_state_prediction);
835833
}
836834

837835
// If the current core selected has a bad error score or is unhealthy, switch to a healthy core with the lowest fault score

0 commit comments

Comments
 (0)