@@ -27,6 +27,8 @@ namespace BT
27
27
/* *
28
28
* @brief TreeExecutionServer class hosts a ROS Action Server that is able
29
29
* to load Behavior plugins, BehaviorTree.xml files and execute them.
30
+ *
31
+ * It can be customized by overriding its virtual functions.
30
32
*/
31
33
class TreeExecutionServer
32
34
{
@@ -84,18 +86,33 @@ class TreeExecutionServer
84
86
{}
85
87
86
88
/* *
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
88
94
*/
89
95
virtual std::optional<BT::NodeStatus> onLoopAfterTick (BT::NodeStatus status)
90
96
{
91
97
return std::nullopt;
92
98
}
93
99
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
+ */
96
107
virtual void onTreeExecutionCompleted (BT::NodeStatus status, bool was_cancelled)
97
108
{}
98
109
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
+ */
99
116
virtual std::optional<std::string> onLoopFeedback ()
100
117
{
101
118
return std::nullopt;
0 commit comments