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

fix(avoidance): fix avoidance path chattering #2012

Merged
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 @@ -42,6 +42,7 @@ namespace behavior_path_planner
{
using motion_utils::calcSignedArcLength;
using motion_utils::findNearestIndex;
using motion_utils::findNearestSegmentIndex;
using tier4_autoware_utils::calcDistance2d;
using tier4_autoware_utils::calcLateralDeviation;
using tier4_planning_msgs::msg::AvoidanceDebugFactor;
Expand Down Expand Up @@ -140,8 +141,11 @@ AvoidancePlanningData AvoidanceModule::calcAvoidancePlanningData(DebugData & deb
// if the resampled path has only 1 point, use original path.
data.reference_path = center_path;
}

const size_t nearest_segment_index =
findNearestSegmentIndex(data.reference_path.points, data.reference_pose.position);
data.ego_closest_path_index =
findNearestIndex(data.reference_path.points, data.reference_pose.position);
std::min(nearest_segment_index + 1, data.reference_path.points.size() - 1);

// arclength from ego pose (used in many functions)
data.arclength_from_ego = util::calcPathArcLengthArray(
Expand Down