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(avoidance): unexpected road shoulder distance calculation result #6911

Merged
merged 2 commits into from May 16, 2024

Conversation

satoshi-ota
Copy link
Contributor

@satoshi-ota satoshi-ota commented May 1, 2024

Description

TIER IV INTERNAL LINK

Related PR: #6781

The module searches most overhanging point by following steps:

  1. pick a point from envelope polygon contour (P1).
  2. create new point from P1 by using calcOffsetPose (P2).
  3. search intersection point between P1-P2 and drivable bound.
  4. calculate distance between intersection point and P1.
  5. apply step1~4 for all polygon points.
  6. sort point by distance calculated in step4.
  7. pick the point whose distance is smallest from sorted points as most overhanging point.
const auto p2 = calcOffsetPose(p_tmp, 0.0, (isOnRight(object) ? -1.0 : 1.0), 0.0).position;

Previously, the point (P2) is calculated with constant offset value. However, I found sometimes it couldn't find intersection point for some polygon points when the distance between P1 and drivable bound was larger than 1.0m.

In following case, it couldn't find intersection point for bottom left/right points on white polygon. As a result, it got wrong point as the most overhanging point and created infeasible path.

Screenshot from 2024-05-01 13-28-31

In this PR, I fixed the logic for step2 to decide offset value based on polygon width so that it always can find intersection point for all polygon points.

const auto envelope_polygon_width =
        boost::geometry::area(object.envelope_poly) / object.length;

      {
        const auto p2 =
          calcOffsetPose(p_tmp, 0.0, (isOnRight(object) ? -0.5 : 0.5) * envelope_polygon_width, 0.0)
            .position;
...

Tests performed

Overhang distance is calculated expectedly. And it doesn't create infeasible path.

image

Effects on system behavior

Nothing.

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.

@satoshi-ota satoshi-ota marked this pull request as draft May 1, 2024 05:09
@github-actions github-actions bot added the component:planning Route planning, decision-making, and navigation. (auto-assigned) label May 1, 2024
@satoshi-ota satoshi-ota marked this pull request as ready for review May 7, 2024 01:49
Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
Copy link
Contributor

@shmpwk shmpwk left a comment

Choose a reason for hiding this comment

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

LGTM

@shmpwk shmpwk added the tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label May 16, 2024
@shmpwk shmpwk enabled auto-merge (squash) May 16, 2024 09:15
@shmpwk shmpwk merged commit 8265f93 into autowarefoundation:main May 16, 2024
31 of 33 checks passed
@shmpwk shmpwk deleted the fix/margin-calculation branch May 16, 2024 10:14
satoshi-ota added a commit to tier4/autoware.universe that referenced this pull request May 20, 2024
…utowarefoundation#6911)

* fix(avoidance): unexpected road shoulder distance calculation result

Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>

* fix(avoidance): prevent division by zero

Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>

---------

Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
satoshi-ota added a commit to tier4/autoware.universe that referenced this pull request May 23, 2024
…utowarefoundation#6911)

* fix(avoidance): unexpected road shoulder distance calculation result

Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>

* fix(avoidance): prevent division by zero

Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>

---------

Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants