Skip to content

Commit 8265f93

Browse files
authored
fix(avoidance): unexpected road shoulder distance calculation result (#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>
1 parent d4cb23c commit 8265f93

File tree

1 file changed

+7
-1
lines changed
  • planning/behavior_path_avoidance_module/src

1 file changed

+7
-1
lines changed

planning/behavior_path_avoidance_module/src/utils.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -912,8 +912,14 @@ double getRoadShoulderDistance(
912912
}
913913
}
914914

915+
const auto envelope_polygon_width =
916+
boost::geometry::area(object.envelope_poly) /
917+
std::max(object.length, 1e-3); // prevent division by zero
918+
915919
{
916-
const auto p2 = calcOffsetPose(p_tmp, 0.0, (isOnRight(object) ? -1.0 : 1.0), 0.0).position;
920+
const auto p2 =
921+
calcOffsetPose(p_tmp, 0.0, (isOnRight(object) ? -0.5 : 0.5) * envelope_polygon_width, 0.0)
922+
.position;
917923
const auto opt_intersect =
918924
tier4_autoware_utils::intersect(p1.second, p2, bound.at(i - 1), bound.at(i));
919925

0 commit comments

Comments
 (0)