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(route_handler): route handler overlap removal is too conservative #7156

Conversation

mkquda
Copy link
Contributor

@mkquda mkquda commented May 29, 2024

Description

Currently, overlap handling is not great, in some corner cases, a broken route might be generated, like the one shown below.

Screenshot from 2024-05-17 14-19-00

This is happening because, in the function getLaneletSequenceUpTo, if at least one of the previous lanelets is same as the inut lanelet, then it is considered a loop and search will stop.

Screenshot from 2024-05-17 14-19-00 (copy)

Another issue is the logic used to get the closest lanelet within route does not respect the history of the lanelets traversed, it will just return the closest route lanelet satisfying the distance and yaw constraints, so the closest lanelet can jump suddenly in case of partially overlapping lanelets causing a break in the route, as shown below.

Screencast_2024-05-29_14-18-00.mp4

Changes

(route_handler)
Modified the loop check logic in function getLaneletSequenceUpTo():

  • If previous lanelets are route lanelets, then return true only if all prev lanelets are overlapping with input lanelet
  • If at least one prev lanelet is not overlapping with input lanelet then continue sequence search
  • If previous lanelets are not route lanelets and at least one overlaps with input lanelet then loop check returns true

Implemented new function getClosestRouteLaneletFromCurrent() to get closest route lanelet with respect the previous computed closest route lanelets to insure continuity.

(planner_manager)
Implemented separate function updateCurrentRouteLanelet() and moved logic out of getReferencePathFunction()
Use new function getClosestRouteLaneletFromCurrent() in updateCurrentRouteLanelet()

(behavior_path_planner_common/utils)
Modified function isEgoOutOfRoute() to take closestRoadLanelet as input from planner manager rather than recomputing same logic locally

(mission_planner)
Refactored DefaultPlanner::plan() function, should not affect logic.

Tests performed

  • Tested on psim
  • Confirmed no degradation using autoware evaluator

Effects on system behavior

Can generate proper route:
Screenshot from 2024-05-29 11-26-35

Closest route lanelet doesn't jump suddenly causing unexpected behavior:

Screencast_2024-05-29_12-01-13.mp4

Interface changes

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.

  • There are no open discussions or they are tracked via tickets.

After all checkboxes are checked, anyone who has write access can merge the PR.

@mkquda mkquda added the component:planning Route planning, decision-making, and navigation. (auto-assigned) label May 29, 2024
@mkquda mkquda linked an issue May 29, 2024 that may be closed by this pull request
3 tasks
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!

@zulfaqar-azmi-t4 zulfaqar-azmi-t4 added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Jun 7, 2024
Copy link

codecov bot commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 34.14634% with 81 lines in your changes missing coverage. Please review.

Project coverage is 14.65%. Comparing base (e24f48d) to head (9e36962).
Report is 136 commits behind head on main.

Current head 9e36962 differs from pull request most recent head ec1f99d

Please upload reports for the commit ec1f99d to get more accurate results.

Files Patch % Lines
planning/route_handler/test/test_route_handler.cpp 25.64% 0 Missing and 29 partials ⚠️
...e_behavior_path_planner_common/src/utils/utils.cpp 11.11% 17 Missing and 7 partials ⚠️
planning/route_handler/src/route_handler.cpp 48.48% 3 Missing and 14 partials ⚠️
planning/route_handler/test/test_route_handler.hpp 50.00% 0 Missing and 5 partials ⚠️
...ning/behavior_path_planner/src/planner_manager.cpp 66.66% 0 Missing and 4 partials ⚠️
...n_planner/src/lanelet2_plugins/default_planner.cpp 0.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7156      +/-   ##
==========================================
- Coverage   15.10%   14.65%   -0.45%     
==========================================
  Files        1922     2049     +127     
  Lines      134796   145844   +11048     
  Branches    43473    46635    +3162     
==========================================
+ Hits        20364    21379    +1015     
- Misses      91780   101076    +9296     
- Partials    22652    23389     +737     
Flag Coverage Δ *Carryforward flag
differential 14.98% <34.14%> (?)
total 14.88% <ø> (-0.22%) ⬇️ Carriedforward from e800d54

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

@mkquda mkquda force-pushed the RT1-6335-route-handler-overlap-removal-is-too-conservative branch from 752f27b to 14553d1 Compare June 10, 2024 01:00
Copy link
Contributor

@maxime-clem maxime-clem left a comment

Choose a reason for hiding this comment

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

Tested and it works well

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

@mkquda mkquda enabled auto-merge (squash) June 12, 2024 08:26
@mkquda mkquda disabled auto-merge June 12, 2024 08:26
Signed-off-by: mohammad alqudah <[email protected]>
@mkquda mkquda enabled auto-merge (squash) June 12, 2024 08:28
@mkquda mkquda disabled auto-merge June 13, 2024 00:52
@github-actions github-actions bot added the component:common Common packages from the autoware-common repository. (auto-assigned) label Jun 13, 2024
@mkquda mkquda merged commit c918ebf into autowarefoundation:main Jun 13, 2024
23 of 24 checks passed
@mkquda mkquda deleted the RT1-6335-route-handler-overlap-removal-is-too-conservative branch June 13, 2024 02:42
KhalilSelyan pushed a commit that referenced this pull request Jul 22, 2024
…#7156)

* add flag to enable/disable loop check in getLaneletSequence functions

Signed-off-by: mohammad alqudah <[email protected]>

* implement function to get closest route lanelet based on previous closest lanelet

Signed-off-by: mohammad alqudah <[email protected]>

* refactor DefaultPlanner::plan function

Signed-off-by: mohammad alqudah <[email protected]>

* modify loop check logic in getLaneletSequenceUpTo function

Signed-off-by: mohammad alqudah <[email protected]>

* improve logic in isEgoOutOfRoute function

Signed-off-by: mohammad alqudah <[email protected]>

* fix format

Signed-off-by: mohammad alqudah <[email protected]>

* check if prev lanelet is a goal lanelet in getLaneletSequenceUpTo function

Signed-off-by: mohammad alqudah <[email protected]>

* separate function to update current route lanelet in planner manager

Signed-off-by: mohammad alqudah <[email protected]>

* rename function and add docstring

Signed-off-by: mohammad alqudah <[email protected]>

* modify functions extendNextLane and extendPrevLane to account for overlap

Signed-off-by: mohammad alqudah <[email protected]>

* refactor function getClosestRouteLaneletFromLanelet

Signed-off-by: mohammad alqudah <[email protected]>

* add route handler unit tests for overlapping route case

Signed-off-by: mohammad alqudah <[email protected]>

* fix function getClosestRouteLaneletFromLanelet

Signed-off-by: mohammad alqudah <[email protected]>

* format fix

Signed-off-by: mohammad alqudah <[email protected]>

* move test map to autoware_test_utils

Signed-off-by: mohammad alqudah <[email protected]>

---------

Signed-off-by: mohammad alqudah <[email protected]>
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) component:planning Route planning, decision-making, and navigation. (auto-assigned) 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.

Can't generate proper route in some merging pattern
4 participants