Skip to content
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

feat(autoware_motion_utils): set zero velocity after stop in resample trajectory #8768

Merged

Conversation

yhisaki
Copy link
Contributor

@yhisaki yhisaki commented Sep 5, 2024

Description

This PR modifies the resampling of longitudinal_velocity_mps.

The algorithm has been updated to handle data points with embedded zero values differently. For example, when interpolating a sequence like [10, 10, 10, 0, 10, 0, 0, 0], the new algorithm will first transform the data to [10, 10, 10, 0, 0, 0, 0, 0] by setting all values after the first zero point to zero. Interpolation is then performed on this modified sequence.

Motivation for the Change:

When interpolating sequences like [10, 10, 10, 0, 10, 0, 0, 0] using zero-order hold, there were cases where the middle zero point was ignored due to the parameters of the zero-order hold. This resulted in interpolations like [10, 10, 10, 10, 10, 0, 0, 0], where the middle point that should have been zero was not.

This issue led to a bug in this ticket, where points that should have been zero were not being set to zero as expected. The proposed change aims to address this problem by ensuring that all values after the first detected zero point are set to zero before interpolation.

Related links

How was this PR tested?

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

@github-actions github-actions bot added the component:common Common packages from the autoware-common repository. (auto-assigned) label Sep 5, 2024
Copy link

github-actions bot commented Sep 5, 2024

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@yhisaki yhisaki marked this pull request as ready for review September 5, 2024 08:50
@yhisaki yhisaki added the tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Sep 5, 2024
Comment on lines 621 to 625
if (stop_point_found_in_v_lon) {
v_lon.push_back(0.0);
} else {
v_lon.push_back(curr_pt.longitudinal_velocity_mps);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment on the reason why this implementation is required.
Also, can you create a unit test for this time's bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added test and comment!

… trajectory

Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>
Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>
Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>
@yhisaki yhisaki force-pushed the set-zero-velocity-after-stop-awf branch from 9c046bf to 0795a05 Compare September 6, 2024 05:15
Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>
Copy link

codecov bot commented Sep 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 24.93%. Comparing base (301e36b) to head (fb0c560).
Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8768      +/-   ##
==========================================
- Coverage   25.02%   24.93%   -0.10%     
==========================================
  Files        1322     1325       +3     
  Lines       98047    98423     +376     
  Branches    37795    37885      +90     
==========================================
+ Hits        24536    24540       +4     
- Misses      71020    71392     +372     
  Partials     2491     2491              
Flag Coverage Δ *Carryforward flag
differential 25.93% <100.00%> (?)
total 25.02% <ø> (+<0.01%) ⬆️ Carriedforward from 301e36b

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yhisaki yhisaki merged commit 1a8fbc4 into autowarefoundation:main Sep 6, 2024
33 of 34 checks passed
Autumn60 pushed a commit to tier4/autoware.universe that referenced this pull request Sep 8, 2024
… trajectory (autowarefoundation#8768)

* feat(autoware_motion_utils): set zero velocity after stop in resample trajectory

Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>

* fix unit test

Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>

* simplify implementation

Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>

* update comment and add test

Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>

---------

Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>
(cherry picked from commit 1a8fbc4)
Autumn60 added a commit to tier4/autoware.universe that referenced this pull request Sep 8, 2024
… trajectory (autowarefoundation#8768)

* feat(autoware_motion_utils): set zero velocity after stop in resample trajectory

Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>

* fix unit test

Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>

* simplify implementation

Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>

* update comment and add test

Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>

---------

Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>
Signed-off-by: Autumn60 <harada.akiro@gmail.com>
Autumn60 added a commit to tier4/autoware.universe that referenced this pull request Sep 9, 2024
… trajectory (#1522)

feat(autoware_motion_utils): set zero velocity after stop in resample trajectory (autowarefoundation#8768)

* feat(autoware_motion_utils): set zero velocity after stop in resample trajectory



* fix unit test



* simplify implementation



* update comment and add test



---------

Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>
Signed-off-by: Autumn60 <harada.akiro@gmail.com>
emuemuJP pushed a commit to arayabrain/autoware.universe.origin that referenced this pull request Sep 10, 2024
… trajectory (autowarefoundation#8768)

* feat(autoware_motion_utils): set zero velocity after stop in resample trajectory

Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>

* fix unit test

Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>

* simplify implementation

Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>

* update comment and add test

Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>

---------

Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>
Signed-off-by: emuemuJP <k.matsumoto.0807@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:common Common packages from the autoware-common repository. (auto-assigned) tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants