Skip to content

Commit 5e8da39

Browse files
authored
fix(goal_planner): fix deviated path update (#6221)
Signed-off-by: kosuke55 <kosuke.tnp@gmail.com>
1 parent ef7a2b9 commit 5e8da39

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

planning/behavior_path_goal_planner_module/include/behavior_path_goal_planner_module/goal_planner_module.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ class GoalPlannerModule : public SceneModuleInterface
493493
std::optional<BehaviorModuleOutput> last_previous_module_output_{};
494494
bool hasPreviousModulePathShapeChanged() const;
495495
bool hasDeviatedFromLastPreviousModulePath() const;
496+
bool hasDeviatedFromCurrentPreviousModulePath() const;
496497

497498
// timer for generating pull over path candidates in a separate thread
498499
void onTimer();

planning/behavior_path_goal_planner_module/src/goal_planner_module.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ bool GoalPlannerModule::hasDeviatedFromLastPreviousModulePath() const
161161
planner_data_->self_odometry->pose.pose.position)) > 0.3;
162162
}
163163

164+
bool GoalPlannerModule::hasDeviatedFromCurrentPreviousModulePath() const
165+
{
166+
return std::abs(motion_utils::calcLateralOffset(
167+
getPreviousModuleOutput().path.points,
168+
planner_data_->self_odometry->pose.pose.position)) > 0.3;
169+
}
170+
164171
// generate pull over candidate paths
165172
void GoalPlannerModule::onTimer()
166173
{
@@ -179,6 +186,10 @@ void GoalPlannerModule::onTimer()
179186

180187
// check if new pull over path candidates are needed to be generated
181188
const bool need_update = std::invoke([&]() {
189+
if (hasDeviatedFromCurrentPreviousModulePath()) {
190+
RCLCPP_ERROR(getLogger(), "has deviated from current previous module path");
191+
return false;
192+
}
182193
if (thread_safe_data_.get_pull_over_path_candidates().empty()) {
183194
return true;
184195
}

0 commit comments

Comments
 (0)