Skip to content

Commit

Permalink
[BtActionNode] [BtServiceNode] clear between calls (ros-navigation#4887)
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Doisy <guillaume@dexory.com>
Co-authored-by: Guillaume Doisy <guillaume@dexory.com>
  • Loading branch information
2 people authored and masf7g committed Feb 5, 2025
1 parent 3111c04 commit 4c77495
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ class BtActionNode : public BT::ActionNodeBase
// reset the flag to send the goal or not, allowing the user the option to set it in on_tick
should_send_goal_ = true;

// Clear the input and output messages to make sure we have no leftover from previous calls
goal_ = typename ActionT::Goal();
result_ = typename rclcpp_action::ClientGoalHandle<ActionT>::WrappedResult();

// user defined callback, may modify "should_send_goal_".
on_tick();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ class BtServiceNode : public BT::ActionNodeBase
// allowing the user the option to set it in on_tick
should_send_request_ = true;

// Clear the input request to make sure we have no leftover from previous calls
request_ = std::make_shared<typename ServiceT::Request>();

// user defined callback, may modify "should_send_request_".
on_tick();

Expand Down

0 comments on commit 4c77495

Please sign in to comment.