Skip to content

fix(autoware_motion_velocity_out_of_lane_module): fix ego footprint collapse from negative overhangs (#13536) - #13543

Merged
maxime-clem merged 1 commit into
autowarefoundation:mainfrom
paneendrakumar0:fix-out-of-lane-ego-footprint-collapse-13536
Oct 26, 2026
Merged

maxime-clem merged 1 commit into
autowarefoundation:mainfrom
paneendrakumar0:fix-out-of-lane-ego-footprint-collapse-13536

Conversation

@paneendrakumar0

Copy link
Copy Markdown
Contributor

Description

In autoware_motion_velocity_out_of_lane_module, out_of_lane_module.cpp initializes vehicle offsets from vehicle_info_utils:

pp.front_offset = vehicle_info.max_longitudinal_offset_m;
pp.rear_offset = vehicle_info.min_longitudinal_offset_m;
pp.left_offset = vehicle_info.max_lateral_offset_m;
pp.right_offset = vehicle_info.min_lateral_offset_m;

In ISO 8855 / Autoware vehicle coordinates, min_longitudinal_offset_m (e.g. -1.10 m) and min_lateral_offset_m (e.g. -0.948 m) are signed negative values relative to base_link.

In make_base_footprint, these signed values were directly assigned to vehicle_info.rear_overhang_m and vehicle_info.right_overhang_m:

vehicle_info.rear_overhang_m = p.rear_offset;
vehicle_info.front_overhang_m = p.front_offset;
vehicle_info.wheel_base_m = 0.0;
vehicle_info.left_overhang_m = p.left_offset;
vehicle_info.right_overhang_m = p.right_offset;
vehicle_info.wheel_tread_m = 0.0;

However, VehicleInfo::createFootprint assumes positive overhang distances and negates them internally:

  • x_rear = -(rear_overhang_m + rear_lon_margin)
  • y_right_front = -(wheel_tread_m * 0.5 + right_overhang_m + margin)

Because negative values were passed, a double negation occurred:

  1. x_rear evaluated to -(-1.10) = +1.10 m (in front of the rear axle).
  2. y_right evaluated to -(-0.948) = +0.948 m (the exact same coordinate as y_left at +0.948 m).

As a result, the generated polygon collapsed into a zero-width line segment with an area of 0.0 m^2:
(3.79, 0.948), (3.79, 0.948), (1.10, 0.948), (1.10, 0.948), (3.79, 0.948).
Consequently, polygon intersection and overlap detection with adjacent lanelets always evaluated to empty/disjoint in simulation and real vehicles, disabling collision avoidance checks in the module.

In addition:

  • lat_margin was previously calculated as (right_offset + left_offset) / 2 and passed symmetrically, distorting asymmetric extra_left_offset and extra_right_offset.
  • In lanelets_selection.cpp and filter_predicted_objects.cpp, right_offset and rear_offset were added directly to margins without accounting for their signed negative nature.

Changes:

  1. make_base_footprint:
    • Pass positive overhang lengths using std::abs(p.rear_offset) and std::abs(p.right_offset).
    • Apply asymmetric extra_left_offset and extra_right_offset directly to left_overhang_m and right_overhang_m.
    • Call createFootprint(0.0, 0.0, 0.0, front_offset, rear_offset) ensuring exact dimensional inflation on each side.
  2. lanelets_selection.cpp:
    • Use std::abs(params.right_offset) and std::abs(params.rear_offset) when computing max_ego_footprint_offset.
  3. filter_predicted_objects.cpp:
    • Use std::abs(params.right_offset) when checking is_crossing_ego.
  4. Unit Tests:
    • Added unit tests in test/test_footprint.cpp verifying non-zero footprint area, exact bounding box dimensions matching VehicleInfo, asymmetric extra offset handling, and lanelet overlap detection.

Related links

Parent Issue:

How was this PR tested?

Built package and ran unit tests with ROS 2 Jazzy:

colcon build --packages-select autoware_motion_velocity_out_of_lane_module
./build/autoware_motion_velocity_out_of_lane_module/test_autoware_motion_velocity_out_of_lane_module

Result: 5/5 tests passed (100% pass), including 4 new footprint and overlap tests:

  • TestFootprint.BaseFootprintDimensionsAndArea: PASSED (Calculated area: 9.27144 m^2 vs expected 9.27144 m^2; min/max x: [-1.10, 3.79], min/max y: [-0.948, 0.948])
  • TestFootprint.BaseFootprintWithExtraOffsets: PASSED (Properly expanded min/max bounds and area 12.49524 m^2)
  • TestFootprint.BaseFootprintIgnoreOffset: PASSED (Correct base dimensions returned)
  • TestFootprint.CurrentEgoFootprintAndLaneletOverlap: PASSED (Successfully detects collision/overlap with adjacent lanelet)

Verified git diff --check and git clang-format --diff clean.

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

Restores ego footprint generation in autoware_motion_velocity_out_of_lane_module from a collapsed 0-width line segment back to the true 2D vehicle bounding polygon, enabling correct overlap and collision detection with surrounding lanelets.

…ollapse from negative overhangs (autowarefoundation#13536)

`out_of_lane_module` initializes `pp.rear_offset` and `pp.right_offset`
from `vehicle_info.min_longitudinal_offset_m` and
`vehicle_info.min_lateral_offset_m`, which are negative offsets relative
to base_link.

In `make_base_footprint`, passing these signed offsets directly to
`vehicle_info.createFootprint` as `rear_overhang_m` and
`right_overhang_m` caused double negation because `createFootprint` expects
positive overhang lengths and negates them internally. This caused the
rear edge to flip forward and the right edge to flip to the positive
y-coordinate (+0.948 m), collapsing the footprint polygon into a
zero-width line segment with 0.0 m^2 area and preventing out-of-lane
overlap detection from functioning.

Fix this by:
1. Passing non-negative overhangs using `std::abs` for rear and right
   offsets to `VehicleInfo`.
2. Applying asymmetric `extra_left_offset` and `extra_right_offset`
   directly to `left_overhang_m` and `right_overhang_m` rather than
   distorting them through an averaged symmetric `lat_margin`.
3. Using `std::abs` on `right_offset` and `rear_offset` in
   `lanelets_selection.cpp` and `filter_predicted_objects.cpp`.
4. Adding unit regression tests in `test/test_footprint.cpp` validating
   footprint area, bounding box coordinates, offset handling, and
   lanelet polygon overlap detection.

Signed-off-by: paneendrakumar0 <paneendra100@gmail.com>
@github-actions github-actions Bot added the component:planning Route planning, decision-making, and navigation. (auto-assigned) label Oct 26, 2026
@github-actions

Copy link
Copy Markdown

Thank you for contributing to the Autoware project!

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

Please ensure:

@maxime-clem maxime-clem left a comment

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.

Thank you for your contribution.

I tested in Psim and confirmed with the OutOfLane debug markers that the feature was broken and is fixed by this PR.

@shmpwk shmpwk added run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) tag:require-cuda-build-and-test labels Oct 26, 2026
@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.14286% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.32%. Comparing base (a3e718d) to head (b8d40db).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...city_out_of_lane_module/src/lanelets_selection.cpp 0.00% 2 Missing ⚠️
...ut_of_lane_module/src/filter_predicted_objects.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13543      +/-   ##
==========================================
+ Coverage   38.31%   38.32%   +0.01%     
==========================================
  Files        2034     2034              
  Lines      141864   141863       -1     
==========================================
+ Hits        54349    54368      +19     
+ Misses      87515    87495      -20     
Flag Coverage Δ *Carryforward flag
daily ?
full-suite 38.31% <ø> (+<0.01%) ⬆️ Carriedforward from a3e718d

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

☔ View full report in Codecov by Harness.
📢 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.

@maxime-clem
maxime-clem merged commit 2a9e2b7 into autowarefoundation:main Oct 26, 2026
55 of 60 checks passed
@github-project-automation github-project-automation Bot moved this from To Triage to Done in Software Working Group Oct 26, 2026
paulsohn-github-app Bot pushed a commit to paulsohn/autoware_universe_planning_2 that referenced this pull request Oct 26, 2026
…ollapse from negative overhangs (autowarefoundation/autoware_universe#13536) (autowarefoundation/autoware_universe#13543)

`out_of_lane_module` initializes `pp.rear_offset` and `pp.right_offset`
from `vehicle_info.min_longitudinal_offset_m` and
`vehicle_info.min_lateral_offset_m`, which are negative offsets relative
to base_link.

In `make_base_footprint`, passing these signed offsets directly to
`vehicle_info.createFootprint` as `rear_overhang_m` and
`right_overhang_m` caused double negation because `createFootprint` expects
positive overhang lengths and negates them internally. This caused the
rear edge to flip forward and the right edge to flip to the positive
y-coordinate (+0.948 m), collapsing the footprint polygon into a
zero-width line segment with 0.0 m^2 area and preventing out-of-lane
overlap detection from functioning.

Fix this by:
1. Passing non-negative overhangs using `std::abs` for rear and right
   offsets to `VehicleInfo`.
2. Applying asymmetric `extra_left_offset` and `extra_right_offset`
   directly to `left_overhang_m` and `right_overhang_m` rather than
   distorting them through an averaged symmetric `lat_margin`.
3. Using `std::abs` on `right_offset` and `rear_offset` in
   `lanelets_selection.cpp` and `filter_predicted_objects.cpp`.
4. Adding unit regression tests in `test/test_footprint.cpp` validating
   footprint area, bounding box coordinates, offset handling, and
   lanelet polygon overlap detection.

Signed-off-by: paneendrakumar0 <paneendra100@gmail.com>
shmpwk pushed a commit to tier4/pilot_auto_planning that referenced this pull request Nov 5, 2026
…ollapse from negative overhangs (autowarefoundation/autoware_universe#13536) (autowarefoundation/autoware_universe#13543)

`out_of_lane_module` initializes `pp.rear_offset` and `pp.right_offset`
from `vehicle_info.min_longitudinal_offset_m` and
`vehicle_info.min_lateral_offset_m`, which are negative offsets relative
to base_link.

In `make_base_footprint`, passing these signed offsets directly to
`vehicle_info.createFootprint` as `rear_overhang_m` and
`right_overhang_m` caused double negation because `createFootprint` expects
positive overhang lengths and negates them internally. This caused the
rear edge to flip forward and the right edge to flip to the positive
y-coordinate (+0.948 m), collapsing the footprint polygon into a
zero-width line segment with 0.0 m^2 area and preventing out-of-lane
overlap detection from functioning.

Fix this by:
1. Passing non-negative overhangs using `std::abs` for rear and right
   offsets to `VehicleInfo`.
2. Applying asymmetric `extra_left_offset` and `extra_right_offset`
   directly to `left_overhang_m` and `right_overhang_m` rather than
   distorting them through an averaged symmetric `lat_margin`.
3. Using `std::abs` on `right_offset` and `rear_offset` in
   `lanelets_selection.cpp` and `filter_predicted_objects.cpp`.
4. Adding unit regression tests in `test/test_footprint.cpp` validating
   footprint area, bounding box coordinates, offset handling, and
   lanelet polygon overlap detection.

Signed-off-by: paneendrakumar0 <paneendra100@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) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) tag:require-cuda-build-and-test

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[out_of_lane] Ego footprint collapses to a zero-width segment, so no overlap is ever detected

3 participants