Skip to content

Commit

Permalink
feat(goal_planner): update lateral_deviation_thresh from 0.3 to `0.…
Browse files Browse the repository at this point in the history
…1` (#9850)

* fix(goal_planner): Update lateral_deviation_thresh from 0.3 to 0.1

Signed-off-by: Kasunori-Nakajima <[email protected]>

* unified hasDeviatedFrom{Last|Current}PreviousModulePath

Signed-off-by: Kasunori-Nakajima <[email protected]>

* style(pre-commit): autofix

* hasDeviatedFromPath argument modification

Signed-off-by: Kasunori-Nakajima <[email protected]>

* style(pre-commit): autofix

---------

Signed-off-by: Kasunori-Nakajima <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Kazunori-Nakajima and pre-commit-ci[bot] authored Jan 10, 2025
1 parent 00892a1 commit 594c099
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,8 @@ bool isOnModifiedGoal(
bool hasPreviousModulePathShapeChanged(
const BehaviorModuleOutput & upstream_module_output,
const BehaviorModuleOutput & last_upstream_module_output);
bool hasDeviatedFromLastPreviousModulePath(
const PlannerData & planner_data, const BehaviorModuleOutput & last_upstream_module_output);
bool hasDeviatedFromCurrentPreviousModulePath(
const PlannerData & planner_data, const BehaviorModuleOutput & upstream_module_output);
bool hasDeviatedFromPath(
const Point & ego_position, const BehaviorModuleOutput & upstream_module_output);

bool needPathUpdate(
const Pose & current_pose, const double path_update_duration, const rclcpp::Time & now,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ bool hasPreviousModulePathShapeChanged(
{
// Calculate the lateral distance between each point of the current path and the nearest point of
// the last path
constexpr double LATERAL_DEVIATION_THRESH = 0.3;
constexpr double LATERAL_DEVIATION_THRESH = 0.1;
for (const auto & p : upstream_module_output.path.points) {
const size_t nearest_seg_idx = autoware::motion_utils::findNearestSegmentIndex(
last_upstream_module_output.path.points, p.point.pose.position);
Expand Down Expand Up @@ -184,21 +184,12 @@ bool hasPreviousModulePathShapeChanged(
return false;
}

bool hasDeviatedFromLastPreviousModulePath(
const PlannerData & planner_data, const BehaviorModuleOutput & last_upstream_module_output)
bool hasDeviatedFromPath(
const Point & ego_position, const BehaviorModuleOutput & upstream_module_output)
{
constexpr double LATERAL_DEVIATION_THRESH = 0.1;
return std::abs(autoware::motion_utils::calcLateralOffset(
last_upstream_module_output.path.points,
planner_data.self_odometry->pose.pose.position)) > 0.3;
}

bool hasDeviatedFromCurrentPreviousModulePath(
const PlannerData & planner_data, const BehaviorModuleOutput & upstream_module_output)
{
constexpr double LATERAL_DEVIATION_THRESH = 0.3;
return std::abs(autoware::motion_utils::calcLateralOffset(
upstream_module_output.path.points, planner_data.self_odometry->pose.pose.position)) >
LATERAL_DEVIATION_THRESH;
upstream_module_output.path.points, ego_position)) > LATERAL_DEVIATION_THRESH;
}

bool needPathUpdate(
Expand Down Expand Up @@ -371,7 +362,8 @@ void LaneParkingPlanner::onTimer()
local_planner_data->self_odometry->pose.pose, modified_goal_opt, parameters_)) {
return false;
}
if (hasDeviatedFromCurrentPreviousModulePath(*local_planner_data, upstream_module_output)) {
if (hasDeviatedFromPath(
local_planner_data->self_odometry->pose.pose.position, upstream_module_output)) {
RCLCPP_DEBUG(getLogger(), "has deviated from current previous module path");
return false;
}
Expand All @@ -381,8 +373,8 @@ void LaneParkingPlanner::onTimer()
return true;
}
if (
hasDeviatedFromLastPreviousModulePath(
*local_planner_data, original_upstream_module_output_) &&
hasDeviatedFromPath(
local_planner_data->self_odometry->pose.pose.position, original_upstream_module_output_) &&
current_state != PathDecisionState::DecisionKind::DECIDED) {
RCLCPP_DEBUG(getLogger(), "has deviated from last previous module path");
return true;
Expand Down

0 comments on commit 594c099

Please sign in to comment.