Skip to content

Commit

Permalink
style(pre-commit): autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Mar 2, 2025
1 parent 5945ef7 commit c4b3500
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions planning/autoware_path_generator/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ std::optional<double> calc_interpolated_z(
}
// Check if seg_idx is invalid: -2 is to avoid out of bounds error by seg_idx + 1
if (seg_idx > input.points.size() - 2) {
RCLCPP_WARN(rclcpp::get_logger("path_generator"),
"seg_idx: %zu is invalid for input size: %zu.\n"
"Use the z that of the last point as the interpolated z.",
seg_idx, input.points.size());
RCLCPP_WARN(
rclcpp::get_logger("path_generator"),
"seg_idx: %zu is invalid for input size: %zu.\n"
"Use the z that of the last point as the interpolated z.",
seg_idx, input.points.size());

// Return the z of the last point if interpolation is not possible
return input.points.back().point.pose.position.z;
Expand Down Expand Up @@ -93,10 +94,11 @@ std::optional<double> calc_interpolated_velocity(
}
// Check if seg_idx is invalid: -2 is to avoid out of bounds error by seg_idx + 1
if (seg_idx > input.points.size() - 2) {
RCLCPP_WARN(rclcpp::get_logger("path_generator"),
"seg_idx: %zu is invalid for input size: %zu.\n"
"Use the velocity that of the last point as the interpolated velocity.",
seg_idx, input.points.size());
RCLCPP_WARN(
rclcpp::get_logger("path_generator"),
"seg_idx: %zu is invalid for input size: %zu.\n"
"Use the velocity that of the last point as the interpolated velocity.",
seg_idx, input.points.size());

// Return the velocity of the last point if interpolation is not possible
return input.points.back().point.longitudinal_velocity_mps;
Expand Down Expand Up @@ -428,7 +430,8 @@ std::optional<PathWithLaneId> set_goal(
if (auto velocity = calc_interpolated_velocity(input, closest_seg_idx_for_pre_goal)) {
pre_refined_goal.point.longitudinal_velocity_mps = *velocity;
} else {
RCLCPP_ERROR(rclcpp::get_logger("path_generator"), "Failed to calculate velocity for pre_goal");
RCLCPP_ERROR(
rclcpp::get_logger("path_generator"), "Failed to calculate velocity for pre_goal");
return std::nullopt;
}

Expand Down Expand Up @@ -562,7 +565,6 @@ std::optional<lanelet::ConstLanelets> extract_lanelets_from_path(
RCLCPP_ERROR(rclcpp::get_logger("path_generator"), "Out of range error: %s", e.what());
return std::nullopt;
}

}
return refined_path_lanelets;
}
Expand Down

0 comments on commit c4b3500

Please sign in to comment.