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

feat(interpolation): add curvature calculation #2801

Merged

Conversation

takayuki5168
Copy link
Contributor

@takayuki5168 takayuki5168 commented Feb 2, 2023

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

Description

updated interpolation package for the refactoring PR of obstacle_avoidance_planner #2796

feat: Curvature calculation is added with a unit test.

  • for point

    double SplineInterpolationPoints2d::getSplineInterpolatedCurvature(
    const size_t idx, const double s) const
    {
    if (base_s_vec_.size() <= idx) {
    throw std::out_of_range("idx is out of range.");
    }
    const double whole_s =
    std::clamp(base_s_vec_.at(idx) + s, base_s_vec_.front(), base_s_vec_.back());
    const double diff_x = spline_x_.getSplineInterpolatedDiffValues({whole_s}).at(0);
    const double diff_y = spline_y_.getSplineInterpolatedDiffValues({whole_s}).at(0);
    const double quad_diff_x = spline_x_.getSplineInterpolatedQuadDiffValues({whole_s}).at(0);
    const double quad_diff_y = spline_y_.getSplineInterpolatedQuadDiffValues({whole_s}).at(0);
    return std::abs(diff_x * quad_diff_y - quad_diff_x * diff_y) /
    std::pow(std::pow(diff_x, 2) + std::pow(diff_y, 2), 1.5);
    }

  • for points

    std::vector<double> SplineInterpolationPoints2d::getSplineInterpolatedCurvatures() const
    {
    std::vector<double> curvature_vec;
    for (size_t i = 0; i < spline_x_.getSize(); ++i) {
    const double curvature = getSplineInterpolatedCurvature(i, 0.0);
    curvature_vec.push_back(curvature);
    }
    return curvature_vec;
    }

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.

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
@github-actions github-actions bot added the component:common Common packages from the autoware-common repository. (auto-assigned) label Feb 2, 2023
Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
@github-actions github-actions bot added the component:planning Route planning, decision-making, and navigation. (auto-assigned) label Feb 2, 2023
Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
@takayuki5168 takayuki5168 marked this pull request as ready for review February 2, 2023 10:10
@takayuki5168 takayuki5168 requested review from kosuke55, a team and rej55 as code owners February 2, 2023 10:10
@takayuki5168
Copy link
Contributor Author

@rej55 @kosuke55 Could you approve the PR. I confirmed that the unit test for curvature calculation has passed.

Copy link
Contributor

@rej55 rej55 left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Feb 2, 2023

Codecov Report

Base: 12.40% // Head: 11.82% // Decreases project coverage by -0.59% ⚠️

Coverage data is based on head (0eb1fed) compared to base (231f70c).
Patch coverage: 28.48% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2801      +/-   ##
==========================================
- Coverage   12.40%   11.82%   -0.59%     
==========================================
  Files        1217     1318     +101     
  Lines       86070    92214    +6144     
  Branches    24382    24680     +298     
==========================================
+ Hits        10677    10903     +226     
- Misses      64242    70030    +5788     
- Partials    11151    11281     +130     
Flag Coverage Δ *Carryforward flag
differential 12.85% <23.44%> (?)
total 11.63% <54.54%> (-0.78%) ⬇️ Carriedforward from 00338f4

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
...terpolation/test/src/test_spline_interpolation.cpp 38.75% <0.00%> (+10.38%) ⬆️
...n/test/src/test_spline_interpolation_points_2d.cpp 19.35% <19.35%> (ø)
...terpolation/src/spline_interpolation_points_2d.cpp 45.00% <35.41%> (-0.72%) ⬇️
...ion/include/interpolation/spline_interpolation.hpp 41.66% <50.00%> (+13.09%) ⬆️
...g/obstacle_avoidance_planner/src/mpt_optimizer.cpp 44.13% <50.00%> (+0.58%) ⬆️
common/interpolation/src/spline_interpolation.cpp 64.10% <66.66%> (+6.95%) ⬆️
...e/interpolation/spline_interpolation_points_2d.hpp 88.88% <100.00%> (+5.55%) ⬆️
...freespace_planning_algorithms/src/astar_search.cpp 70.96% <0.00%> (ø)
...ude/freespace_planning_algorithms/astar_search.hpp 87.50% <0.00%> (ø)
..._vendor/_deps/tensorrt-src/samples/common/common.h 0.00% <0.00%> (ø)
... and 110 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
@takayuki5168 takayuki5168 merged commit 515e1b2 into autowarefoundation:main Feb 3, 2023
@takayuki5168 takayuki5168 deleted the feat/curvature-calculation branch February 3, 2023 01:33
asana17 pushed a commit to asana17/autoware.universe that referenced this pull request Feb 8, 2023
* feat(interpolation): add curvature calculation

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

