MoveIt Pro Behavior Interface  5.0.1
Library for developing custom behaviors for use in MoveIt Pro
moveit_studio::behaviors::SharedResourcesNode< BehaviorTreeNodeT > Class Template Reference

The SharedResourcesNode class provides a BehaviorContext object when constructing a BehaviorTree.Cpp node. More...

#include <shared_resources_node.hpp>

Inheritance diagram for moveit_studio::behaviors::SharedResourcesNode< BehaviorTreeNodeT >:
Collaboration diagram for moveit_studio::behaviors::SharedResourcesNode< BehaviorTreeNodeT >:

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< BehaviorContextshared_resources_
 

Detailed Description

template<typename BehaviorTreeNodeT>
class moveit_studio::behaviors::SharedResourcesNode< BehaviorTreeNodeT >

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.

Template Parameters
BehaviorTreeNodeTA BehaviorTree.Cpp node type. The constructor for this type must have the signature (const std::string&, const BT::NodeConfiguration&).

Constructor & Destructor Documentation

◆ SharedResourcesNode()

template<typename BehaviorTreeNodeT >
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.

Parameters
nameName of the behavior, which is generated by the factory.
configConfiguration of the behavior, which is generated by the factory.
shared_resourcesA 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.

Member Data Documentation

◆ shared_resources_

template<typename BehaviorTreeNodeT >
std::shared_ptr<BehaviorContext> moveit_studio::behaviors::SharedResourcesNode< BehaviorTreeNodeT >::shared_resources_
protected

The documentation for this class was generated from the following files: