Skip to content

Commit

Permalink
fix(avoidance): use find nearest index to calculate object's overhang…
Browse files Browse the repository at this point in the history
… & longitudinal (autowarefoundation#4874) (autowarefoundation#906)

Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
  • Loading branch information
satoshi-ota authored Oct 4, 2023
1 parent 10a2376 commit 5e4a01c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions planning/behavior_path_planner/src/utils/avoidance/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,8 @@ void fillLongitudinalAndLengthByClosestEnvelopeFootprint(
double max_distance = std::numeric_limits<double>::lowest();
for (const auto & p : obj.envelope_poly.outer()) {
const auto point = tier4_autoware_utils::createPoint(p.x(), p.y(), 0.0);
const double arc_length = calcSignedArcLengthToFirstNearestPoint(path.points, ego_pos, point);
// TODO(someone): search around first position where the ego should avoid the object.
const double arc_length = calcSignedArcLength(path.points, ego_pos, point);
min_distance = std::min(min_distance, arc_length);
max_distance = std::max(max_distance, arc_length);
}
Expand All @@ -412,7 +413,8 @@ double calcEnvelopeOverhangDistance(

for (const auto & p : object_data.envelope_poly.outer()) {
const auto point = tier4_autoware_utils::createPoint(p.x(), p.y(), 0.0);
const auto idx = findFirstNearestIndex(path.points, point);
// TODO(someone): search around first position where the ego should avoid the object.
const auto idx = findNearestIndex(path.points, point);
const auto lateral = calcLateralDeviation(getPose(path.points.at(idx)), point);

const auto & overhang_pose_on_right = [&overhang_pose, &largest_overhang, &point, &lateral]() {
Expand Down

0 comments on commit 5e4a01c

Please sign in to comment.