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(obstacle_avoidance_planner): add guard for too large yaw deviation #2579

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 @@ -153,6 +153,7 @@ struct DebugData

std::vector<geometry_msgs::msg::Pose> mpt_ref_poses;
std::vector<double> lateral_errors;
std::vector<double> yaw_errors;

std::vector<autoware_auto_planning_msgs::msg::TrajectoryPoint> eb_traj;
std::vector<autoware_auto_planning_msgs::msg::TrajectoryPoint> mpt_fixed_traj;
Expand Down
10 changes: 10 additions & 0 deletions planning/obstacle_avoidance_planner/src/mpt_optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,15 @@ boost::optional<MPTOptimizer::MPTTrajs> MPTOptimizer::getModelPredictiveTrajecto
return boost::none;
}
}
constexpr double max_yaw_deviation = 50.0 / 180 * 3.14;
for (const double yaw_error : debug_data.yaw_errors) {
if (max_yaw_deviation < std::abs(yaw_error)) {
RCLCPP_ERROR(
rclcpp::get_logger("mpt_optimizer"),
"return boost::none since yaw deviation is too large.");
return boost::none;
}
}

auto full_optimized_ref_points = fixed_ref_points;
full_optimized_ref_points.insert(
Expand Down Expand Up @@ -1197,6 +1206,7 @@ std::vector<autoware_auto_planning_msgs::msg::TrajectoryPoint> MPTOptimizer::get
ref_pose.orientation = tier4_autoware_utils::createQuaternionFromYaw(ref_point.yaw);
debug_data.mpt_ref_poses.push_back(ref_pose);
debug_data.lateral_errors.push_back(lat_error);
debug_data.yaw_errors.push_back(yaw_error);

ref_point.optimized_kinematic_state << lat_error_vec.at(i), yaw_error_vec.at(i);
if (i >= fixed_ref_points.size()) {
Expand Down