Skip to content

feat(autoware_planning_evaluator): new obstacle metrics#11761

Merged
xtk8532704 merged 13 commits intoautowarefoundation:mainfrom
tier4:new-obstalce-metrics
Jan 16, 2026
Merged

feat(autoware_planning_evaluator): new obstacle metrics#11761
xtk8532704 merged 13 commits intoautowarefoundation:mainfrom
tier4:new-obstalce-metrics

Conversation

@xtk8532704
Copy link
Copy Markdown
Contributor

@xtk8532704 xtk8532704 commented Dec 10, 2025

Description

This PR refactors obstacle metrics implementations and adds 2 new metrics for safety checks.

Refactored metrics:

  • Obstacle Distance: The distance from the object's center point to the ego's future trajectory.
  • Time To Collision (TTC): Time to collision with the target object
    New metrics:
  • Post Encroaching Time (PET): Time difference between the target object leaving the overlap region and the ego entering the overlap region for potential collision targets
    • Targets that do not actually collide but whose future trajectories overlap with the ego's future trajectory.
    • An object cannot have both TTC and PET metrics simultaneously, because if the former exists, the latter is clearly zero.
  • Deceleration Rate to Avoid Collision (DRAC): The minimum deceleration required to avoid a collision with the target object.
    • This metric is published alongside TTC.

What has changed

  • All 4 obstacle metrics can now be published for each object, instead of being the worst value for all objects. You can use the worst_only parameter to control whether to publish them for each object.

before: {_metric_name_}/{min, max, mean}

- name: obstacle_ttc/min
  unit: ''
  value: '1.0'
...

after: {_metric_name_}/{_object_uuid_, worst}

--
- name: obstacle_ttc/ce8956bc2dc2ba8ab06ccae6d27d88fd
  unit: ''
  value: '3.1054147628049962'
- name: obstacle_ttc/worst
  unit: ''
  value: '3.1054147628049962'
...
  • parameter changes:
    • rename obstacle.dist_thr_m -> obstacle.collision_thr_m.

Related links

Parent Issue:

  • Link

Private Links (Japanese):

How was this PR tested?

Psim.
Unit Tests for 2 new metrics are added.

Notes for reviewers

You can check this doc first to understand the algorithm for the obstacle metrics.

If the code is hard to read, you can just play with Psim to check if the new metrics' behaviors work well.

Interface changes

None.

ROS Parameter Changes

Additions and removals

Change type Parameter Name Type Default Value Description
Added obstacle.worst_only bool false if true, only the worst obstacle metric value is published
Added obstacle.use_ego_traj_vel bool fals if true, the planned trajectory velocity is used
Added obstacle.stop_velocity_mps double 0.2777 [m/s] velocity threshold to consider the object or ego is static, used to speed up the calculation
Added obstacle.min_time_interval_s double 0.05 [s] minimum time interval between two successive points to use for ego trajectory resampling to speed up the calculation.
Added obstacle.min_spatial_interval_m double 0.1 [m] minimum spatial interval between two successive points to use for ego trajectory resampling to speed up the calculation.

Modifications

Version Parameter Name Type Default Value Description
Old obstacle.dist_thr_m double 0.0 distance threshold to consider a collision/overlapping occurs between object footprints and ego trajectory footprints
New obstacle.collision_thr_m double 0.0 distance threshold to consider a collision/overlapping occurs between object footprints and ego trajectory footprints

Effects on system behavior

The processing time for new planning_evaluator is < 30 ms under peak conditions, and typically < 3 ms if there are no complex trajectory overlaps between the ego and objects present. (verified using Psim; situation under real-world conditions cannot be guaranteed.)

@github-actions github-actions bot added type:documentation Creating or refining documentation. (auto-assigned) type:ci Continuous Integration (CI) processes and testing. (auto-assigned) component:evaluator Evaluation tools for planning, localization etc. (auto-assigned) labels Dec 10, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 10, 2025

