prevent duplicate EKF logging

vehicle code sometimes tries to log the same data twice
This commit is contained in:
Andrew Tridgell 2020-11-06 11:02:55 +11:00
parent fa75824948
commit f3c3778169
4 changed files with 17 additions and 0 deletions

View File

@ -476,6 +476,9 @@ private:
// time at start of current filter update
uint64_t imuSampleTime_us;
// last time of Log_Write
uint64_t lastLogWrite_us;
struct {
uint32_t last_function_call; // last time getLastYawResetAngle was called

View File

@ -288,6 +288,12 @@ void NavEKF2::Log_Write()
return;
}
if (lastLogWrite_us == imuSampleTime_us) {
// vehicle is doubling up on logging
return;
}
lastLogWrite_us = imuSampleTime_us;
const uint64_t time_us = AP::dal().micros64();
// note that several of these functions exit-early if they're not

View File

@ -534,6 +534,9 @@ private:
// time of last lane switch
uint32_t lastLaneSwitch_ms;
// last time of Log_Write
uint64_t lastLogWrite_us;
struct {
uint32_t last_function_call; // last time getLastYawResetAngle was called
bool core_changed; // true when a core change happened and hasn't been consumed, false otherwise

View File

@ -352,6 +352,11 @@ void NavEKF3::Log_Write()
if (activeCores() <= 0) {
return;
}
if (lastLogWrite_us == imuSampleTime_us) {
// vehicle is doubling up on logging
return;
}
lastLogWrite_us = imuSampleTime_us;
uint64_t time_us = AP::dal().micros64();