MoveIt Pro Behavior
Core Behaviors for MoveIt Pro
|
The SharedResourcesNode class provides a BehaviorContext object when constructing a BehaviorTree.Cpp node. More...
#include <shared_resources_node.hpp>
Public Member Functions | |
SharedResourcesNode (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources) | |
Constructor for SharedResourcesNode. Called by BT::BehaviorTreeFactory when creating a new behavior tree containing this node. More... | |
Protected Attributes | |
std::shared_ptr< BehaviorContext > | shared_resources_ |
The SharedResourcesNode class provides a BehaviorContext object when constructing a BehaviorTree.Cpp node.
The purpose of this class is to let Behaviors access shared objects without resorting to using the BehaviorTree.Cpp port interface. In combination with the loader plugin architecture provided by SharedResourcesNodeLoaderBase, this allows us to write Behaviors that use constructors with signatures that are different from the normal signature of BehaviorTree.Cpp nodes, while still allowing the library responsible for creating the behavior tree to work without directly linking against Behavior libraries provided by downstream developers.
Note that classes inheriting from SharedResourcesNode cannot be registered with BT::BehaviorTreeFactory using the BT_REGISTER_NODES macro, since that macro only handles registering nodes with the default constructor signature. They must instead be registered within a behavior loader plugin inheriting from SharedResourcesNodeLoaderBase.
BehaviorTreeNodeT | A BehaviorTree.Cpp node type. The constructor for this type must have the signature (const std::string&, const BT::NodeConfiguration&). |
moveit_studio::behaviors::SharedResourcesNode< BehaviorTreeNodeT >::SharedResourcesNode | ( | const std::string & | name, |
const BT::NodeConfiguration & | config, | ||
const std::shared_ptr< BehaviorContext > & | shared_resources | ||
) |
Constructor for SharedResourcesNode. Called by BT::BehaviorTreeFactory when creating a new behavior tree containing this node.
name | Name of the behavior, which is generated by the factory. |
config | Configuration of the behavior, which is generated by the factory. |
shared_resources | A shared_ptr to an instance of BehaviorContext. When this behavior is created using moveit_studio::objective_server::ObjectiveServerNode, this will point to an instance of BehaviorContext owned by ObjectiveServerNode. |
|
protected |