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

test(path_generator): add tests for path cut feature #268

Merged

Conversation

mitukou1109
Copy link
Contributor

@mitukou1109 mitukou1109 commented Mar 12, 2025

Description

This PR adds tests for the path cut feature of path_generator.
The tests will not pass until #336 is merged.

How was this PR tested?

colcon test --packages-select autoware_path_generator --event-handlers console_cohesion+

gives the following result (excerpt):

1: [----------] 11 tests from UtilsTest
1: [ RUN      ] UtilsTest.getPreviousLaneletWithinRoute
1: [       OK ] UtilsTest.getPreviousLaneletWithinRoute (27 ms)
1: [ RUN      ] UtilsTest.getNextLaneletWithinRoute
1: [       OK ] UtilsTest.getNextLaneletWithinRoute (25 ms)
1: [ RUN      ] UtilsTest.getLaneletsWithinRouteUpTo
1: [       OK ] UtilsTest.getLaneletsWithinRouteUpTo (26 ms)
1: [ RUN      ] UtilsTest.getLaneletsWithinRouteAfter
1: [       OK ] UtilsTest.getLaneletsWithinRouteAfter (23 ms)
1: [ RUN      ] UtilsTest.getLaneletsWithinRoute
1: [       OK ] UtilsTest.getLaneletsWithinRoute (23 ms)
1: [ RUN      ] UtilsTest.getTurnSignalRequiredEndPoint
1: [       OK ] UtilsTest.getTurnSignalRequiredEndPoint (24 ms)
1: [ RUN      ] UtilsTest.getFirstSelfIntersectionArcLength
1: [       OK ] UtilsTest.getFirstSelfIntersectionArcLength (24 ms)
1: [ RUN      ] UtilsTest.getPathBound
1: �[33m[WARN] [1743127895.081260980] [path_generator.utils.get_arc_length_on_bounds]: Input arc length is negative, returning 0.�[0m
1: �[33m[WARN] [1743127895.081325408] [path_generator.utils.crop_line_string]: Start of crop range is larger than end, returning input as is�[0m
1: �[33m[WARN] [1743127895.081332864] [path_generator.utils.crop_line_string]: Start of crop range is larger than end, returning input as is�[0m
1: [       OK ] UtilsTest.getPathBound (69 ms)
1: [ RUN      ] UtilsTest.cropLineString
1: �[33m[WARN] [1743127895.106494511] [path_generator.utils.crop_line_string]: Start of crop range is negative, returning input as is�[0m
1: �[33m[WARN] [1743127895.106515802] [path_generator.utils.crop_line_string]: Start of crop range is larger than end, returning input as is�[0m
1: [       OK ] UtilsTest.cropLineString (24 ms)
1: [ RUN      ] UtilsTest.GetArcLengthOnBounds
1: �[33m[WARN] [1743127895.130032776] [path_generator.utils.get_arc_length_on_bounds]: Input arc length is negative, returning 0.�[0m
1: [       OK ] UtilsTest.GetArcLengthOnBounds (24 ms)
1: [ RUN      ] UtilsTest.GetArcLengthOnCenterline
1: �[33m[WARN] [1743127895.153370219] [path_generator.utils.get_arc_length_on_centerline]: Input left arc length is negative, returning 0.�[0m
1: �[33m[WARN] [1743127895.153386377] [path_generator.utils.get_arc_length_on_centerline]: Input right arc length is negative, returning 0.�[0m
1: [       OK ] UtilsTest.GetArcLengthOnCenterline (23 ms)
1: [----------] 11 tests from UtilsTest (312 ms total)
1: 
1: [----------] 6 tests from GetTurnSignalTest
1: [ RUN      ] GetTurnSignalTest.getTurnSignal/EgoIsStoppingAndBeforeDesiredStartPoint
1: [       OK ] GetTurnSignalTest.getTurnSignal/EgoIsStoppingAndBeforeDesiredStartPoint (23 ms)
1: [ RUN      ] GetTurnSignalTest.getTurnSignal/EgoIsStoppingAndAheadOfDesiredStartPoint
1: [       OK ] GetTurnSignalTest.getTurnSignal/EgoIsStoppingAndAheadOfDesiredStartPoint (25 ms)
1: [ RUN      ] GetTurnSignalTest.getTurnSignal/EgoIsMovingAndAheadOfDesiredStartPoint
1: [       OK ] GetTurnSignalTest.getTurnSignal/EgoIsMovingAndAheadOfDesiredStartPoint (23 ms)
1: [ RUN      ] GetTurnSignalTest.getTurnSignal/EgoIsInRequiredSection
1: [       OK ] GetTurnSignalTest.getTurnSignal/EgoIsInRequiredSection (24 ms)
1: [ RUN      ] GetTurnSignalTest.getTurnSignal/EgoIsInDesiredSection
1: [       OK ] GetTurnSignalTest.getTurnSignal/EgoIsInDesiredSection (23 ms)
1: [ RUN      ] GetTurnSignalTest.getTurnSignal/EgoIsAheadOfDesiredEndPoint
1: [       OK ] GetTurnSignalTest.getTurnSignal/EgoIsAheadOfDesiredEndPoint (24 ms)
1: [----------] 6 tests from GetTurnSignalTest (142 ms total)
1: 
1: [----------] 7 tests from GetFirstIntersectionArcLengthTest
1: [ RUN      ] GetFirstIntersectionArcLengthTest.getFirstIntersectionArcLength/UTurnWithGap
1: [       OK ] GetFirstIntersectionArcLengthTest.getFirstIntersectionArcLength/UTurnWithGap (31 ms)
1: [ RUN      ] GetFirstIntersectionArcLengthTest.getFirstIntersectionArcLength/UTurnWithFullCrossing
1: [       OK ] GetFirstIntersectionArcLengthTest.getFirstIntersectionArcLength/UTurnWithFullCrossing (30 ms)
1: [ RUN      ] GetFirstIntersectionArcLengthTest.getFirstIntersectionArcLength/UTurnWithHalfCrossing
1: [       OK ] GetFirstIntersectionArcLengthTest.getFirstIntersectionArcLength/UTurnWithHalfCrossing (31 ms)
1: [ RUN      ] GetFirstIntersectionArcLengthTest.getFirstIntersectionArcLength/Overpass
1: [       OK ] GetFirstIntersectionArcLengthTest.getFirstIntersectionArcLength/Overpass (32 ms)
1: [ RUN      ] GetFirstIntersectionArcLengthTest.getFirstIntersectionArcLength/OverpassWithStartEdgeIntersection
1: [       OK ] GetFirstIntersectionArcLengthTest.getFirstIntersectionArcLength/OverpassWithStartEdgeIntersection (30 ms)
1: [ RUN      ] GetFirstIntersectionArcLengthTest.getFirstIntersectionArcLength/OverpassWithIntersectionBehind
1: [       OK ] GetFirstIntersectionArcLengthTest.getFirstIntersectionArcLength/OverpassWithIntersectionBehind (31 ms)
1: [ RUN      ] GetFirstIntersectionArcLengthTest.getFirstIntersectionArcLength/OverpassWithIntersectionAhead
1: [       OK ] GetFirstIntersectionArcLengthTest.getFirstIntersectionArcLength/OverpassWithIntersectionAhead (31 ms)
1: [----------] 7 tests from GetFirstIntersectionArcLengthTest (217 ms total)

The test cases are confirmed valid by the following visualization results:

  • get_first_intersection_arc_length @ u-turn with full crossing
    Screenshot from 2025-03-27 15-35-59

  • get_first_intersection_arc_length @ u-turn with half crossing
    Screenshot from 2025-03-27 15-39-03

  • get_first_intersection_arc_length @ overpass
    Screenshot from 2025-03-27 15-42-21

  • get_first_intersection_arc_length @ overpass, start edge intersection
    Screenshot from 2025-03-28 14-08-21

  • get_arc_length_on_bounds
    Screenshot from 2025-03-28 10-56-15

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

Copy link

github-actions bot commented Mar 12, 2025

Thank you for contributing to the Autoware project!

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

Please ensure:

@kosuke55
Copy link
Contributor

@mitukou1109 cc @soblin
Can you add new test map image to
https://github.com/autowarefoundation/autoware_core/tree/main/testing/autoware_test_utils ?

Copy link
Member

@youtalk youtalk left a comment

Choose a reason for hiding this comment

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

Generally, it’s better to separate tests and refactoring into different PRs. Atomic PR is king.

mitukou1109 and others added 11 commits April 3, 2025 11:53
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Co-authored-by: Kosuke Takeuchi <kosuke.tnp@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
@mitukou1109 mitukou1109 force-pushed the test/path_generator_path_cut branch from df9dbd4 to c3535f2 Compare April 3, 2025 04:04
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Copy link
Member

@youtalk youtalk left a comment

Choose a reason for hiding this comment

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

Only test additions. LGTM

@youtalk youtalk enabled auto-merge (squash) April 9, 2025 02:04
@youtalk youtalk added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Apr 9, 2025
@kosuke55
Copy link
Contributor

kosuke55 commented Apr 9, 2025

#336 was merged, I updated this branch but some CI failed.

@mitukou1109
Copy link
Contributor Author

There is an issue with autoware_trajectory, waiting for #365 to be merged.

@youtalk youtalk requested a review from kosuke55 April 10, 2025 08:04
@kosuke55
Copy link
Contributor

kosuke55 commented Apr 10, 2025

#365 is merged and thanks for updating branch, I'm waiting for ci result

@mitukou1109
Copy link
Contributor Author

autoware::trajectory::Trajectory::crop() now returns empty trajectory when the original one has 1 point. I will fix the corresponding test case so the test passes.

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
auto-merge was automatically disabled April 10, 2025 08:42

Head branch was pushed to by a user without write access

Copy link

codecov bot commented Apr 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.19%. Comparing base (4cb18f5) to head (20e3fca).
Report is 160 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #268       +/-   ##
===========================================
- Coverage   78.75%   29.19%   -49.57%     
===========================================
  Files          11      177      +166     
  Lines         193    11288    +11095     
  Branches       73     3818     +3745     
===========================================
+ Hits          152     3295     +3143     
- Misses         11     7540     +7529     
- Partials       30      453      +423     
Flag Coverage Δ
differential 29.19% <ø> (?)
total ?

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@kosuke55 kosuke55 left a comment

Choose a reason for hiding this comment

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

LGTM

@kosuke55 kosuke55 merged commit efe47a3 into autowarefoundation:main Apr 10, 2025
24 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

3 participants