Thank you for contributing to the Autoware project!

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

Please ensure:

@xtk8532704 xtk8532704 force-pushed the new-obstalce-metrics branch 2 times, most recently from f3f2bd9 to 213d030 Compare December 12, 2025 08:43
@github-actions github-actions bot removed the type:ci Continuous Integration (CI) processes and testing. (auto-assigned) label Dec 12, 2025
@xtk8532704 xtk8532704 changed the title feat(autoware_planning_evaluator): new obstalce metrics feat(autoware_planning_evaluator): new obstacle metrics Dec 12, 2025
@xtk8532704 xtk8532704 requested a review from kosuke55 December 12, 2025 10:12
@xtk8532704 xtk8532704 added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Dec 12, 2025
@xtk8532704 xtk8532704 marked this pull request as ready for review December 12, 2025 10:24
@xtk8532704
Copy link
Copy Markdown
Contributor Author

I'm fixing unit tests.

Signed-off-by: xtk8532704 <1041084556@qq.com>
Signed-off-by: xtk8532704 <1041084556@qq.com>
Signed-off-by: xtk8532704 <1041084556@qq.com>
Signed-off-by: xtk8532704 <1041084556@qq.com>
Signed-off-by: xtk8532704 <1041084556@qq.com>
Signed-off-by: xtk8532704 <1041084556@qq.com>
Signed-off-by: xtk8532704 <1041084556@qq.com>
Signed-off-by: xtk8532704 <1041084556@qq.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 16, 2025

Codecov Report

❌ Patch coverage is 86.18421% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.37%. Comparing base (f50b5c3) to head (175051c).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...ning_evaluator/src/obstacle_metrics_calculator.cpp 80.00% 18 Missing and 19 partials ⚠️
...planning_evaluator/src/planning_evaluator_node.cpp 92.85% 0 Missing and 3 partials ⚠️
...planning_evaluator/obstacle_metrics_calculator.hpp 93.93% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11761      +/-   ##
==========================================
+ Coverage   17.98%   18.37%   +0.38%     
==========================================
  Files        1812     1806       -6     
  Lines      125542   124965     -577     
  Branches    43666    43469     -197     
==========================================
+ Hits        22581    22959     +378     
+ Misses      84121    83394     -727     
+ Partials    18840    18612     -228     
Flag Coverage Δ *Carryforward flag
daily 20.39% <ø> (-0.08%) ⬇️ Carriedforward from 77ba0fd
daily-cuda 17.99% <ø> (+0.02%) ⬆️ Carriedforward from 77ba0fd
differential 43.87% <86.18%> (?)
total-cuda 18.07% <ø> (+0.09%) ⬆️ Carriedforward from 77ba0fd

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

Signed-off-by: xtk8532704 <1041084556@qq.com>

auto start = now();
// Calculate planning trajectory metrics
auto trajectory_start = now();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(minor)

Suggested change
auto trajectory_start = now();
const auto trajectory_start = now();

other parts too!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed at c9daa26

Comment thread evaluator/autoware_planning_evaluator/src/metrics/metrics_utils.cpp
}

void ObstacleMetricsCalculator::calculatePointToPolygonBoundaryDistances(
const Pose & pose, const Polygon2d & polygon, double & min_dist, double & max_dist) const
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

( minor: I prefer returning structs over passing them by reference)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed at c9daa26

