Skip to content

Commit

Permalink
feat(avoidance): extend lanelets for target filtering (autowarefounda…
Browse files Browse the repository at this point in the history
…tion#4189) (autowarefoundation#649)

Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
Co-authored-by: Satoshi OTA <44889564+satoshi-ota@users.noreply.github.com>
  • Loading branch information
1222-takeshi and satoshi-ota authored Jul 7, 2023
1 parent 526ef0e commit e5e1d2d
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions planning/behavior_path_planner/src/utils/avoidance/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,25 @@ void filterTargetObjects(
? calcSignedArcLength(path_points, ego_pos, rh->getGoalPose().position)
: std::numeric_limits<double>::max();

// extend lanelets if the reference path is cut for lane change.
const auto & ego_pose = planner_data->self_odometry->pose.pose;
lanelet::ConstLanelets extend_lanelets = data.current_lanelets;
while (rclcpp::ok()) {
const double lane_length = lanelet::utils::getLaneletLength2d(extend_lanelets);
const auto arclength = lanelet::utils::getArcCoordinates(extend_lanelets, ego_pose);
const auto next_lanelets = rh->getNextLanelets(extend_lanelets.back());

if (next_lanelets.empty()) {
break;
}

if (lane_length - arclength.length < planner_data->parameters.forward_path_length) {
extend_lanelets.push_back(next_lanelets.front());
} else {
break;
}
}

for (auto & o : objects) {
const auto & object_pose = o.object.kinematics.initial_pose_with_covariance.pose;
const auto object_closest_index = findNearestIndex(path_points, object_pose.position);
Expand Down Expand Up @@ -949,15 +968,14 @@ void filterTargetObjects(

// check traffic light
const auto to_traffic_light =
utils::getDistanceToNextTrafficLight(object_pose, data.current_lanelets);
utils::getDistanceToNextTrafficLight(object_pose, extend_lanelets);
{
not_parked_object = to_traffic_light < parameters->object_ignore_distance_traffic_light;
}

// check crosswalk
const auto & ego_pose = planner_data->self_odometry->pose.pose;
const auto to_crosswalk =
utils::getDistanceToCrosswalk(ego_pose, data.current_lanelets, *rh->getOverallGraphPtr()) -
utils::getDistanceToCrosswalk(ego_pose, extend_lanelets, *rh->getOverallGraphPtr()) -
o.longitudinal;
{
const auto stop_for_crosswalk =
Expand Down

0 comments on commit e5e1d2d

Please sign in to comment.