Skip to content

Commit

Permalink
add response to the service on completion (ros-navigation#2992)
Browse files Browse the repository at this point in the history
  • Loading branch information
padhupradheep authored Jun 2, 2022
1 parent 30048b4 commit 12b0fcf
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ class BtServiceNode : public BT::ActionNodeBase
/**
* @brief Function to perform some user-defined operation upon successful
* completion of the service. Could put a value on the blackboard.
* @param response can be used to get the result of the service call in the BT Node.
* @return BT::NodeStatus Returns SUCCESS by default, user may override to return another value
*/
virtual BT::NodeStatus on_completion()
virtual BT::NodeStatus on_completion(std::shared_ptr<typename ServiceT::Response>/*response*/)
{
return BT::NodeStatus::SUCCESS;
}
Expand All @@ -168,7 +169,7 @@ class BtServiceNode : public BT::ActionNodeBase
rc = callback_group_executor_.spin_until_future_complete(future_result_, server_timeout_);
if (rc == rclcpp::FutureReturnCode::SUCCESS) {
request_sent_ = false;
BT::NodeStatus status = on_completion();
BT::NodeStatus status = on_completion(future_result_.get());
return status;
}

Expand Down

0 comments on commit 12b0fcf

Please sign in to comment.