Skip to content

Commit

Permalink
fix(lane_change): filter out objects out of lane to fix stopping marg…
Browse files Browse the repository at this point in the history
…in chattering

Signed-off-by: kosuke55 <[email protected]>
  • Loading branch information
kosuke55 committed Oct 16, 2023
1 parent b2a5c3f commit 72b63eb
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,19 @@ void NormalLaneChange::insertStopPoint(
if (v > lane_change_parameters_->stop_velocity_threshold) {
return false;
}

// target_objects includes objects out of target lanes, so filter them out
const auto polygon =
tier4_autoware_utils::toPolygon2d(o.initial_pose.pose, o.shape).outer();
if (std::all_of(polygon.begin(), polygon.end(), [&](const auto & polygon_p) {
auto footprint_pose = o.initial_pose.pose;
footprint_pose.position = tier4_autoware_utils::createPoint(
polygon_p.x(), polygon_p.y(), footprint_pose.position.z);
return !utils::isInLanelets(footprint_pose, status_.target_lanes);
})) {
return false;
}

const double distance_to_target_lane_obj = getDistanceAlongLanelet(o.initial_pose.pose);
return stopping_distance_for_obj < distance_to_target_lane_obj &&
distance_to_target_lane_obj < distance_to_ego_lane_obj;
Expand Down

0 comments on commit 72b63eb

Please sign in to comment.