Skip to content

Commit

Permalink
added check for large dt when using event.last_real
Browse files Browse the repository at this point in the history
  • Loading branch information
kratkvit committed Apr 23, 2024
1 parent ec738c5 commit 347f523
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/estimators/altitude/alt_generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ void AltGeneric::timerUpdate(const ros::TimerEvent &event) {
}

double dt = (event.current_real - event.last_real).toSec();
if (dt <= 0.0) {
if (dt <= 0.0 || dt > 1.0) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/estimators/heading/hdg_generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void HdgGeneric::timerUpdate(const ros::TimerEvent &event) {
}

double dt = (event.current_real - event.last_real).toSec();
if (dt <= 0.0) {
if (dt <= 0.0 || dt > 1.0) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/estimators/lateral/lat_generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ void LatGeneric::timerUpdate(const ros::TimerEvent &event) {

// obtain dt for state prediction
double dt = (event.current_real - event.last_real).toSec();
if (dt <= 0.0) { // sometimes the timer ticks twice simultaneously in simulation - we ignore the second tick
if (dt <= 0.0 || dt > 1.0) { // sometimes the timer ticks twice simultaneously in simulation - we ignore the second tick, in case of stopping and starting the timer, the last_real is 0
return;
}

Expand Down

0 comments on commit 347f523

Please sign in to comment.