Skip to content

Commit

Permalink
fix(obstacle_avoidance_planner): add guard for too large yaw deviation (
Browse files Browse the repository at this point in the history
autowarefoundation#2579)

Signed-off-by: Takayuki Murooka <[email protected]>

Signed-off-by: Takayuki Murooka <[email protected]>
  • Loading branch information
takayuki5168 authored Dec 26, 2022
1 parent 773ef53 commit c98bdbc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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

0 comments on commit c98bdbc

Please sign in to comment.