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

perf(goal_planner): faster path sorting and selection #8457

Merged
merged 2 commits into from
Aug 21, 2024

Conversation

kosuke55
Copy link
Contributor

@kosuke55 kosuke55 commented Aug 13, 2024

Description

Before:
We had done a collision check using footprints for all candidate paths and gave higher priority to those with larger margins.
Then, for those with high priority, we again checked the hard margin and confirmed that sufficient distance had been secured.

After:
For candidate paths, check whether the goal is safe and sufficient distance is secured, and delete those that do not meet the requirements. Calculate rough margins for candidate routes and sort. The rough distance is the longest distance when the object and ego are rotated. (see #8464 for details)
After that, we check if hard margin can be secured for the sorted objects in order. Also, pull over paths take -5ms each to copy, so index is used whenever possible.

depends on


(internal)

before

image

after

image

Related links

Parent Issue:

  • Link

How was this PR tested?

 webauto ci scenario run --project-id prd_jt --scenario-id e02498d1-9832-4935-8c84-026d3ab8b5ab --scenario-version-id 9 --scenario-parameters '__tier4_modifier_ego_speed=11.1111,__tier4_modifier_npc_position=10.75,__tier4_modifier_processing_time=100'

before

$ ros2 run autoware_debug_tools processing_time_visualizer
⏰ Worst Case Execution Time ⏰
updateData: 6.19 [ms]

plan: 72.93 [ms]
    └── planPullOver: 72.92 [ms]
        ├── hasDecidedPath: 0.00 [ms]
        │   └── checkDecidingPathStatus: 0.00 [ms]
        └── planPullOverAsCandidate: 72.92 [ms]
            ├── planPullOverAsOutput: 60.86 [ms]
            │   ├── hasNotDecidedPath: 0.01 [ms]
            │   │   └── checkDecidingPathStatus: 0.00 [ms]
            │   ├── sortPullOverPathCandidatesByGoalPriority: 29.89 [ms]
            │   ├── selectPullOverPath: 0.13 [ms]
            │   ├── decelerateBeforeSearchStart: 0.08 [ms]
            │   ├── setOutput: 0.77 [ms]
            │   │   ├── isSafePath: 0.45 [ms]
            │   │   ├── setDrivableAreaInfo: 0.06 [ms]
            │   │   │   └── generateDrivableLanes: 0.03 [ms]
            │   │   └── hasDecidedPath: 0.21 [ms]
            │   │       └── checkDecidingPathStatus: 0.20 [ms]
            │   │           └── isSafePath: 0.20 [ms]
            │   ├── setDebugData: 0.72 [ms]
            │   │   └── hasDecidedPath: 0.19 [ms]
            │   │       └── checkDecidingPathStatus: 0.19 [ms]
            │   │           └── isSafePath: 0.19 [ms]
            │   └── updatePreviousData: 0.39 [ms]
            │       ├── checkDecidingPathStatus: 0.20 [ms]
            │       │   └── isSafePath: 0.20 [ms]
            │       └── isSafePath: 0.19 [ms]
            ├── generateStopPath: 2.98 [ms]
            │   ├── decelerateForTurnSignal: 2.41 [ms]
            │   └── decelerateBeforeSearchStart: 0.03 [ms]
            ├── generateDrivableLanes: 0.04 [ms]
            └── setDebugData: 0.58 [ms]
                └── hasDecidedPath: 0.23 [ms]
                    └── checkDecidingPathStatus: 0.23 [ms]
                        └── isSafePath: 0.23 [ms]

postProcess: 1.23 [ms]
    ├── calcDistanceToPathChange: 0.05 [ms]
    ├── hasDecidedPath: 1.02 [ms]
    │   └── checkDecidingPathStatus: 1.02 [ms]
    │       ├── isSafePath: 0.41 [ms]
    │       └── isSafePath: 0.49 [ms]
    └── calcTurnSignalInfo: 0.11 [ms]

after (worst case)

image

path priority

image

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

@kosuke55 kosuke55 marked this pull request as draft August 13, 2024 13:15
@github-actions github-actions bot added type:documentation Creating or refining documentation. (auto-assigned) component:planning Route planning, decision-making, and navigation. (auto-assigned) labels Aug 13, 2024
Copy link

github-actions bot commented Aug 13, 2024

Thank you for contributing to the Autoware project!

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

Please ensure:

@kosuke55 kosuke55 force-pushed the perf/goal_planner branch 2 times, most recently from 67212f8 to 4b17e6d Compare August 14, 2024 07:02
@kosuke55 kosuke55 added the tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Aug 14, 2024
Copy link

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 0% with 82 lines in your changes missing coverage. Please review.

Project coverage is 23.87%. Comparing base (df530c2) to head (b7dbcb6).
Report is 9 commits behind head on main.

Files Patch % Lines
...th_goal_planner_module/src/goal_planner_module.cpp 0.00% 64 Missing ⚠️
...are_behavior_path_goal_planner_module/src/util.cpp 0.00% 18 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8457      +/-   ##
==========================================
- Coverage   23.88%   23.87%   -0.02%     
==========================================
  Files        1381     1387       +6     
  Lines      101993   102039      +46     
  Branches    38852    38852              
==========================================
  Hits        24357    24357              
- Misses      75207    75253      +46     
  Partials     2429     2429              
Flag Coverage Δ *Carryforward flag
differential 15.06% <0.00%> (?)
total 23.90% <ø> (+0.01%) ⬆️ Carriedforward from df530c2

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

@kosuke55 kosuke55 changed the title Perf/goal planner perf(goal_planner): faster path sorting and selection Aug 14, 2024
@kosuke55 kosuke55 force-pushed the perf/goal_planner branch 3 times, most recently from a2e0a03 to 5630d91 Compare August 20, 2024 04:14
@kosuke55 kosuke55 marked this pull request as ready for review August 20, 2024 04:15
@kosuke55
Copy link
Contributor Author

@soblin
I rebased on main so this PR is ready for review.

std::vector<double> margins_with_zero = margins;
margins_with_zero.push_back(0.0);
return std::make_tuple(margins, margins_with_zero);
});

// Create a map of PullOverPath pointer to largest collision check margin
std::map<size_t, double> path_id_to_margin_map;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you rename path_id_to_margin_map to path_id_to_rough_margin_map ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that is better!
fixed in 9b43e03

@kosuke55 kosuke55 merged commit 7c0bbab into autowarefoundation:main Aug 21, 2024
27 of 30 checks passed
@kosuke55 kosuke55 deleted the perf/goal_planner branch August 21, 2024 03:43
kyoichi-sugahara pushed a commit to kyoichi-sugahara/autoware.universe that referenced this pull request Aug 27, 2024
…tion#8457)

* perf(goal_planner): faster path sorting and selection

Signed-off-by: kosuke55 <[email protected]>

* path_id_to_rough_margin_map

Signed-off-by: kosuke55 <[email protected]>

---------

Signed-off-by: kosuke55 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:planning Route planning, decision-making, and navigation. (auto-assigned) tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) type:documentation Creating or refining documentation. (auto-assigned)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants