|
WSF
|
#include <WsfAdvancedBehaviorTree.hpp>


Public Member Functions | |
| WsfAdvancedBehaviorTree (const WsfScenario &aScenario) | |
| WsfAdvancedBehaviorTree (const WsfAdvancedBehaviorTree &aSrc) | |
| ~WsfAdvancedBehaviorTree () override=default | |
| WsfAdvancedBehaviorTree & | operator= (const WsfAdvancedBehaviorTree &aRhs)=delete |
| void | AddBlackboard (const std::string &aName, std::shared_ptr< WsfAttributeContainer > aBlackboardPtr) |
| Add a blackboard to the blackboard list. | |
| WsfAdvancedBehaviorTree * | Clone () const override |
| Clone this tree. | |
| WsfAttributeContainer * | GetSharedBlackboard (const std::string &aName) const |
| Get a blackboard with the specified name from the shared list. | |
| std::vector< std::string > | GetSharedBlackboardNames () const |
| Get a list of all shared blackboard names. | |
| WsfSimulation * | GetSimulation () |
| Return a pointer to the simulation. | |
| bool | Initialize (double aSimTime, WsfScriptProcessor *aParentPtr, WsfScriptContext *aParentContextPtr=nullptr) |
| Initialize this tree. | |
| const size_t | NodeCount () const |
| Return a count of all leaf nodes. | |
| const unsigned int & | GetTreeId () const |
| Get the id of this tree. | |
| const std::string & | GetName () const |
| Get the name of this tree. | |
| WsfAdvancedBehaviorTreeActionNode * | NodeEntry (size_t aIndex) const |
| Returns an action node at an index. | |
| WsfScriptProcessor * | GetParentProcessor () const |
| Return a pointer to the parent processor of this tree. | |
| bool | ProcessInput (UtInput &aInput) override |
| Process input from a script. | |
| void | RegisterActionNode (WsfAdvancedBehaviorTreeActionNode *aNodePtr) |
| Register an action node in our list, for easier tracking and updating in the processor. | |
| std::shared_ptr< WsfAdvancedBehaviorTreeCompositeNode > | RootNode () const |
| Return a shared pointer to the root node of this tree. | |
| const bool | SharedBlackboardExists (const std::string &aName) const |
| Get if a blackboard with the specified name exists in the shared list. | |
| void | SetShouldOutputNextTick (const bool aValue) |
| Set if the tree should output node values to the event pipe next tick. | |
| bool | Tick (double aSimTime) |
| Tick(update) the tree. | |
| WsfAdvancedBehaviorTreeNode * | FindNode (const std::string &aNodeName) const |
| Find and return a pointer to the node with a given name. | |
| void | FindLastExecuted (std::vector< WsfAdvancedBehaviorTreeNode * > &aLastExecuted) const |
| Fill a given vector with pointers to nodes that executed last tick. | |
| WsfPlatform * | GetOwningPlatform () const |
| Return a pointer to the owning platform of this tree. | |
| const char * | GetScriptClassName () const override |
| Return the script class name for this tree. | |
| const WsfScriptContext & | GetScriptContext () const |
| Returns a reference to the script context for this tree. | |
| void | SetParent (WsfScriptProcessor *aParentPtr) |
| Set the parent processor. | |
| void | SetParentContext (WsfScriptContext *aParentContextPtr) |
| Set the parent script context for this tree. | |
| void | SetRootNodeClass () |
| Cast the root node to the composite node class set in the tree. | |
| void | OutputTreeStructure (const double aSimTime) |
| Output the structure of this tree to the event pipe. | |
| void | OutputTreeState (const double aSimTime) |
| Output the state of this tree to the event pipe. | |
| void | SetSuccessPolicy (const BT::SuccessPolicy aPolicy) |
| Set the success policy for this node. | |
| void | SetThreshold (const unsigned int aThreshold) |
| Set the threshold(number) of children that must succeed for this node to succeed. | |
| Public Member Functions inherited from WsfObject | |
| WsfObject () | |
| This is the constructor for the WsfObject class. | |
| ~WsfObject () override | |
| This is the destructor for the WsfObject class. | |
| const char * | GetScriptClassName () const override |
| const std::string & | GetType () const |
| WsfStringId | GetTypeId () const |
| Get the string ID of the 'type' of the object. | |
| void | SetType (WsfStringId aType) |
| const std::string & | GetBaseType () const |
| WsfStringId | GetBaseTypeId () const |
| const TypeList & | GetTypeList () const |
| bool | IsA_TypeOf (WsfStringId aType) const |
| WsfObject & | operator= (const WsfObject &aRhs) |
| Assignment operator. | |
| template<typename T> | |
| void | Serialize (T &aBuff) |
| For XIO (de)serialization. | |
| const std::string & | GetName () const |
| WsfStringId | GetNameId () const |
| void | SetName (WsfStringId aName) |
Static Public Member Functions | |
| static unsigned int | GetUniqueTreeId () |
| Get a unique int id for this tree. | |
| static void | Reset () |
| Reset the unique int counter. | |
Protected Member Functions | |
| UtScriptContext * | GetScriptAccessibleContext () const override |
| Return the context from the script. | |
| bool | RegisterExternVariable (const std::string &aVariableType, const std::string &aVariableName) |
| Register an external variable. | |
| WsfObject (const WsfObject &aSrc) | |
| Copy constructor (for Clone()). | |
Additional Inherited Members | |
| Public Types inherited from WsfObject | |
| typedef std::vector< WsfStringId > | TypeList |
| The list of types returned by GetTypeList. | |
| WsfAdvancedBehaviorTree::WsfAdvancedBehaviorTree | ( | const WsfScenario & | aScenario | ) |
References GetScriptContext(), GetUniqueTreeId(), RegisterExternVariable(), WsfObject::SetName(), and WsfObject::SetType().
Referenced by Clone(), operator=(), and WsfAdvancedBehaviorTree().
| WsfAdvancedBehaviorTree::WsfAdvancedBehaviorTree | ( | const WsfAdvancedBehaviorTree & | aSrc | ) |
|
overridedefault |
| void WsfAdvancedBehaviorTree::AddBlackboard | ( | const std::string & | aName, |
| std::shared_ptr< WsfAttributeContainer > | aBlackboardPtr ) |
Add a blackboard to the blackboard list.
| aName | name to reference blackboard with. |
| aBlackboardPtr | blackboard to add. |
Referenced by operator=().
|
overridevirtual |
| void WsfAdvancedBehaviorTree::FindLastExecuted | ( | std::vector< WsfAdvancedBehaviorTreeNode * > & | aLastExecuted | ) | const |
Fill a given vector with pointers to nodes that executed last tick.
| aLastExecuted | vector to fill. |
Referenced by UT_DEFINE_SCRIPT_METHOD().
| WsfAdvancedBehaviorTreeNode * WsfAdvancedBehaviorTree::FindNode | ( | const std::string & | aNodeName | ) | const |
Find and return a pointer to the node with a given name.
| aNodeName | name of the node to find. |
Referenced by UT_DEFINE_SCRIPT_METHOD(), and UT_DEFINE_SCRIPT_METHOD().
|
inline |
Get the name of this tree.
| WsfPlatform * WsfAdvancedBehaviorTree::GetOwningPlatform | ( | ) | const |
Return a pointer to the owning platform of this tree.
References WsfScriptContext::GetPLATFORM().
Referenced by WsfAdvancedBehaviorTreeNode::GetOwningPlatform().
|
inline |
Return a pointer to the parent processor of this tree.
Referenced by WsfAdvancedBehaviorTreeNode::GetOwningProcessor().
|
overrideprotected |
Return the context from the script.
References WsfPlatform::GetContext().
|
override |
Return the script class name for this tree.
|
inline |
Returns a reference to the script context for this tree.
Referenced by WsfAdvancedBehaviorTree().
| WsfAttributeContainer * WsfAdvancedBehaviorTree::GetSharedBlackboard | ( | const std::string & | aName | ) | const |
Get a blackboard with the specified name from the shared list.
| aName | name of the blackboard to get |
References SharedBlackboardExists().
Referenced by operator=(), and UT_DEFINE_SCRIPT_METHOD().
| std::vector< std::string > WsfAdvancedBehaviorTree::GetSharedBlackboardNames | ( | ) | const |
Get a list of all shared blackboard names.
Referenced by operator=().
| WsfSimulation * WsfAdvancedBehaviorTree::GetSimulation | ( | ) |
Return a pointer to the simulation.
References WsfSimulation::GetScriptContext(), and WsfScriptContext::GetSimulation().
Referenced by operator=(), OutputTreeState(), and OutputTreeStructure().
|
inline |
Get the id of this tree.
|
inlinestatic |
Get a unique int id for this tree.
Referenced by WsfAdvancedBehaviorTree(), and WsfAdvancedBehaviorTree().
| bool WsfAdvancedBehaviorTree::Initialize | ( | double | aSimTime, |
| WsfScriptProcessor * | aParentPtr, | ||
| WsfScriptContext * | aParentContextPtr = nullptr ) |
Initialize this tree.
| aSimTime | sim time at initialization. |
| aParentPtr | pointer to the parent script processor. |
| aParentContextPtr | pointer to the parent script context. |
References OutputTreeStructure(), and WsfScriptContext::SetParent().
Referenced by operator=().
|
inline |
Return a count of all leaf nodes.
Referenced by UT_DEFINE_SCRIPT_METHOD().
| WsfAdvancedBehaviorTreeActionNode * WsfAdvancedBehaviorTree::NodeEntry | ( | size_t | aIndex | ) | const |
Returns an action node at an index.
| aIndex | index of node to retrieve. |
Referenced by UT_DEFINE_SCRIPT_METHOD().
|
delete |
| void WsfAdvancedBehaviorTree::OutputTreeState | ( | const double | aSimTime | ) |
Output the state of this tree to the event pipe.
| aSimTime | time at output. |
References WsfObserver::AdvancedBehaviorTreeState(), and GetSimulation().
| void WsfAdvancedBehaviorTree::OutputTreeStructure | ( | const double | aSimTime | ) |
Output the structure of this tree to the event pipe.
| aSimTime | time at output. |
References WsfObserver::AdvancedBehaviorTree(), and GetSimulation().
Referenced by Initialize().
|
overridevirtual |
Process input from a script.
| aInput | input to parse. |
Reimplemented from WsfObject.
References WsfAdvancedBehaviorTreeNode::SetFilePath().
| void WsfAdvancedBehaviorTree::RegisterActionNode | ( | WsfAdvancedBehaviorTreeActionNode * | aNodePtr | ) |
Register an action node in our list, for easier tracking and updating in the processor.
| aNodePtr | node to register. |
|
protected |
Register an external variable.
| aVariableType | variable type to register. |
| aVariableName | name of the variable. |
References RegisterExternVariable().
Referenced by RegisterExternVariable(), and WsfAdvancedBehaviorTree().
|
inlinestatic |
Reset the unique int counter.
|
inline |
Return a shared pointer to the root node of this tree.
Referenced by WsfAdvancedBehaviorTreeNode::SetExecuteTooltip(), and WsfAdvancedBehaviorTreeNode::SetPreconditionTooltip().
|
inline |
Set the parent processor.
| aParentPtr | parent to set. |
|
inline |
Set the parent script context for this tree.
| aParentContextPtr | parent context to set. |
| void WsfAdvancedBehaviorTree::SetRootNodeClass | ( | ) |
Cast the root node to the composite node class set in the tree.
References BT::cON_FAILURE, and BT::cON_SUCCESS.
Referenced by WsfAdvancedBehaviorTree().
|
inline |
Set if the tree should output node values to the event pipe next tick.
| aValue | value to set. |
Referenced by WsfAdvancedBehaviorTreeNode::SetNodeStatus().
|
inline |
Set the success policy for this node.
| aPolicy | policy to use when evaluating for success |
|
inline |
Set the threshold(number) of children that must succeed for this node to succeed.
| aThreshold | the threshold that must be hit for this node to succeed. |
| const bool WsfAdvancedBehaviorTree::SharedBlackboardExists | ( | const std::string & | aName | ) | const |
Get if a blackboard with the specified name exists in the shared list.
| aName | name of the blackboard to get |
Referenced by GetSharedBlackboard().
| bool WsfAdvancedBehaviorTree::Tick | ( | double | aSimTime | ) |
Tick(update) the tree.
| aSimTime | sim time when this function is called. |