diff --git a/migration/Galactic.rst b/migration/Galactic.rst index eac9cb5b45..5295ecc3e4 100644 --- a/migration/Galactic.rst +++ b/migration/Galactic.rst @@ -91,3 +91,26 @@ This functionality has been discussed in `the ticket #816 `_ - Remove ``rclcpp_node_`` in ``class ControllerServer`` : `PR2459 `_, `PR2479 `_ - Remove ``rclcpp_node_`` in ``class PlannerServer`` : `PR2459 `_, `PR2480 `_ + + +Extending the BtServiceNode to process Service-Results +****************************************************** + +`This PR `_ addresses `this Ticket `_ and adds a virtual ``on_completion()`` function to the ``BtServiceNode`` class (`here `_). +Similar to the already existing virtual ``on_wait_for_result()`` function, it can be overwritten in the child class to react to a respective event with some user-defined operation. +The added ``on_completion()`` function will be called after the service interaction of the ``BtServiceNode`` has been successfully completed. + +.. code-block:: cpp + + /** + * @brief Function to perform some user-defined operation upon successful + * completion of the service. Could put a value on the blackboard. + * @return BT::NodeStatus Returns SUCCESS by default, user may override to return another value + */ + virtual BT::NodeStatus on_completion() + { + return BT::NodeStatus::SUCCESS; + } + +The returned ``BT::NodeStatus`` will set the current status of the BT-Node. Since the function has access to the results of the service, the returned node-status can depend on those service results, for example. +The normal behavior of the ``BtServiceNode`` is not affected by introducing the ``on_completion()`` function, since the the default implementation still simply returns ``BT::NodeStatus::SUCCESS``, if the service interaction completed successfully. \ No newline at end of file