Skip to content

Commit

Permalink
fix(behavior_path_planner): check new modified goal in the node side (a…
Browse files Browse the repository at this point in the history
…utowarefoundation#4295)

Signed-off-by: kosuke55 <kosuke.tnp@gmail.com>
  • Loading branch information
kosuke55 committed Jul 20, 2023
1 parent 3e4b65e commit 738df1f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,12 @@ void BehaviorPathPlannerNode::run()
lk_manager.unlock(); // release bt_manager_
#endif

if (output.modified_goal) {
// publish modified goal only when it is updated
if (
output.modified_goal &&
/* has changed modified goal */ (
!planner_data_->prev_modified_goal ||
planner_data_->prev_modified_goal->uuid != output.modified_goal->uuid)) {
PoseWithUuidStamped modified_goal = *(output.modified_goal);
modified_goal.header.stamp = path->header.stamp;
planner_data_->prev_modified_goal = modified_goal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,11 +689,8 @@ void GoalPlannerModule::setDrivableAreaInfo(BehaviorModuleOutput & output) const

void GoalPlannerModule::setModifiedGoal(BehaviorModuleOutput & output) const
{
// set the modified goal only when it is updated
const auto & route_handler = planner_data_->route_handler;
const bool has_changed_goal =
modified_goal_pose_ && (!prev_goal_id_ || *prev_goal_id_ != modified_goal_pose_->id);
if (status_.is_safe && has_changed_goal) {
if (status_.is_safe) {
PoseWithUuidStamped modified_goal{};
modified_goal.uuid = route_handler->getRouteUuid();
modified_goal.pose = modified_goal_pose_->goal_pose;
Expand Down

0 comments on commit 738df1f

Please sign in to comment.