BehaviorTree.ROS2
BehaviorTree.ROS2 copied to clipboard
add payloads to Action
The main goal of this PR is to support users that want to send and receive more comple payloads, when executing a Tree (arguments and return values).
A single string is used for both, since the majority of the users can use JSON to store any argitrary set of arguments.
The return value of onTreeExecutionCompleted
has been changed to support a return value.
Also, about this code :
// return success or aborted for the action result
if(status == BT::NodeStatus::SUCCESS)
{
RCLCPP_INFO(kLogger, "BT finished with status: %s", BT::toStr(status).c_str());
goal_handle->succeed(action_result);
}
else
{
action_result->error_message = std::string("Behavior Tree failed during execution "
"with status: ") +
BT::toStr(status);
RCLCPP_ERROR(kLogger, action_result->error_message.c_str());
goal_handle->abort(action_result);
}
I don't think that a FAILURe shoult trigger a goal_handle->abort
since, from a technical point of view, the tree has been executed.