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

fix(lane_departure_checker): fix trajectory resampling logic to keep given interval #10221

Conversation

kyoichi-sugahara
Copy link
Contributor

@kyoichi-sugahara kyoichi-sugahara commented Mar 4, 2025

Description

Fixed a bug in the resampleTrajectory function where the prev_point was being updated even when a trajectory point was not added to the resampled trajectory. This caused incorrect distance calculations and potentially led to trajectory points being improperly filtered.

Related links

Private Links:

How was this PR tested?

  • run planning simulator

green point: resampled points

behavior before the change:

2025-03-04_11.33.10.mp4

behvior after the change:

2025-03-04_11.34.51.mp4
  • add unit test to detect bug in the original implementation

original code fails as follows

1: [ RUN      ] LaneDepartureCheckerTest/ResampleTrajectoryTest.test_resample_trajectory/ConsecutiveSmallDistancesFollowedByLargeDistance
1: /home/kyoichi-sugahara/workspace/pilot-auto/src/autoware/universe/control/autoware_lane_departure_checker/test/test_resample_trajectory.cpp:67: Failure
1: Expected equality of these values:
1:   resampled.size()
1:     Which is: 2
1:   p.expected_points.size()
1:     Which is: 3
1: [  FAILED  ] LaneDepartureCheckerTest/ResampleTrajectoryTest.test_resample_trajectory/ConsecutiveSmallDistancesFollowedByLargeDistance, where GetParam() = ConsecutiveSmallDistancesFollowedByLargeDistance (0 ms)

updated code succeed as follows

1: [ RUN      ] LaneDepartureCheckerTest/ResampleTrajectoryTest.test_resample_trajectory/ConsecutiveSmallDistancesFollowedByLargeDistance
1: [       OK ] LaneDepartureCheckerTest/ResampleTrajectoryTest.test_resample_trajectory/ConsecutiveSmallDistancesFollowedByLargeDistance (0 ms)

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

…given interval

Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp>
…tances followed by large distance

Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp>
@github-actions github-actions bot added the component:control Vehicle control algorithms and mechanisms. (auto-assigned) label Mar 4, 2025
Copy link

github-actions bot commented Mar 4, 2025

Thank you for contributing to the Autoware project!

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

Please ensure:

@kyoichi-sugahara kyoichi-sugahara added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Mar 4, 2025
Copy link

codecov bot commented Mar 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 26.40%. Comparing base (337f0ac) to head (9562288).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10221   +/-   ##
=======================================
  Coverage   26.40%   26.40%           
=======================================
  Files        1390     1390           
  Lines      107718   107719    +1     
  Branches    41501    41496    -5     
=======================================
+ Hits        28442    28445    +3     
+ Misses      76440    76439    -1     
+ Partials     2836     2835    -1     
Flag Coverage Δ *Carryforward flag
differential 29.88% <ø> (?)
total 26.40% <ø> (+<0.01%) ⬆️ Carriedforward from 337f0ac

*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.

Copy link
Contributor

@zulfaqar-azmi-t4 zulfaqar-azmi-t4 left a comment

Choose a reason for hiding this comment

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

LGTM! checked with with rosbag that was collected on 2025-02-07.

@kyoichi-sugahara kyoichi-sugahara merged commit 6ef2396 into autowarefoundation:main Mar 4, 2025
47 of 48 checks passed
@kyoichi-sugahara kyoichi-sugahara deleted the fix/lane_departure/resampling_trajectory branch March 4, 2025 05:08
TomohitoAndo pushed a commit to tier4/autoware.universe that referenced this pull request Mar 4, 2025
…given interval (autowarefoundation#10221)

* fix(lane_departure_checker): fix trajectory resampling logic to keep given interval

Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp>

* test(lane_departure_checker): add test case for consecutive small distances followed by large distance

Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp>

---------

Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:control Vehicle control algorithms and mechanisms. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants