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

Behavior tree parallel node inherited from CompositeNode. More...

#include <behavior_node.h>

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

Public Member Functions

 ParallelNode (std::string name, const Blackboard::Ptr &blackboard_ptr, unsigned int threshold)
 Constructor of ParallelNode. More...
 
virtual ~ParallelNode ()=default
 
- Public Member Functions inherited from roborts_decision::CompositeNode
 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 void OnInitialize ()
 Initialize something before starting to tick the node. More...
 
virtual BehaviorState Update ()
 Tick the node and update the state of the behavior node. More...
 
virtual void OnTerminate (BehaviorState state)
 Recover or reset something After getting the result. More...
 

Protected Attributes

std::vector< bool > children_node_done_
 a list of result checker flags for each child node More...
 
unsigned int success_count_
 the current number of child nodes with success behavior state More...
 
unsigned int failure_count_
 the current number of child nodes with failure behavior state More...
 
unsigned int threshold_
 the number of child nodes with success behavior state to determine success of the parallel node More...
 
- Protected Attributes inherited from roborts_decision::CompositeNode
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 parallel node inherited from CompositeNode.

Constructor & Destructor Documentation

◆ ParallelNode()

roborts_decision::ParallelNode::ParallelNode ( std::string  name,
const Blackboard::Ptr blackboard_ptr,
unsigned int  threshold 
)
inline

Constructor of ParallelNode.

Parameters
nameName of the behavior node
blackboard_ptrBlackboard of the behavior node
thresholdThreshold number of child nodes to determine behavior state of success

◆ ~ParallelNode()

virtual roborts_decision::ParallelNode::~ParallelNode ( )
virtualdefault

Member Function Documentation

◆ OnInitialize()

virtual void roborts_decision::ParallelNode::OnInitialize ( )
inlineprotectedvirtual

Initialize something before starting to tick the node.

Initialize and reset the success and failure count of each child node

Implements roborts_decision::CompositeNode.

◆ OnTerminate()

virtual void roborts_decision::ParallelNode::OnTerminate ( BehaviorState  state)
inlineprotectedvirtual

Recover or reset something After getting the result.

Parameters
stateInput behavior state

Implements roborts_decision::CompositeNode.

◆ Update()

virtual BehaviorState roborts_decision::ParallelNode::Update ( )
inlineprotectedvirtual

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

Returns
the state of the behavior node

Implements roborts_decision::CompositeNode.

Member Data Documentation

◆ children_node_done_

std::vector<bool> roborts_decision::ParallelNode::children_node_done_
protected

a list of result checker flags for each child node

◆ failure_count_

unsigned int roborts_decision::ParallelNode::failure_count_
protected

the current number of child nodes with failure behavior state

◆ success_count_

unsigned int roborts_decision::ParallelNode::success_count_
protected

the current number of child nodes with success behavior state

◆ threshold_

unsigned int roborts_decision::ParallelNode::threshold_
protected

the number of child nodes with success behavior state to determine success of the parallel node


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