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

refactor(start_planner): remove redundant calculation in shift pull out #8623

Merged
merged 2 commits into from
Aug 28, 2024

Conversation

go-sakayori
Copy link
Contributor

@go-sakayori go-sakayori commented Aug 26, 2024

Description

There was some redundant calculation in the ShiftPullOut::calcPullOutPaths. This PR removes the redundant calculation outside the for loop and decreases the calculation time. Below is an example of the processing time.

Before:

100.00% planWaitingApproval: total 110.06 [ms], avg. 7.34 [ms], run count: 15
    ├── 95.95% updatePullOutStatus: total 105.60 [ms], avg. 7.04 [ms], run count: 15
    │   ├── 0.12% calcBackwardPathFromStartPose: total 0.13 [ms], avg. 0.13 [ms], run count: 1
    │   ├── 0.10% searchPullOutStartPoseCandidates: total 0.11 [ms], avg. 0.11 [ms], run count: 1
    │   │   ├── 0.04% filterStopObjectsInPullOutLanes: total 0.04 [ms], avg. 0.02 [ms], run count: 2
    │   │   └── 0.06% rest: 0.06 [ms]
    │   ├── 95.66% planWithPriority: total 105.28 [ms], avg. 105.28 [ms], run count: 1
    │   │   ├── 0.00% determinePriorityOrder: total 0.00 [ms], avg. 0.00 [ms], run count: 1
    │   │   ├── 95.64% findPullOutPaths: total 105.26 [ms], avg. 105.26 [ms], run count: 1
    │   │   │   ├── 40.63% calcPullOutPaths: total 44.72 [ms], avg. 1.60 [ms], run count: 28
    │   │   │   ├── 37.59% get safe path: total 41.37 [ms], avg. 0.37 [ms], run count: 112
    │   │   │   │   ├── 27.04% checkPathWillLeaveLane: total 29.76 [ms], avg. 0.27 [ms], run count: 112
    │   │   │   │   │   ├── 23.64% getFusedLaneletPolygonForPath: total 26.01 [ms], avg. 0.23 [ms], run count: 112
    │   │   │   │   │   │   ├── 7.37% getLaneletsFromPath: total 8.11 [ms], avg. 0.07 [ms], run count: 112
    │   │   │   │   │   │   └── 16.27% rest: 17.90 [ms]
    │   │   │   │   │   └── 3.40% rest: 3.74 [ms]
    │   │   │   │   ├── 9.57% cropPointsOutsideOfLanes: total 10.54 [ms], avg. 0.66 [ms], run count: 16
    │   │   │   │   │   ├── 8.34% getFusedLaneletPolygonForPath: total 9.18 [ms], avg. 0.57 [ms], run count: 16
    │   │   │   │   │   │   ├── 2.28% getLaneletsFromPath: total 2.51 [ms], avg. 0.16 [ms], run count: 16
    │   │   │   │   │   │   └── 6.06% rest: 6.67 [ms]
    │   │   │   │   │   ├── 0.72% check if footprint is within fused_lanlets_polygon: total 0.79 [ms], avg. 0.05 [ms], run count: 16
    │   │   │   │   │   └── 0.52% rest: 0.57 [ms]
    │   │   │   │   └── 0.97% rest: 1.07 [ms]
    │   │   │   └── 17.42% rest: 19.18 [ms]
    │   │   └── 0.02% rest: 0.02 [ms]
    │   └── 0.08% rest: 0.09 [ms]
    ├── 0.05% isPreventingRearVehicleFromPassingThrough: total 0.06 [ms], avg. 0.06 [ms], run count: 1
    │   ├── 0.15% isPreventingRearVehicleFromPassingThrough: total 0.16 [ms], avg. 0.08 [ms], run count: 2
    │   └── -0.10% rest: -0.10 [ms]
    ├── 0.03% isSafePath: total 0.04 [ms], avg. 0.04 [ms], run count: 1
    └── 3.96% rest: 4.36 [ms]

After:

