pub struct BehaviorTreeElement { /* private fields */ }Expand description
A tree elements.
Implementations§
Source§impl BehaviorTreeElement
impl BehaviorTreeElement
Sourcepub fn create(
kind: TreeElementKind,
behavior: BehaviorPtr,
data: BehaviorData,
) -> Self
pub fn create( kind: TreeElementKind, behavior: BehaviorPtr, data: BehaviorData, ) -> Self
Construct a BehaviorTreeElement.
Sourcepub fn new(
kind: TreeElementKind,
behavior: BehaviorPtr,
data: BehaviorData,
children: BehaviorTreeElementList,
conditions: Conditions,
) -> Self
pub fn new( kind: TreeElementKind, behavior: BehaviorPtr, data: BehaviorData, children: BehaviorTreeElementList, conditions: Conditions, ) -> Self
Construct a BehaviorTreeElement.
Sourcepub const fn data(&self) -> &BehaviorData
pub const fn data(&self) -> &BehaviorData
Returns a reference to the BehaviorData.
Sourcepub const fn data_mut(&mut self) -> &mut BehaviorData
pub const fn data_mut(&mut self) -> &mut BehaviorData
Returns a mutable reference to the BehaviorData.
Sourcepub const fn behavior(&self) -> &BehaviorPtr
pub const fn behavior(&self) -> &BehaviorPtr
Returns a reference to the behavior.
Sourcepub const fn behavior_mut(&mut self) -> &mut BehaviorPtr
pub const fn behavior_mut(&mut self) -> &mut BehaviorPtr
Returns a mutable reference to the behavior.
Sourcepub const fn blackboard(&self) -> &Databoard
pub const fn blackboard(&self) -> &Databoard
Returns a reference to the blackboard.
Sourcepub const fn blackboard_mut(&mut self) -> &mut Databoard
pub const fn blackboard_mut(&mut self) -> &mut Databoard
Returns a reference to the blackboard.
Sourcepub const fn children(&self) -> &BehaviorTreeElementList
pub const fn children(&self) -> &BehaviorTreeElementList
Returns the children.
Sourcepub const fn children_mut(&mut self) -> &mut BehaviorTreeElementList
pub const fn children_mut(&mut self) -> &mut BehaviorTreeElementList
Returns the children mutable.
Sourcepub const fn pre_conditions(&self) -> &PreConditions
pub const fn pre_conditions(&self) -> &PreConditions
Returns the pre conditions.
Sourcepub const fn pre_conditions_mut(&mut self) -> &mut PreConditions
pub const fn pre_conditions_mut(&mut self) -> &mut PreConditions
Returns the pre condition mutables.
Sourcepub const fn post_conditions(&self) -> &PostConditions
pub const fn post_conditions(&self) -> &PostConditions
Returns the post conditions.
Sourcepub const fn post_conditions_mut(&mut self) -> &mut PostConditions
pub const fn post_conditions_mut(&mut self) -> &mut PostConditions
Returns the post conditions mutable.
Sourcepub fn halt(&mut self, runtime: &SharedRuntime) -> Result<(), Error>
pub fn halt(&mut self, runtime: &SharedRuntime) -> Result<(), Error>
Halts the element and all its children considering postconditions.
§Errors
Sourcepub async fn tick(&mut self, runtime: &SharedRuntime) -> BehaviorResult
pub async fn tick(&mut self, runtime: &SharedRuntime) -> BehaviorResult
Ticks the element considering pre- and postconditions.
§Errors
Sourcepub fn halt_child_at(
&mut self,
index: usize,
runtime: &SharedRuntime,
) -> Result<(), Error>
pub fn halt_child_at( &mut self, index: usize, runtime: &SharedRuntime, ) -> Result<(), Error>
Sourcepub fn halt_children_from(
&mut self,
index: usize,
runtime: &SharedRuntime,
) -> Result<(), Error>
pub fn halt_children_from( &mut self, index: usize, runtime: &SharedRuntime, ) -> Result<(), Error>
Sourcepub fn halt_children(&mut self, runtime: &SharedRuntime) -> Result<(), Error>
pub fn halt_children(&mut self, runtime: &SharedRuntime) -> Result<(), Error>
Sourcepub fn reset_state(&mut self)
pub fn reset_state(&mut self)
Reset state of element.
Sourcepub fn add_pre_state_change_callback<T>(&mut self, name: Arc<str>, callback: T)
pub fn add_pre_state_change_callback<T>(&mut self, name: Arc<str>, callback: T)
Add a pre state change callback with the given name. The name is not unique, which is important when removing callback.
Sourcepub fn remove_pre_state_change_callback(&mut self, name: &str)
pub fn remove_pre_state_change_callback(&mut self, name: &str)
Remove any pre state change callback with the given name.
Sourcepub fn children_iter(&self) -> impl DoubleEndedIterator<Item = &Self>
pub fn children_iter(&self) -> impl DoubleEndedIterator<Item = &Self>
Return an iterator over the children.
Sourcepub fn children_iter_mut(
&mut self,
) -> impl DoubleEndedIterator<Item = &mut Self>
pub fn children_iter_mut( &mut self, ) -> impl DoubleEndedIterator<Item = &mut Self>
Return a mutable iterator over the children.
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Self>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Self>
Get a mutable iterator over the tree element.
pub const fn kind(&self) -> TreeElementKind
Sourcepub const fn groot2_path(&self) -> &Arc<str>
pub const fn groot2_path(&self) -> &Arc<str>
Returns the Groot2 style ‘path’ of the element.
Sourcepub const fn state(&self) -> BehaviorState
pub const fn state(&self) -> BehaviorState
Returns the current state of the element.