Skip to content

Commit 9497662

Browse files
committed
more comments
1 parent 64a7801 commit 9497662

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

behaviortree_ros2/include/behaviortree_ros2/tree_execution_server.hpp

+20-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ namespace BT
2727
/**
2828
* @brief TreeExecutionServer class hosts a ROS Action Server that is able
2929
* to load Behavior plugins, BehaviorTree.xml files and execute them.
30+
*
31+
* It can be customized by overriding its virtual functions.
3032
*/
3133
class TreeExecutionServer
3234
{
@@ -84,18 +86,33 @@ class TreeExecutionServer
8486
{}
8587

8688
/**
87-
* @brief onLoopAfterTick invoked after the tree is created and before the tree is executed.
89+
* @brief onLoopAfterTick invoked at each loop, after tree.tickOnce().
90+
* If it returns a valid NodeStatus, the tree will stop and return that status.
91+
* Return std::nullopt to continue the execution.
92+
*
93+
* @param status The status of the tree after the last tick
8894
*/
8995
virtual std::optional<BT::NodeStatus> onLoopAfterTick(BT::NodeStatus status)
9096
{
9197
return std::nullopt;
9298
}
9399

94-
// To be overridden by the user.
95-
// Callback invoked when the tree execution is completed
100+
/**
101+
* @brief onTreeExecutionCompleted is a callback invoked after the tree execution is completed,
102+
* i.e. if it returned SUCCESS/FAILURE or if the action was cancelled by the Action Client.
103+
*
104+
* @param status The status of the tree after the last tick
105+
* @param was_cancelled True if the action was cancelled by the Action Client
106+
*/
96107
virtual void onTreeExecutionCompleted(BT::NodeStatus status, bool was_cancelled)
97108
{}
98109

110+
/**
111+
* @brief onLoopFeedback is a callback invoked at each loop, after tree.tickOnce().
112+
* If it returns a valid string, it will be sent as feedback to the Action Client.
113+
*
114+
* If you don't want to return any feedback, return std::nullopt.
115+
*/
99116
virtual std::optional<std::string> onLoopFeedback()
100117
{
101118
return std::nullopt;

0 commit comments

Comments
 (0)