Skip to content

Commit

Permalink
add yaw_dev threshold angle
Browse files Browse the repository at this point in the history
Signed-off-by: beyza <bnk@leodrive.ai>
  • Loading branch information
beyza committed Oct 20, 2022
1 parent 5d11abd commit 7f1d7c3
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,27 @@ void BehaviorPathPlannerNode::run()
const auto output = bt_manager_->run(planner_data);

// path handling
const auto path = getPath(output, planner_data);
auto path = getPath(output, planner_data);

// check if path orientation is valid
if (!path->points.empty()) {
const auto closest_path_point_idx = motion_utils::findNearestIndex(path->points,
planner_data->self_pose->pose.position);
const auto yaw_dev = tier4_autoware_utils::calcYawDeviation(path->points.at(closest_path_point_idx).point.pose,
planner_data->self_pose->pose);

if (std::abs(yaw_dev) > M_PI / 2.0) {
RCLCPP_WARN(get_logger(), "Path orientation is invalid. Path yaw deviation: %f (deg)", yaw_dev * 180 / M_PI);
if (!planner_data_->prev_output_path->points.empty()) {
path = planner_data_->prev_output_path;
} else {
return;
}
} else {
// update planner data
planner_data_->prev_output_path = path;
}
}

// update planner data
planner_data_->prev_output_path = path;
Expand Down

0 comments on commit 7f1d7c3

Please sign in to comment.