* update

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

* fix

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

* add test

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

* fix

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

---------

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
mkuri pushed a commit to tier4/autoware.universe that referenced this pull request Feb 27, 2023
* feat(interpolation): add curvature calculation

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

* update

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

* fix

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

* add test

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

* fix

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

---------

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
kosuke55 pushed a commit to tier4/autoware.universe that referenced this pull request Mar 7, 2023
* feat(interpolation): add curvature calculation

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

* update

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

* fix

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

* add test

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

* fix

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

---------

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
mkuri added a commit to tier4/autoware.universe that referenced this pull request Mar 14, 2023
…ry (#309)

* feat(behavior_path_planner, obstacle_avoidance_planner): add new drivable area (autowarefoundation#2472)

* update

Signed-off-by: yutaka <purewater0901@gmail.com>

* update

Signed-off-by: yutaka <purewater0901@gmail.com>

* update

Signed-off-by: yutaka <purewater0901@gmail.com>

* update obstacle avoidance planner

Signed-off-by: yutaka <purewater0901@gmail.com>

* update

Signed-off-by: yutaka <purewater0901@gmail.com>

* clean code

Signed-off-by: yutaka <purewater0901@gmail.com>

* uddate

Signed-off-by: yutaka <purewater0901@gmail.com>

* clean code

Signed-off-by: yutaka <purewater0901@gmail.com>

* remove resample

Signed-off-by: yutaka <purewater0901@gmail.com>

* update

Signed-off-by: yutaka <purewater0901@gmail.com>

* add orientation

Signed-off-by: yutaka <purewater0901@gmail.com>

* change color

Signed-off-by: yutaka <purewater0901@gmail.com>

* update

Signed-off-by: yutaka <purewater0901@gmail.com>

* remove drivable area

Signed-off-by: yutaka <purewater0901@gmail.com>

* add flag

Signed-off-by: yutaka <purewater0901@gmail.com>

* update

Signed-off-by: yutaka <purewater0901@gmail.com>

* update color

Signed-off-by: yutaka <purewater0901@gmail.com>

* fix some codes

Signed-off-by: yutaka <purewater0901@gmail.com>

* change to makerker array

Signed-off-by: yutaka <purewater0901@gmail.com>

* change avoidance utils

Signed-off-by: yutaka <purewater0901@gmail.com>

Signed-off-by: yutaka <purewater0901@gmail.com>

* feat(motion_utils): add points resample function (autowarefoundation#2465)

Signed-off-by: yutaka <purewater0901@gmail.com>

Signed-off-by: yutaka <purewater0901@gmail.com>

* fix(motion_utils): rename sampling function (autowarefoundation#2469)

Signed-off-by: yutaka <purewater0901@gmail.com>

Signed-off-by: yutaka <purewater0901@gmail.com>

* fix(behavior_path_planner): fix a merge failure

Signed-off-by: Makoto Kurihara <mkuri8m@gmail.com>

* feat(interpolation): add curvature calculation (autowarefoundation#2801)

* feat(interpolation): add curvature calculation

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

* update

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

* fix

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

* add test

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

* fix

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

---------

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

* update obstacle avoidance planner, static centerline optimizer, tier4_planning_launch

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

* update velocity on joint and correct trajectory z

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

* ci(pre-commit): autofix

* fix(behavior_path_planner): backport drivable area for loop route (#310)

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

---------

Signed-off-by: yutaka <purewater0901@gmail.com>
Signed-off-by: Makoto Kurihara <mkuri8m@gmail.com>
Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
Co-authored-by: Yutaka Shimizu <43805014+purewater0901@users.noreply.github.com>
Co-authored-by: Takayuki Murooka <takayuki5168@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants