Skip to content

Commit

Permalink
fix(goal_planner): fix deviated path update (autowarefoundation#6221)
Browse files Browse the repository at this point in the history
Signed-off-by: kosuke55 <[email protected]>
  • Loading branch information
kosuke55 committed Feb 6, 2024
1 parent b632aeb commit 7c09742
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ class GoalPlannerModule : public SceneModuleInterface
std::optional<BehaviorModuleOutput> last_previous_module_output_{};
bool hasPreviousModulePathShapeChanged() const;
bool hasDeviatedFromLastPreviousModulePath() const;
bool hasDeviatedFromCurrentPreviousModulePath() const;

// timer for generating pull over path candidates in a separate thread
void onTimer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ bool GoalPlannerModule::hasDeviatedFromLastPreviousModulePath() const
planner_data_->self_odometry->pose.pose.position)) > 0.3;
}

bool GoalPlannerModule::hasDeviatedFromCurrentPreviousModulePath() const
{
return std::abs(motion_utils::calcLateralOffset(
getPreviousModuleOutput().path.points,
planner_data_->self_odometry->pose.pose.position)) > 0.3;
}

// generate pull over candidate paths
void GoalPlannerModule::onTimer()
{
Expand All @@ -179,6 +186,10 @@ void GoalPlannerModule::onTimer()

// check if new pull over path candidates are needed to be generated
const bool need_update = std::invoke([&]() {
if (hasDeviatedFromCurrentPreviousModulePath()) {
RCLCPP_ERROR(getLogger(), "has deviated from current previous module path");
return false;
}
if (thread_safe_data_.get_pull_over_path_candidates().empty()) {
return true;
}
Expand Down

0 comments on commit 7c09742

Please sign in to comment.