Skip to content

Commit 27fdcb7

Browse files
doisygGuillaume Doisy
andauthored
[BtActionNode] [BtServiceNode] clear between calls (#4887)
Signed-off-by: Guillaume Doisy <guillaume@dexory.com> Co-authored-by: Guillaume Doisy <guillaume@dexory.com>
1 parent 447c8ce commit 27fdcb7

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

nav2_behavior_tree/include/nav2_behavior_tree/bt_action_node.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ class BtActionNode : public BT::ActionNodeBase
194194
// reset the flag to send the goal or not, allowing the user the option to set it in on_tick
195195
should_send_goal_ = true;
196196

197+
// Clear the input and output messages to make sure we have no leftover from previous calls
198+
goal_ = typename ActionT::Goal();
199+
result_ = typename rclcpp_action::ClientGoalHandle<ActionT>::WrappedResult();
200+
197201
// user defined callback, may modify "should_send_goal_".
198202
on_tick();
199203

nav2_behavior_tree/include/nav2_behavior_tree/bt_service_node.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ class BtServiceNode : public BT::ActionNodeBase
138138
// allowing the user the option to set it in on_tick
139139
should_send_request_ = true;
140140

141+
// Clear the input request to make sure we have no leftover from previous calls
142+
request_ = std::make_shared<typename ServiceT::Request>();
143+
141144
// user defined callback, may modify "should_send_request_".
142145
on_tick();
143146

0 commit comments

Comments
 (0)