Decision Module  1.0
ICRA2020 AI Challenge Northwestern Polytechnical University Aoxiang Team Strategy Code
roborts_decision::CompositeNode Class Referenceabstract

Behavior tree composite node inherited from BehaviorNode. More...

#include <behavior_node.h>

Inheritance diagram for roborts_decision::CompositeNode:
roborts_decision::BehaviorNode roborts_decision::ParallelNode roborts_decision::SelectorNode

Public Member Functions

 CompositeNode (std::string name, BehaviorType behavior_type, const Blackboard::Ptr &blackboard_ptr)
 Constructor of CompositeNode. More...
 
virtual ~CompositeNode ()=default
 
virtual void AddChildren (const BehaviorNode::Ptr &child_node_ptr)
 Add child behavior node to the composite node. More...
 
virtual void AddChildren (std::initializer_list< BehaviorNode::Ptr > child_node_ptr_list)
 Add a list of child behavior nodes to the composite node. More...
 
virtual BehaviorNode::Ptr GetChild ()
 Get the child behavior node that it is turn to tick. More...
 
std::vector< BehaviorNode::Ptr > & GetChildren ()
 Get the list of child behavior nodes. More...
 
unsigned int GetChildrenIndex ()
 Get the index of the child behavior node that it is turn to tick. More...
 
unsigned int GetChildrenNum ()
 Get the number of child behavior nodes. More...
 
- Public Member Functions inherited from roborts_decision::BehaviorNode
 BehaviorNode ()
 
 BehaviorNode (std::string name, BehaviorType behavior_type, const Blackboard::Ptr &blackboard_ptr)
 Constructor of BehaviorNode. More...
 
virtual ~BehaviorNode ()=default
 
BehaviorState Run ()
 Run the behavior node. More...
 
virtual void Reset ()
 Reset the behavior node. More...
 
BehaviorType GetBehaviorType ()
 Get the type of the behavior node. More...
 
BehaviorState GetBehaviorState ()
 Get the state of the behavior node. More...
 
std::string GetName ()
 Get the name of the behavior node. More...
 
void SetParent (BehaviorNode::Ptr parent_node_ptr)
 Set the parent of the behavior node. More...
 
BehaviorNode::Ptr GetParent ()
 Get the parent node of the behavior node. More...
 
unsigned int GetLevel ()
 Get the level of the behavior node. More...
 
void SetLevel (unsigned int level)
 Set the level of the behavior node. More...
 

Protected Member Functions

virtual BehaviorState Update ()=0
 Tick the node and update the state of the behavior node. More...
 
virtual void OnInitialize ()=0
 Initialize something before starting to tick the node. More...
 
virtual void OnTerminate (BehaviorState state)=0
 Recover or reset something After getting the result. More...
 

Protected Attributes

std::vector< BehaviorNode::Ptrchildren_node_ptr_
 the list of child nodes More...
 
unsigned int children_node_index_
 the index of child nodes More...
 
- Protected Attributes inherited from roborts_decision::BehaviorNode
std::string name_
 Node name. More...
 
BehaviorState behavior_state_
 State. More...
 
BehaviorType behavior_type_
 Type. More...
 
Blackboard::Ptr blackboard_ptr_
 Blackboard. More...
 
BehaviorNode::Ptr parent_node_ptr_
 Parent Node Pointer. More...
 
unsigned int level_
 Level of the tree. More...
 

Additional Inherited Members

- Public Types inherited from roborts_decision::BehaviorNode
typedef std::shared_ptr< BehaviorNodePtr
 

Detailed Description

Behavior tree composite node inherited from BehaviorNode.

Constructor & Destructor Documentation

◆ CompositeNode()

roborts_decision::CompositeNode::CompositeNode ( std::string  name,
BehaviorType  behavior_type,
const Blackboard::Ptr blackboard_ptr 
)
inline

Constructor of CompositeNode.

Parameters
nameName of the behavior node
behavior_typeType of the behavior node
blackboard_ptrBlackboard of the behavior node

◆ ~CompositeNode()

virtual roborts_decision::CompositeNode::~CompositeNode ( )
virtualdefault

Member Function Documentation

◆ AddChildren() [1/2]

virtual void roborts_decision::CompositeNode::AddChildren ( const BehaviorNode::Ptr child_node_ptr)
inlinevirtual

Add child behavior node to the composite node.

Parameters
child_node_ptrThe expected child behavior node

◆ AddChildren() [2/2]

virtual void roborts_decision::CompositeNode::AddChildren ( std::initializer_list< BehaviorNode::Ptr child_node_ptr_list)
inlinevirtual

Add a list of child behavior nodes to the composite node.

Parameters
child_node_ptrA list of the expected child behavior nodes

◆ GetChild()

virtual BehaviorNode::Ptr roborts_decision::CompositeNode::GetChild ( )
inlinevirtual

Get the child behavior node that it is turn to tick.

Returns
The child behavior node

Reimplemented from roborts_decision::BehaviorNode.

◆ GetChildren()

std::vector<BehaviorNode::Ptr>& roborts_decision::CompositeNode::GetChildren ( )
inline

Get the list of child behavior nodes.

Returns
The list of child behavior nodes

◆ GetChildrenIndex()

unsigned int roborts_decision::CompositeNode::GetChildrenIndex ( )
inline

Get the index of the child behavior node that it is turn to tick.

Returns
The index of the child behavior node that it is turn to tick

◆ GetChildrenNum()

unsigned int roborts_decision::CompositeNode::GetChildrenNum ( )
inline

Get the number of child behavior nodes.

Returns
The number of child behavior nodes

◆ OnInitialize()

virtual void roborts_decision::CompositeNode::OnInitialize ( )
protectedpure virtual

Initialize something before starting to tick the node.

Implements roborts_decision::BehaviorNode.

Implemented in roborts_decision::ParallelNode, and roborts_decision::SelectorNode.

◆ OnTerminate()

virtual void roborts_decision::CompositeNode::OnTerminate ( BehaviorState  state)
protectedpure virtual

Recover or reset something After getting the result.

Parameters
stateInput behavior state

Implements roborts_decision::BehaviorNode.

Implemented in roborts_decision::ParallelNode, and roborts_decision::SelectorNode.

◆ Update()

virtual BehaviorState roborts_decision::CompositeNode::Update ( )
protectedpure virtual

Tick the node and update the state of the behavior node.

Returns
the state of the behavior node

Implements roborts_decision::BehaviorNode.

Implemented in roborts_decision::ParallelNode, and roborts_decision::SelectorNode.

Member Data Documentation

◆ children_node_index_

unsigned int roborts_decision::CompositeNode::children_node_index_
protected

the index of child nodes

◆ children_node_ptr_

std::vector<BehaviorNode::Ptr> roborts_decision::CompositeNode::children_node_ptr_
protected

the list of child nodes


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