Skip to content

Commit f0ddfc5

Browse files
committed
bug: fixed state_.timestamp in estimator. Controller was reading non-initialized memory
1 parent ea0c9c4 commit f0ddfc5

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/controller.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ void Controller::run()
118118
int32_t dt_us = (RF_.estimator_.state().timestamp_us - prev_time_us_);
119119
if (dt_us < 0) {
120120
RF_.state_manager_.set_error(StateManager::ERROR_TIME_GOING_BACKWARDS);
121+
prev_time_us_ = RF_.estimator_.state().timestamp_us;
121122
return;
122123
}
123124
prev_time_us_ = RF_.estimator_.state().timestamp_us;

src/estimator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ void Estimator::run()
130130
last_time_ = now_us;
131131
last_acc_update_us_ = now_us;
132132
last_extatt_update_us_ = now_us;
133+
state_.timestamp_us = now_us;
133134
return;
134135
} else if (now_us < last_time_) {
135136
// this shouldn't happen

0 commit comments

Comments
 (0)