Skip to content

Commit

Permalink
feat(ekf_localizer): check zero division (#1687)
Browse files Browse the repository at this point in the history
feat: check zero division

Signed-off-by: TetsuKawa <[email protected]>
  • Loading branch information
TetsuKawa authored Dec 6, 2024
1 parent 4569640 commit 90001d7
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ class Simple1DFilter
dev_ = dev_ + proc_dev_x_d;

// Update step
double kalman_gain = dev_ / (dev_ + obs_dev);
double kalman_gain = 1.0;
if (dev_ + obs_dev != 0) {
kalman_gain = dev_ / (dev_ + obs_dev);
}
x_ = x_ + kalman_gain * (obs - x_);
dev_ = (1 - kalman_gain) * dev_;

Expand Down

0 comments on commit 90001d7

Please sign in to comment.