Skip to content

Commit e2ae3c7

Browse files
committed
Ignoring the goal result if a new goal request sent
1 parent 2d8de77 commit e2ae3c7

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

nav2_behavior_tree/include/nav2_behavior_tree/bt_action_node.hpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -312,19 +312,12 @@ class BtActionNode : public BT::ActionNodeBase
312312
auto send_goal_options = typename rclcpp_action::Client<ActionT>::SendGoalOptions();
313313
send_goal_options.result_callback =
314314
[this](const typename rclcpp_action::ClientGoalHandle<ActionT>::WrappedResult & result) {
315-
if (!this->goal_handle_) {
316-
if (!future_goal_handle_) {
317-
// Shouldn't run into this block scope
318-
RCLCPP_WARN(
319-
node_->get_logger(),
320-
"Goal result for %s available, but it can not get a valid goal_handle_. "
321-
"Normally, this message shouldn't be printed.",
322-
action_name_.c_str());
323-
return;
324-
}
325-
326-
// If the future_goal_handle_ is not nullptr, try to get goal_handle_
327-
this->goal_handle_ = future_goal_handle_->get();
315+
if (future_goal_handle_) {
316+
RCLCPP_WARN(
317+
node_->get_logger(),
318+
"Goal result for %s available, but it hasn't received the goal response yet. "
319+
"It's probably a goal result for the last goal request", action_name_.c_str());
320+
return;
328321
}
329322

330323
// TODO(#1652): a work around until rcl_action interface is updated

0 commit comments

Comments
 (0)