Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(goal_planner): safety check with only parking path (#9293) #1668

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2158,6 +2158,10 @@ bool GoalPlannerModule::isSafePath(
const std::shared_ptr<ObjectsFilteringParams> & objects_filtering_params,
const std::shared_ptr<SafetyCheckParams> & safety_check_params) const
{
using autoware::behavior_path_planner::utils::path_safety_checker::createPredictedPath;
using autoware::behavior_path_planner::utils::path_safety_checker::
filterPredictedPathAfterTargetPose;

if (!found_pull_over_path || !pull_over_path_opt) {
return false;
}
Expand All @@ -2175,7 +2179,6 @@ bool GoalPlannerModule::isSafePath(
const auto pull_over_lanes = goal_planner_utils::getPullOverLanes(
*route_handler, left_side_parking_, parameters.backward_goal_search_length,
parameters.forward_goal_search_length);
const size_t ego_seg_idx = planner_data->findEgoSegmentIndex(current_pull_over_path.points);
const std::pair<double, double> terminal_velocity_and_accel =
pull_over_path.getPairsTerminalVelocityAndAccel();
RCLCPP_DEBUG(
Expand All @@ -2186,10 +2189,12 @@ bool GoalPlannerModule::isSafePath(
// TODO(Sugahara): shoule judge is_object_front properly
const bool is_object_front = true;
const bool limit_to_max_velocity = true;
const auto ego_predicted_path =
autoware::behavior_path_planner::utils::path_safety_checker::createPredictedPath(
ego_predicted_path_params, current_pull_over_path.points, current_pose, current_velocity,
ego_seg_idx, is_object_front, limit_to_max_velocity);
const auto ego_seg_idx = planner_data->findEgoIndex(current_pull_over_path.points);
const auto ego_predicted_path_from_current_pose = createPredictedPath(
ego_predicted_path_params, current_pull_over_path.points, current_pose, current_velocity,
ego_seg_idx, is_object_front, limit_to_max_velocity);
const auto ego_predicted_path = filterPredictedPathAfterTargetPose(
ego_predicted_path_from_current_pose, pull_over_path.start_pose());

// ==========================================================================================
// if ego is before the entry of pull_over_lanes, the beginning of the safety check area
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ ExtendedPredictedObjects filterObjectPredictedPathByTimeHorizon(
const ExtendedPredictedObjects & objects, const double time_horizon,
const bool check_all_predicted_path);

std::vector<PoseWithVelocityStamped> filterPredictedPathAfterTargetPose(
const std::vector<PoseWithVelocityStamped> & path, const Pose & target_pose);

bool checkSafetyWithRSS(
const PathWithLaneId & planned_path,
const std::vector<PoseWithVelocityStamped> & ego_predicted_path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,22 @@ ExtendedPredictedObjects filterObjectPredictedPathByTimeHorizon(
return filtered_objects;
}

std::vector<PoseWithVelocityStamped> filterPredictedPathAfterTargetPose(
const std::vector<PoseWithVelocityStamped> & path, const Pose & target_pose)
{
std::vector<PoseWithVelocityStamped> filtered_path;

const auto target_idx =
std::min_element(path.begin(), path.end(), [&target_pose](const auto & a, const auto & b) {
return calcDistance2d(a.pose.position, target_pose.position) <
calcDistance2d(b.pose.position, target_pose.position);
});

std::copy(target_idx, path.end(), std::back_inserter(filtered_path));

return filtered_path;
};

bool checkSafetyWithRSS(
const PathWithLaneId & planned_path,
const std::vector<PoseWithVelocityStamped> & ego_predicted_path,
Expand Down
Loading