{
ego_trajectory_points_.clear();
ego_max_reachable_distance_ = 0.0;
double vel_curr = ego_odometry_->twist.twist.linear.x;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(minor)

Suggested change
double vel_curr = ego_odometry_->twist.twist.linear.x;
const double vel_curr = ego_odometry_->twist.twist.linear.x;

other parts too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

vel_curr is changing during the algorithm loop

Comment on lines +391 to +411
// // Debug prints, uncomment to check trajectory points if needed
// std::cerr << "Obstacle traj" << std::endl;
// for (size_t i = 0; i < obstacle_trajectory_points_.size(); ++i) {
// const auto & p = obstacle_trajectory_points_[i];
// std::cerr << "[" << i << "] t: " << p.time_from_start_s << ", pos: (" << p.pose.position.x
// << ", "
// << p.pose.position.y << "), is_overlapping: " <<
// p.is_overlapping_with_ego_trajectory << ", is_collision: "
// << p.is_collision_with_ego_trajectory << ", first_overlapping_idx: " <<
// p.first_overlapping_ego_trajectory_index << ", last_overlapping_idx: " <<
// p.last_overlapping_ego_trajectory_index << std::endl;
// }
// std::cerr << "Ego traj" << std::endl;
// for (size_t i = 0; i < ego_trajectory_points_.size(); ++i) {
// const auto & p = ego_trajectory_points_[i];
// std::cerr << "[" << i << "] t: " << p.time_from_start_s << ", pos: (" << p.pose.position.x
// << ", "
// << p.pose.position.y << ")" << std::endl;
// }

// ------------------------------------------------------------------------------------------------
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// // Debug prints, uncomment to check trajectory points if needed
// std::cerr << "Obstacle traj" << std::endl;
// for (size_t i = 0; i < obstacle_trajectory_points_.size(); ++i) {
// const auto & p = obstacle_trajectory_points_[i];
// std::cerr << "[" << i << "] t: " << p.time_from_start_s << ", pos: (" << p.pose.position.x
// << ", "
// << p.pose.position.y << "), is_overlapping: " <<
// p.is_overlapping_with_ego_trajectory << ", is_collision: "
// << p.is_collision_with_ego_trajectory << ", first_overlapping_idx: " <<
// p.first_overlapping_ego_trajectory_index << ", last_overlapping_idx: " <<
// p.last_overlapping_ego_trajectory_index << std::endl;
// }
// std::cerr << "Ego traj" << std::endl;
// for (size_t i = 0; i < ego_trajectory_points_.size(); ++i) {
// const auto & p = ego_trajectory_points_[i];
// std::cerr << "[" << i << "] t: " << p.time_from_start_s << ", pos: (" << p.pose.position.x
// << ", "
// << p.pose.position.y << ")" << std::endl;
// }
// ------------------------------------------------------------------------------------------------

This part can be deleted?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed at c9daa26

Copy link
Copy Markdown
Contributor

@kosuke55 kosuke55 left a comment

Choose a reason for hiding this comment

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

I haven't checked the detail of logic but the diff seems good overall. Leaving some minor comments, but I'll approve it now as code owner

xtk8532704 and others added 2 commits January 7, 2026 18:06
Signed-off-by: xtk8532704 <1041084556@qq.com>
@xtk8532704 xtk8532704 enabled auto-merge (squash) January 7, 2026 09:11
xtk8532704 and others added 2 commits January 16, 2026 11:19
Signed-off-by: xtk8532704 <1041084556@qq.com>
@xtk8532704 xtk8532704 merged commit e02453d into autowarefoundation:main Jan 16, 2026
43 of 44 checks passed
@xtk8532704 xtk8532704 deleted the new-obstalce-metrics branch January 16, 2026 04:25
@github-project-automation github-project-automation bot moved this from To Triage to Done in Software Working Group Jan 16, 2026
xtk8532704 added a commit to tier4/autoware_universe that referenced this pull request Jan 16, 2026
…dation#11761)

* tmp save

Signed-off-by: xtk8532704 <1041084556@qq.com>

* remove some draft code

Signed-off-by: xtk8532704 <1041084556@qq.com>

* add new implements

Signed-off-by: xtk8532704 <1041084556@qq.com>

* polish code, need to update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* pre-commit

Signed-off-by: xtk8532704 <1041084556@qq.com>

* update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix cppcheck

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix unit test bug, and add test cases for ttc, drac.

Signed-off-by: xtk8532704 <1041084556@qq.com>

* cry to fix ci building error

Signed-off-by: xtk8532704 <1041084556@qq.com>

* refactor code

Signed-off-by: xtk8532704 <1041084556@qq.com>

---------

Signed-off-by: xtk8532704 <1041084556@qq.com>
xtk8532704 added a commit to tier4/autoware_universe that referenced this pull request Jan 16, 2026
…dation#11761)

* tmp save

Signed-off-by: xtk8532704 <1041084556@qq.com>

* remove some draft code

Signed-off-by: xtk8532704 <1041084556@qq.com>

* add new implements

Signed-off-by: xtk8532704 <1041084556@qq.com>

* polish code, need to update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* pre-commit

Signed-off-by: xtk8532704 <1041084556@qq.com>

* update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix cppcheck

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix unit test bug, and add test cases for ttc, drac.

Signed-off-by: xtk8532704 <1041084556@qq.com>

* cry to fix ci building error

Signed-off-by: xtk8532704 <1041084556@qq.com>

* refactor code

Signed-off-by: xtk8532704 <1041084556@qq.com>

---------

Signed-off-by: xtk8532704 <1041084556@qq.com>
xtk8532704 added a commit to tier4/autoware_universe that referenced this pull request Jan 16, 2026
…dation#11761)

* tmp save

Signed-off-by: xtk8532704 <1041084556@qq.com>

* remove some draft code

Signed-off-by: xtk8532704 <1041084556@qq.com>

* add new implements

Signed-off-by: xtk8532704 <1041084556@qq.com>

* polish code, need to update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* pre-commit

Signed-off-by: xtk8532704 <1041084556@qq.com>

* update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix cppcheck

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix unit test bug, and add test cases for ttc, drac.

Signed-off-by: xtk8532704 <1041084556@qq.com>

* cry to fix ci building error

Signed-off-by: xtk8532704 <1041084556@qq.com>

* refactor code

Signed-off-by: xtk8532704 <1041084556@qq.com>

---------

Signed-off-by: xtk8532704 <1041084556@qq.com>
Signed-off-by: Kem (TiankuiXian) <temkei.kem@tier4.jp>
simonranjith pushed a commit to simonranjith/autoware_universe that referenced this pull request Jan 16, 2026
…dation#11761)

* tmp save

Signed-off-by: xtk8532704 <1041084556@qq.com>

* remove some draft code

Signed-off-by: xtk8532704 <1041084556@qq.com>

* add new implements

Signed-off-by: xtk8532704 <1041084556@qq.com>

* polish code, need to update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* pre-commit

Signed-off-by: xtk8532704 <1041084556@qq.com>

* update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix cppcheck

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix unit test bug, and add test cases for ttc, drac.

Signed-off-by: xtk8532704 <1041084556@qq.com>

* cry to fix ci building error

Signed-off-by: xtk8532704 <1041084556@qq.com>

* refactor code

Signed-off-by: xtk8532704 <1041084556@qq.com>

---------

Signed-off-by: xtk8532704 <1041084556@qq.com>
simonranjith pushed a commit to simonranjith/autoware_universe that referenced this pull request Jan 17, 2026
…dation#11761)

* tmp save

Signed-off-by: xtk8532704 <1041084556@qq.com>

* remove some draft code

Signed-off-by: xtk8532704 <1041084556@qq.com>

* add new implements

Signed-off-by: xtk8532704 <1041084556@qq.com>

* polish code, need to update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* pre-commit

Signed-off-by: xtk8532704 <1041084556@qq.com>

* update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix cppcheck

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix unit test bug, and add test cases for ttc, drac.

Signed-off-by: xtk8532704 <1041084556@qq.com>

* cry to fix ci building error

Signed-off-by: xtk8532704 <1041084556@qq.com>

* refactor code

Signed-off-by: xtk8532704 <1041084556@qq.com>

---------

Signed-off-by: xtk8532704 <1041084556@qq.com>
xtk8532704 added a commit to tier4/autoware_universe that referenced this pull request Jan 26, 2026
…dation#11761)

* tmp save

Signed-off-by: xtk8532704 <1041084556@qq.com>

* remove some draft code

Signed-off-by: xtk8532704 <1041084556@qq.com>

* add new implements

Signed-off-by: xtk8532704 <1041084556@qq.com>

* polish code, need to update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* pre-commit

Signed-off-by: xtk8532704 <1041084556@qq.com>

* update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix cppcheck

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix unit test bug, and add test cases for ttc, drac.

Signed-off-by: xtk8532704 <1041084556@qq.com>

* cry to fix ci building error

Signed-off-by: xtk8532704 <1041084556@qq.com>

* refactor code

Signed-off-by: xtk8532704 <1041084556@qq.com>

---------

Signed-off-by: xtk8532704 <1041084556@qq.com>
Signed-off-by: Kem (TiankuiXian) <temkei.kem@tier4.jp>
k-uta pushed a commit to tier4/autoware_universe that referenced this pull request Jan 28, 2026
…dation#11761)

* tmp save

Signed-off-by: xtk8532704 <1041084556@qq.com>

* remove some draft code

Signed-off-by: xtk8532704 <1041084556@qq.com>

* add new implements

Signed-off-by: xtk8532704 <1041084556@qq.com>

* polish code, need to update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* pre-commit

Signed-off-by: xtk8532704 <1041084556@qq.com>

* update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix cppcheck

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix unit test bug, and add test cases for ttc, drac.

Signed-off-by: xtk8532704 <1041084556@qq.com>

* cry to fix ci building error

Signed-off-by: xtk8532704 <1041084556@qq.com>

* refactor code

Signed-off-by: xtk8532704 <1041084556@qq.com>

---------

Signed-off-by: xtk8532704 <1041084556@qq.com>
KeisukeShima pushed a commit to KeisukeShima/autoware.universe that referenced this pull request Mar 16, 2026
…dation#11761)

* tmp save

Signed-off-by: xtk8532704 <1041084556@qq.com>

* remove some draft code

Signed-off-by: xtk8532704 <1041084556@qq.com>

* add new implements

Signed-off-by: xtk8532704 <1041084556@qq.com>

* polish code, need to update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* pre-commit

Signed-off-by: xtk8532704 <1041084556@qq.com>

* update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix cppcheck

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix unit test bug, and add test cases for ttc, drac.

Signed-off-by: xtk8532704 <1041084556@qq.com>

* cry to fix ci building error

Signed-off-by: xtk8532704 <1041084556@qq.com>

* refactor code

Signed-off-by: xtk8532704 <1041084556@qq.com>

---------

Signed-off-by: xtk8532704 <1041084556@qq.com>
mkquda pushed a commit to tier4/autoware_universe that referenced this pull request Mar 16, 2026
…dation#11761)

* tmp save

Signed-off-by: xtk8532704 <1041084556@qq.com>

* remove some draft code

Signed-off-by: xtk8532704 <1041084556@qq.com>

* add new implements

Signed-off-by: xtk8532704 <1041084556@qq.com>

* polish code, need to update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* pre-commit

Signed-off-by: xtk8532704 <1041084556@qq.com>

* update readme

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix cppcheck

Signed-off-by: xtk8532704 <1041084556@qq.com>

* fix unit test bug, and add test cases for ttc, drac.

Signed-off-by: xtk8532704 <1041084556@qq.com>

* cry to fix ci building error

Signed-off-by: xtk8532704 <1041084556@qq.com>

* refactor code

Signed-off-by: xtk8532704 <1041084556@qq.com>

---------

Signed-off-by: xtk8532704 <1041084556@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:evaluator Evaluation tools for planning, localization etc. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) type:documentation Creating or refining documentation. (auto-assigned)

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants