Skip to content

Commit

Permalink
fix(avoidance): unexpected road shoulder distance calculation result (a…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
satoshi-ota authored May 16, 2024
1 parent d4cb23c commit 8265f93
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion planning/behavior_path_avoidance_module/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,14 @@ double getRoadShoulderDistance(
}
}

const auto envelope_polygon_width =
boost::geometry::area(object.envelope_poly) /
std::max(object.length, 1e-3); // prevent division by zero

{
const auto p2 = calcOffsetPose(p_tmp, 0.0, (isOnRight(object) ? -1.0 : 1.0), 0.0).position;
const auto p2 =
calcOffsetPose(p_tmp, 0.0, (isOnRight(object) ? -0.5 : 0.5) * envelope_polygon_width, 0.0)
.position;
const auto opt_intersect =
tier4_autoware_utils::intersect(p1.second, p2, bound.at(i - 1), bound.at(i));

Expand Down

0 comments on commit 8265f93

Please sign in to comment.