100.00% planWaitingApproval: total 105.15 [ms], avg. 4.04 [ms], run count: 26
    ├── 92.88% updatePullOutStatus: total 97.67 [ms], avg. 3.76 [ms], run count: 26
    │   ├── 0.18% calcBackwardPathFromStartPose: total 0.19 [ms], avg. 0.19 [ms], run count: 1
    │   ├── 0.17% searchPullOutStartPoseCandidates: total 0.17 [ms], avg. 0.17 [ms], run count: 1
    │   │   ├── 0.07% filterStopObjectsInPullOutLanes: total 0.07 [ms], avg. 0.04 [ms], run count: 2
    │   │   └── 0.10% rest: 0.10 [ms]
    │   ├── 92.39% planWithPriority: total 97.16 [ms], avg. 97.16 [ms], run count: 1
    │   │   ├── 0.00% determinePriorityOrder: total 0.00 [ms], avg. 0.00 [ms], run count: 1
    │   │   ├── 92.36% findPullOutPaths: total 97.12 [ms], avg. 97.12 [ms], run count: 1
    │   │   │   ├── 33.84% calcPullOutPaths: total 35.58 [ms], avg. 1.27 [ms], run count: 28
    │   │   │   ├── 38.55% get safe path: total 40.54 [ms], avg. 0.36 [ms], run count: 112
    │   │   │   │   ├── 27.80% checkPathWillLeaveLane: total 29.23 [ms], avg. 0.26 [ms], run count: 112
    │   │   │   │   │   ├── 24.41% getFusedLaneletPolygonForPath: total 25.67 [ms], avg. 0.23 [ms], run count: 112
    │   │   │   │   │   │   ├── 6.89% getLaneletsFromPath: total 7.24 [ms], avg. 0.06 [ms], run count: 112
    │   │   │   │   │   │   └── 17.53% rest: 18.43 [ms]
    │   │   │   │   │   └── 3.39% rest: 3.56 [ms]
    │   │   │   │   ├── 9.79% cropPointsOutsideOfLanes: total 10.29 [ms], avg. 0.64 [ms], run count: 16
    │   │   │   │   │   ├── 8.65% getFusedLaneletPolygonForPath: total 9.09 [ms], avg. 0.57 [ms], run count: 16
    │   │   │   │   │   │   ├── 2.43% getLaneletsFromPath: total 2.56 [ms], avg. 0.16 [ms], run count: 16
    │   │   │   │   │   │   └── 6.21% rest: 6.53 [ms]
    │   │   │   │   │   ├── 0.66% check if footprint is within fused_lanlets_polygon: total 0.69 [ms], avg. 0.04 [ms], run count: 16
    │   │   │   │   │   └── 0.49% rest: 0.51 [ms]
    │   │   │   │   └── 0.97% rest: 1.02 [ms]
    │   │   │   └── 19.97% rest: 20.99 [ms]
    │   │   └── 0.04% rest: 0.04 [ms]
    │   └── 0.15% rest: 0.15 [ms]
    ├── 0.09% isPreventingRearVehicleFromPassingThrough: total 0.09 [ms], avg. 0.09 [ms], run count: 1
    │   ├── 0.20% isPreventingRearVehicleFromPassingThrough: total 0.21 [ms], avg. 0.10 [ms], run count: 2
    │   └── -0.11% rest: -0.11 [ms]
    ├── 0.05% isSafePath: total 0.06 [ms], avg. 0.06 [ms], run count: 1
    └── 6.97% rest: 7.33 [ms]

Related links

None

How was this PR tested?

TIER IV internal simulator

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

go-sakayori and others added 2 commits August 26, 2024 15:56
Signed-off-by: Go Sakayori <gsakayori@gmail.com>
Signed-off-by: Go Sakayori <go.sakayori@tier4.jp>
@github-actions github-actions bot added the component:planning Route planning, decision-making, and navigation. (auto-assigned) label Aug 26, 2024
Copy link

Thank you for contributing to the Autoware project!

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

Please ensure:

Copy link
Contributor

@kyoichi-sugahara kyoichi-sugahara left a comment

Choose a reason for hiding this comment

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

LGTM!

@go-sakayori go-sakayori added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Aug 28, 2024
Copy link

codecov bot commented Aug 28, 2024

Codecov Report

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

Project coverage is 24.09%. Comparing base (c80eddc) to head (6b75dbd).
Report is 36 commits behind head on main.

Files Patch % Lines
...r_path_start_planner_module/src/shift_pull_out.cpp 0.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8623      +/-   ##
==========================================
- Coverage   24.10%   24.09%   -0.02%     
==========================================
  Files        1399     1403       +4     
  Lines      102455   102502      +47     
  Branches    38921    38920       -1     
==========================================
  Hits        24695    24695              
- Misses      75235    75282      +47     
  Partials     2525     2525              
Flag Coverage Δ *Carryforward flag
differential 0.00% <0.00%> (?)
total 24.10% <ø> (+<0.01%) ⬆️ Carriedforward from c80eddc

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

@go-sakayori go-sakayori merged commit 75706db into autowarefoundation:main Aug 28, 2024
42 of 43 checks passed
@go-sakayori go-sakayori deleted the refactor/shift_pull_out branch August 28, 2024 07:53
a-maumau pushed a commit to a-maumau/autoware.universe that referenced this pull request Sep 2, 2024
…ut (autowarefoundation#8623)

* fix redundant calculation

Signed-off-by: Go Sakayori <gsakayori@gmail.com>

* fix unneccesary modification for comment

Signed-off-by: Go Sakayori <go.sakayori@tier4.jp>

---------

Signed-off-by: Go Sakayori <gsakayori@gmail.com>
Signed-off-by: Go Sakayori <go.sakayori@tier4.jp>
ktro2828 pushed a commit to ktro2828/autoware.universe that referenced this pull request Sep 18, 2024
…ut (autowarefoundation#8623)

* fix redundant calculation

Signed-off-by: Go Sakayori <gsakayori@gmail.com>

* fix unneccesary modification for comment

Signed-off-by: Go Sakayori <go.sakayori@tier4.jp>

---------

Signed-off-by: Go Sakayori <gsakayori@gmail.com>
Signed-off-by: Go Sakayori <go.sakayori@tier4.jp>
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) 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