-
Notifications
You must be signed in to change notification settings - Fork 682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ekf_localizer): correct the calculation of delay_step in updateMeasurementPose/Twist #5691
Merged
TaikiYamada4
merged 15 commits into
autowarefoundation:main
from
TaikiYamada4:fix/correct_ekf_delay_step
Dec 6, 2023
Merged
fix(ekf_localizer): correct the calculation of delay_step in updateMeasurementPose/Twist #5691
TaikiYamada4
merged 15 commits into
autowarefoundation:main
from
TaikiYamada4:fix/correct_ekf_delay_step
Dec 6, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… callback. Added find_closest_index function to easily use the X_delay_times_. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp>
…ap time of timer callback. The delay_step will be calculated from it, and the bug of calculating delay_step should be gone. Besides, removed dt in measurementUpdatePose/Twist since it is not needed. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp>
Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp>
Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp>
Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp>
Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp>
…autoware.universe into fix/correct_ekf_delay_step
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #5691 +/- ##
===========================================
+ Coverage 15.32% 44.10% +28.78%
===========================================
Files 1721 25 -1696
Lines 118559 993 -117566
Branches 37995 531 -37464
===========================================
- Hits 18169 438 -17731
+ Misses 79657 123 -79534
+ Partials 20733 432 -20301
☔ View full report in Codecov by Sentry. |
YamatoAndo
reviewed
Nov 28, 2023
YamatoAndo
reviewed
Nov 28, 2023
Added warnings when the ekf_dt_ is too large. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp>
I also added a feature to output a WARNING message, if the timer callback period ( |
…gest) value of accumulated_delay_times_ Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp>
…gest) value of accumulated_delay_times_ Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp>
YamatoAndo
approved these changes
Dec 6, 2023
danielsanchezaran
pushed a commit
to tier4/autoware.universe
that referenced
this pull request
Dec 15, 2023
…asurementPose/Twist (autowarefoundation#5691) * Added X_delay_times_ to obtain the accumulated lap times of the timer callback. Added find_closest_index function to easily use the X_delay_times_. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Added a concept/variable of accumulated_delay_time_ and store every lap time of timer callback. The delay_step will be calculated from it, and the bug of calculating delay_step should be gone. Besides, removed dt in measurementUpdatePose/Twist since it is not needed. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Fixed dt to ekf_dt_ in predictUpdateFrequency() Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Removed temporary debug stuff Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Fixed code style pointed out from pre-commit.ci Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Fixed typo Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Removed variable ekf_rate_ which is currently unused. Added warnings when the ekf_dt_ is too large. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Changed threshold of delay time so that to look the most last (or largest) value of accumulated_delay_times_ Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Correct the warning messages of diag_info to look up the last (or largest) value of accumulated_delay_times_ Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix --------- Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
karishma1911
pushed a commit
to Interplai/autoware.universe
that referenced
this pull request
Dec 19, 2023
…asurementPose/Twist (autowarefoundation#5691) * Added X_delay_times_ to obtain the accumulated lap times of the timer callback. Added find_closest_index function to easily use the X_delay_times_. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Added a concept/variable of accumulated_delay_time_ and store every lap time of timer callback. The delay_step will be calculated from it, and the bug of calculating delay_step should be gone. Besides, removed dt in measurementUpdatePose/Twist since it is not needed. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Fixed dt to ekf_dt_ in predictUpdateFrequency() Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Removed temporary debug stuff Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Fixed code style pointed out from pre-commit.ci Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Fixed typo Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Removed variable ekf_rate_ which is currently unused. Added warnings when the ekf_dt_ is too large. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Changed threshold of delay time so that to look the most last (or largest) value of accumulated_delay_times_ Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Correct the warning messages of diag_info to look up the last (or largest) value of accumulated_delay_times_ Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix --------- Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: karishma <karishma@interpl.ai>
karishma1911
pushed a commit
to Interplai/autoware.universe
that referenced
this pull request
Dec 19, 2023
…asurementPose/Twist (autowarefoundation#5691) * Added X_delay_times_ to obtain the accumulated lap times of the timer callback. Added find_closest_index function to easily use the X_delay_times_. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Added a concept/variable of accumulated_delay_time_ and store every lap time of timer callback. The delay_step will be calculated from it, and the bug of calculating delay_step should be gone. Besides, removed dt in measurementUpdatePose/Twist since it is not needed. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Fixed dt to ekf_dt_ in predictUpdateFrequency() Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Removed temporary debug stuff Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Fixed code style pointed out from pre-commit.ci Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Fixed typo Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Removed variable ekf_rate_ which is currently unused. Added warnings when the ekf_dt_ is too large. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Changed threshold of delay time so that to look the most last (or largest) value of accumulated_delay_times_ Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Correct the warning messages of diag_info to look up the last (or largest) value of accumulated_delay_times_ Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix --------- Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: karishma <karishma@interpl.ai>
karishma1911
pushed a commit
to Interplai/autoware.universe
that referenced
this pull request
May 26, 2024
…asurementPose/Twist (autowarefoundation#5691) * Added X_delay_times_ to obtain the accumulated lap times of the timer callback. Added find_closest_index function to easily use the X_delay_times_. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Added a concept/variable of accumulated_delay_time_ and store every lap time of timer callback. The delay_step will be calculated from it, and the bug of calculating delay_step should be gone. Besides, removed dt in measurementUpdatePose/Twist since it is not needed. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Fixed dt to ekf_dt_ in predictUpdateFrequency() Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Removed temporary debug stuff Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Fixed code style pointed out from pre-commit.ci Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Fixed typo Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Removed variable ekf_rate_ which is currently unused. Added warnings when the ekf_dt_ is too large. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Changed threshold of delay time so that to look the most last (or largest) value of accumulated_delay_times_ Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Correct the warning messages of diag_info to look up the last (or largest) value of accumulated_delay_times_ Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix --------- Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
karishma1911
pushed a commit
to Interplai/autoware.universe
that referenced
this pull request
May 28, 2024
…asurementPose/Twist (autowarefoundation#5691) * Added X_delay_times_ to obtain the accumulated lap times of the timer callback. Added find_closest_index function to easily use the X_delay_times_. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Added a concept/variable of accumulated_delay_time_ and store every lap time of timer callback. The delay_step will be calculated from it, and the bug of calculating delay_step should be gone. Besides, removed dt in measurementUpdatePose/Twist since it is not needed. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Fixed dt to ekf_dt_ in predictUpdateFrequency() Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Removed temporary debug stuff Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Fixed code style pointed out from pre-commit.ci Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Fixed typo Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Removed variable ekf_rate_ which is currently unused. Added warnings when the ekf_dt_ is too large. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Changed threshold of delay time so that to look the most last (or largest) value of accumulated_delay_times_ Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Correct the warning messages of diag_info to look up the last (or largest) value of accumulated_delay_times_ Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix --------- Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
karishma1911
pushed a commit
to Interplai/autoware.universe
that referenced
this pull request
May 28, 2024
…asurementPose/Twist (autowarefoundation#5691) * Added X_delay_times_ to obtain the accumulated lap times of the timer callback. Added find_closest_index function to easily use the X_delay_times_. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Added a concept/variable of accumulated_delay_time_ and store every lap time of timer callback. The delay_step will be calculated from it, and the bug of calculating delay_step should be gone. Besides, removed dt in measurementUpdatePose/Twist since it is not needed. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Fixed dt to ekf_dt_ in predictUpdateFrequency() Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Removed temporary debug stuff Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Fixed code style pointed out from pre-commit.ci Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Fixed typo Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Removed variable ekf_rate_ which is currently unused. Added warnings when the ekf_dt_ is too large. Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Changed threshold of delay time so that to look the most last (or largest) value of accumulated_delay_times_ Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Correct the warning messages of diag_info to look up the last (or largest) value of accumulated_delay_times_ Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix --------- Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
component:localization
Vehicle's position determination in its environment. (auto-assigned)
run:build-and-test-differential
Mark to enable build-and-test-differential workflow. (used-by-ci)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In the
measurementUpdatePose()
andmeasurementUpdateTwist()
of ekf_module.cpp, a variabledelay_step
, which is used for extracting previous states in the EKF, have been computed by the following.Currently, the devisor
dt
is the measured lap time of the timer_callback, but since ekf_localizer is a single thread node, the lap time of the timer callback may be different than expected. Generally, the lap time gets once longer when other callbacks provoke, and then gets shorter to catch up. This results to incorrect extracting of previous states. Thanks to the damping strategy in the EKF, this bug hasn't been exposed as a critical outcome, but yet it should be solved.To solve this, I added a variable to accumulated_delay_times_ to store the time how long the previous states in the EKF are old.
With this, we can search the state index that has the closest delay time to that of the measurement, which is the correct
delay_step
we want.(Added on 2023/12/04)
I also added a feature to output a WARNING message, if the timer callback period (
ekf_dt_
) gets too long for some reason.Related links
To debug these commits, I locally made a debug commit by my self.
https://github.com/TaikiYamada4/autoware.universe/tree/feat/debug_y_ekf_with_accumulated_delay_time
The PR below has the same objective, but since this PR's approach is more simple than the previous one, I'd rather like to merge this PR and the previous PR should be closed if so.
#5587
Tests performed
These changes have been tested through the rosbag replay simulation in the tutorial.
Plus, I have monitored the first element of variable
y_ekf
inmeasurementUpdatePose()
which suffers from the mentioned bug. This is monitored in the same rosbag replay simulation.(Extracting values of y_ekf is not included in this PR and done by my local branch)
Despite this value should behave in a continuous manner, there are spikes due to the bug mentioned here (Upper figure).
After applying the changes in this PR, they will disappear (Lower figure).
Notes for reviewers
Interface changes
None
Effects on system behavior
The predicted observation in the EKF should not look up to wrong previous states.
However, since the smoothing strategy in the EKF have been relieving the effects of the bug, it hardly makes any changes to the outputs in a macro manner.
Maybe this bug fix benefits the system when the timer callback in the ekf_localizer is unstable.
Pre-review checklist for the PR author
The PR author must check the checkboxes below when creating the PR.
In-review checklist for the PR reviewers
The PR reviewers must check the checkboxes below before approval.
Post-review checklist for the PR author
The PR author must check the checkboxes below before merging.
After all checkboxes are checked, anyone who has write access can merge the PR.