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(planning_errror_monitor): ignore invalid calculation in curvature validation #542

Merged
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 @@ -251,6 +251,9 @@ bool PlanningErrorMonitorNode::checkTrajectoryCurvature(
}

constexpr double points_distance = 1.0;
const auto isValidDistance = [points_distance](const auto & p1, const auto & p2) {
return calcDistance2d(p1, p2) >= points_distance;
};

for (size_t p1_id = 0; p1_id < traj.points.size() - 2; ++p1_id) {
// Get Point1
Expand All @@ -268,6 +271,9 @@ bool PlanningErrorMonitorNode::checkTrajectoryCurvature(
if (p1_id == p2_id || p1_id == p3_id || p2_id == p3_id) {
break;
}
if (!isValidDistance(p1, p2) || !isValidDistance(p1, p3) || !isValidDistance(p2, p3)) {
break;
}

const double curvature = calcCurvature(p1, p2, p3);

Expand Down