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(goal_planner): use precise distance to objects for sorting candidate paths #10296

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kosuke55
Copy link
Contributor

@kosuke55 kosuke55 commented Mar 18, 2025

Description

Previously, we used calculateRoughDistanceToObjects to compute the maximum distance between the ego vehicle and surrounding objects when both were rotated. Based on this maximum distance, we selected a corresponding margin from the predefined collision_check_soft_margins list:

collision_check_soft_margins: [5.0, 4.5, 4.0, 3.5, 3.0, 2.5, 2.0, 1.5, 1.0]  # the maximum margin when ego and objects are oriented

This margin was then used to sort the paths by priority.

image

For CAR, this approach worked reasonably well — sorting by maximum rough distance closely matched the actual distance-based sorting. However, this method proved problematic for longer vehicles like the BUS, especially when their orientation was perpendicular to the ego path. In such cases, the difference between maximum rough distance and the actual minimum distance became significant, leading to incorrect classification. As a result, nearly all paths were evaluated as having margins over 5.0m, even if they were too close.

This PR introduces a new logic:

  1. Calculate rough distance:
  • If max_distance < hard_margin, the path is considered a guaranteed collision (margin = 0.0m).
  • If min_distance > max(soft_margins) (i.e., > 5.0m), the path is considered definitely safe (margin = 5.0m).
  1. Calculate accurate Distance:
  • For cases where the rough distance falls between these two thresholds, we now compute the accurate distance between ego and the object, taking into account the orientation and footprint. The result is then used to sort the paths more reliably.

This ensures more accurate path prioritization, especially for larger like BUS or differently-oriented vehicles.

waiting for evaluator (wip
2025/03/18 https://evaluation.tier4.jp/evaluation/reports/52d79305-944b-5c4d-a119-5fc41007a5e5/?project_id=prd_jt

will updae exmaple code too

Related links

Parent Issue:

How was this PR tested?

psim + reproducer

RT1-8880-2025-03-18_14.31.47.mp4

before : goal close to object is selected

image

evaluator:
https://evaluation.tier4.jp/evaluation/reports/3d1c6b77-e2e8-5ef8-b319-0298ded5b815?project_id=prd_jt&state=failed 3750/3752

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

Copy link

github-actions bot commented Mar 18, 2025

Thank you for contributing to the Autoware project!

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

Please ensure:

@kosuke55 kosuke55 added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Mar 18, 2025
@kosuke55 kosuke55 force-pushed the fix/rough_margin branch 4 times, most recently from 67fa145 to 8d50f35 Compare March 21, 2025 01:54
Copy link

codecov bot commented Mar 21, 2025

Codecov Report

Attention: Patch coverage is 6.66667% with 28 lines in your changes missing coverage. Please review.

Project coverage is 26.23%. Comparing base (63c5607) to head (5985164).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...mon/src/utils/path_safety_checker/safety_check.cpp 10.52% 17 Missing ⚠️
...th_goal_planner_module/src/goal_planner_module.cpp 0.00% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10296      +/-   ##
==========================================
+ Coverage   25.94%   26.23%   +0.28%     
==========================================
  Files        1383     1387       +4     
  Lines      106833   106882      +49     
  Branches    40912    40922      +10     
==========================================
+ Hits        27722    28037     +315     
+ Misses      76403    76146     -257     
+ Partials     2708     2699       -9     
Flag Coverage Δ *Carryforward flag
differential 26.28% <6.66%> (?)
total 25.94% <ø> (+<0.01%) ⬆️ Carriedforward from 63c5607

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kosuke55 kosuke55 force-pushed the fix/rough_margin branch 2 times, most recently from ceb6113 to 252a3a7 Compare March 21, 2025 04:49
…ate paths

Signed-off-by: kosuke55 <kosuke.tnp@gmail.com>
@@ -255,18 +255,20 @@ double calc_obstacle_max_length(const Shape & shape);
* @brief Calculate collision roughly by comparing minimum/maximum distance with margin.
* @param path The path of the ego vehicle.
* @param objects The predicted objects.
* @param margin Distance margin to judge collision.
* @param min_margin_threshold threshold for collision check when the minimum distance between ego
Copy link
Contributor

Choose a reason for hiding this comment

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

英語の文法を分かりやすくして下さい

"threshold for collision check when the minimum distance between ego"

@@ -877,6 +879,40 @@ double calculateRoughDistanceToObjects(
return min_distance;
}

double calculate_distance_to_objects_from_path(
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
double calculate_distance_to_objects_from_path(
double shortest_distance_from_ego_footprint_to_objects_on_path(

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
Status: To Triage
Development

Successfully merging this pull request may close these issues.

2 participants