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(velocity_smoother): use ProxQP for faster optimization #8028

Merged

Conversation

takayuki5168
Copy link
Contributor

@takayuki5168 takayuki5168 commented Jul 13, 2024

Description

Use ProxQP instead of OSQPfor the velocity optimization.
Enabling warm start makes several scenarios fail due to the optimization failure as follows, so the warm start is disabled.
https://evaluation.tier4.jp/evaluation/reports/76156fc6-7529-5edf-b8f8-de8589118b37?project_id=prd_jt

Related links

How was this PR tested?

scenario test: https://evaluation.tier4.jp/evaluation/reports/6b10df3c-2ef3-5b69-9955-aee37d8b6c2b?project_id=prd_jt

psim
Before (with OSQP) (with warm start)

⏰ Worst Case Execution Time ⏰
onCurrentTrajectory: 56.20 [ms]
    ├── calcExternalVelocityLimit: 0.00 [ms]
    ├── updateDataForExternalVelocityLimit: 0.01 [ms]
    └── calcTrajectoryVelocity: 55.86 [ms]
        ├── applyExternalVelocityLimit: 0.01 [ms]
        ├── applyStopApproachingVelocity: 0.00 [ms]
        └── smoothVelocity: 55.84 [ms]
            ├── calcInitialMotion: 0.00 [ms]
            ├── applyLateralAccelerationFilter: 1.16 [ms]
            ├── applySteeringRateLimit: 0.13 [ms]
            ├── resampleTrajectory: 3.61 [ms]
            ├── apply: 50.68 [ms]
            │   ├── forwardJerkFilter: 0.12 [ms]
            │   ├── backwardJerkFilter: 0.22 [ms]
            │   │   └── forwardJerkFilter: 0.18 [ms]
            │   ├── mergeFilteredTrajectory: 0.02 [ms]
            │   ├── resample: 0.74 [ms]
            │   ├── resample: 0.61 [ms]
            │   ├── resample: 0.63 [ms]
            │   ├── resample: 0.62 [ms]
            │   ├── initOptimization: 0.45 [ms]
            │   └── optimize: 47.12 [ms]
            ├── overwriteStopPoint: 0.03 [ms]
            └── insertBehindVelocity: 0.15 [ms]

After with OSQP (with warm start)

⏰ Worst Case Execution Time ⏰
onCurrentTrajectory: 35.54 [ms]
    ├── calcExternalVelocityLimit: 0.00 [ms]
    ├── updateDataForExternalVelocityLimit: 0.01 [ms]
    └── calcTrajectoryVelocity: 35.27 [ms]
        ├── applyExternalVelocityLimit: 0.01 [ms]
        ├── applyStopApproachingVelocity: 0.00 [ms]
        └── smoothVelocity: 35.23 [ms]
            ├── calcInitialMotion: 0.00 [ms]
            ├── applyLateralAccelerationFilter: 1.13 [ms]
            ├── applySteeringRateLimit: 0.18 [ms]
            ├── resampleTrajectory: 3.26 [ms]
            ├── apply: 30.32 [ms]
            │   ├── forwardJerkFilter: 0.16 [ms]
            │   ├── backwardJerkFilter: 0.19 [ms]
            │   │   └── forwardJerkFilter: 0.15 [ms]
            │   ├── mergeFilteredTrajectory: 0.03 [ms]
            │   ├── resample: 1.79 [ms]
            │   ├── resample: 0.87 [ms]
            │   ├── resample: 0.71 [ms]
            │   ├── resample: 0.71 [ms]
            │   ├── initOptimization: 0.22 [ms]
            │   └── optimize: 25.49 [ms]
            ├── overwriteStopPoint: 0.03 [ms]
            └── insertBehindVelocity: 0.14 [ms]

After with ProxQP (without warm start)

⏰ Worst Case Execution Time ⏰
onCurrentTrajectory: 34.26 [ms]
    ├── calcExternalVelocityLimit: 0.00 [ms]
    ├── updateDataForExternalVelocityLimit: 0.01 [ms]
    └── calcTrajectoryVelocity: 33.88 [ms]
        ├── applyExternalVelocityLimit: 0.01 [ms]
        ├── applyStopApproachingVelocity: 0.00 [ms]
        └── smoothVelocity: 33.83 [ms]
            ├── calcInitialMotion: 0.00 [ms]
            ├── applyLateralAccelerationFilter: 2.26 [ms]
            ├── applySteeringRateLimit: 0.32 [ms]
            ├── resampleTrajectory: 12.33 [ms]
            ├── apply: 18.60 [ms]
            │   ├── forwardJerkFilter: 0.21 [ms]
            │   ├── backwardJerkFilter: 0.36 [ms]
            │   │   └── forwardJerkFilter: 0.31 [ms]
            │   ├── mergeFilteredTrajectory: 0.04 [ms]
            │   ├── resample: 1.60 [ms]
            │   ├── resample: 1.20 [ms]
            │   ├── resample: 1.29 [ms]
            │   ├── resample: 1.33 [ms]
            │   ├── initOptimization: 0.44 [ms]
            │   └── optimize: 11.99 [ms]
            ├── overwriteStopPoint: 0.07 [ms]
            └── insertBehindVelocity: 0.12 [ms]

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

@github-actions github-actions bot added component:planning Route planning, decision-making, and navigation. (auto-assigned) component:common Common packages from the autoware-common repository. (auto-assigned) labels Jul 13, 2024
Copy link

github-actions bot commented Jul 13, 2024

Thank you for contributing to the Autoware project!

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

Please ensure:

@takayuki5168 takayuki5168 changed the title perf(qp_interface, velocity_smoother): refactor qp_interface and use it in velocity_smoother. perf(velocity_smoother): use ProxQP for faster optimization Jul 13, 2024
@takayuki5168 takayuki5168 force-pushed the perf/velocity-smoother-with-proxqp branch 2 times, most recently from 627e122 to f9c6238 Compare July 13, 2024 05:58
@github-actions github-actions bot removed the component:common Common packages from the autoware-common repository. (auto-assigned) label Jul 13, 2024
@takayuki5168 takayuki5168 added the tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Jul 13, 2024
@takayuki5168 takayuki5168 marked this pull request as ready for review July 13, 2024 05:58
Copy link

codecov bot commented Jul 13, 2024

Codecov Report

Attention: Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.

Project coverage is 29.11%. Comparing base (5093495) to head (b9ece7f).
Report is 13 commits behind head on main.

Files Patch % Lines
...y_smoother/src/smoother/jerk_filtered_smoother.cpp 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8028      +/-   ##
==========================================
- Coverage   29.24%   29.11%   -0.13%     
==========================================
  Files        1600     1605       +5     
  Lines      117738   117823      +85     
  Branches    50720    50699      -21     
==========================================
- Hits        34427    34308     -119     
- Misses      74120    74333     +213     
+ Partials     9191     9182       -9     
Flag Coverage Δ *Carryforward flag
differential 18.83% <88.23%> (?)
total 29.17% <ø> (-0.07%) ⬇️ Carriedforward from 5093495

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

@takayuki5168 takayuki5168 force-pushed the perf/velocity-smoother-with-proxqp branch from f9c6238 to 6fd2c38 Compare July 17, 2024 04:05
@github-actions github-actions bot added the component:common Common packages from the autoware-common repository. (auto-assigned) label Jul 17, 2024
@takayuki5168 takayuki5168 force-pushed the perf/velocity-smoother-with-proxqp branch from 02d97c6 to 769d8f8 Compare July 17, 2024 10:55
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.

Is it okay to only do the change for the jerk filtered smoother ?
What about the L_2 and L_inf pseudo jerk smoother ?

@takayuki5168
Copy link
Contributor Author

@maxime-clem
Thank you for the comment.

First of all, it's a bit hard to check whether the behavior won't change with this change.
JerkFiltered can be tested in the simulation/experiment and widely used in TIER IV's projects, so we can easily check it. But for the L2 and Linf, since there is no baseline and the algorithms are not so used, I kept the algorithms as they are.

@takayuki5168 takayuki5168 marked this pull request as draft July 29, 2024 14:02
Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
@takayuki5168 takayuki5168 force-pushed the perf/velocity-smoother-with-proxqp branch from 769d8f8 to d14bb37 Compare July 29, 2024 14:59
Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
@takayuki5168 takayuki5168 marked this pull request as ready for review July 30, 2024 04:39
Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
@takayuki5168 takayuki5168 merged commit 36771de into autowarefoundation:main Jul 30, 2024
30 checks passed
@takayuki5168 takayuki5168 deleted the perf/velocity-smoother-with-proxqp branch July 30, 2024 06:59
takayuki5168 added a commit to tier4/autoware.universe that referenced this pull request Aug 8, 2024
…foundation#8028)

* perf(velocity_smoother): use ProxQP for faster optimization

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>

* consider max_iteration

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>

* disable warm start

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>

* fix test

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>

---------

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
esteve pushed a commit to esteve/autoware.universe that referenced this pull request Aug 13, 2024
…foundation#8028)

* perf(velocity_smoother): use ProxQP for faster optimization

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>

* consider max_iteration

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>

* disable warm start

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>

* fix test

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>

---------

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
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) tag: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