Skip to main content

Crate mecha10_behavior_runtime

Crate mecha10_behavior_runtime 

Source
Expand description

Mecha10 Behavior Runtime

Unified behavior composition system for robotics and AI: behavior logic is Rust code

Re-exports§

pub use actions::register_builtin_actions;
pub use actions::CapabilityTaskNode;
pub use actions::GoToLocationNode;
pub use actions::MoveNode;
pub use actions::SensorCheckNode;
pub use actions::SetCapabilityTargetNode;
pub use actions::SetGoToLocationTargetNode;
pub use actions::TimerNode;
pub use actions::WanderNode;
pub use config::behavior_capabilities_satisfied;
pub use config::detect_project_root;
pub use config::get_current_environment;
pub use config::list_available_behaviors;
pub use config::list_capable_behaviors;
pub use config::load_behavior_config;
pub use config::resolve_behavior_config_path;
pub use config::validate_behavior_composition_json;
pub use config::validate_behavior_config;
pub use config::BehaviorConfig;
pub use config::CompositionConfig;
pub use config::ConditionConfig;
pub use config::ControllerModeKindConfig;
pub use config::NodeConfig;
pub use config::NodeReference;
pub use config::ParallelPolicyConfig;
pub use config::SubsumptionLayerConfig;
pub use config::ValidationResult;
pub use config::WeightedChildConfig;
pub use control::PidController;
pub use control::PidGains;

Modules§

actions
Built-in action nodes for behavior trees.
config
Configuration management for behavior trees
control
Reusable control-loop primitives shared by behaviour action nodes.
hot_reload
Hot-reload functionality for behavior trees during development.
prelude

Macros§

children_mut_via_wrapped_behavior
reset_child_statuses_field
reset_index_field

Structs§

BehaviorExecutor
BehaviorLoader
ConditionNode
Single-child decorator that gates its child on a ConditionKind predicate: it evaluates the predicate FIRST and only ticks the child (forwarding the child’s status unchanged) while the predicate holds; when the predicate is false it reports Failure WITHOUT ticking the child at all.
Context
CooldownNode
Bounds the GAP between runs of its child, the complement of TimeoutNode (which bounds how long a single run may stay Running). Once the child returns a terminal result (Success or Failure), this node refuses to re-tick it for cooldown: during that window tick() returns Failure immediately WITHOUT ticking the child at all. Once the window elapses, ticking resumes normally. A child that returns Running doesn’t start the cooldown clock - only a terminal result does.
ExecutionContext
ExecutionStats
ForceFailureNode
Always reports Failure once its child resolves, regardless of whether the child actually succeeded or failed; Running passes through unchanged. The mirror of ForceSuccessNode, useful inside a Selector to force a fallback to the next option.
ForceSuccessNode
Always reports Success once its child resolves, regardless of whether the child actually succeeded or failed; Running passes through unchanged. Useful for an optional step whose failure shouldn’t abort the rest of a Sequence.
InverterNode
Negates a Success/Failure result from its single child; Running passes through unchanged. The canonical decorator for turning a “condition” leaf/subtree into its opposite (e.g. “target NOT in range”) without duplicating the underlying check.
NodeRegistry
ParallelNode
RepeatNode
Re-runs its child every time it succeeds, up to an optional fixed count; a Failure from the child always ends the loop immediately with Failure. count: None repeats indefinitely (e.g. a patrol leg re-run forever until something fails it).
RetryNode
Re-runs its child up to max_attempts times whenever it fails, succeeding as soon as one attempt succeeds; only reports Failure once every attempt has been exhausted. The complement of RepeatNode (which loops on success).
SelectOrNode
SequenceNode
SubsumptionLayer
A single priority layer in a SubsumptionNode: a priority (higher wins) plus the behavior that implements it.
SubsumptionNode
Priority-based preemption (subsumption architecture): on each tick, tries each layer highest-priority first. The first layer whose tick() returns Running/Success “wins”; lower-priority layers aren’t ticked that cycle, preserving their internal progress.
TimeoutNode
Bounds how long its child may stay Running: once duration elapses without the child resolving, immediately reports Failure (resetting the child’s state). A child that resolves before the deadline passes its status straight through.
TreeStatusSnapshot
A point-in-time snapshot of a node’s (and its subtree’s) last-tick status, for live behavior-tree visualization. Captured on demand via BehaviorNode::status_snapshot - it does not itself tick anything, it just reads back what the most recent tick() call(s) already recorded.
WatchNode
Like ParallelNode, but with no memory of a prior resolution: every child is ticked, every call, unconditionally. Needed for an interrupt-condition layer that must be re-evaluated indefinitely (e.g. the operator clicking/clearing repeatedly over a session).
WeightedSelectNode
Like SelectOrNode (ticks children until one returns non-Failure), but instead of always trying children in a fixed index order, each tick-cycle picks the next untried child via a weighted-random draw among children not yet tried THIS resolution cycle. A weight of 0.0 (or negative) means that child is never picked. Once a child is chosen it is “sticky”: while it reports Running, the next tick() re-ticks that same child rather than re-rolling - only once it resolves does the node either return (on Success) or roll again among the remaining untried children (on Failure), mirroring SelectOrNode::current_index’s “resume where we left off” behavior, just with a random rather than fixed starting point each cycle.

Enums§

ConditionKind
A predicate a ConditionNode evaluates against live project/robot state before deciding whether to tick its child. Deliberately a small, closed enum rather than a general expression language: add a variant here when a genuinely new predicate is needed. Starts with just the two controller-mode checks patrol needs today, but is reusable infrastructure - any behavior tree can gate a subtree on one of these without a bespoke composite node.
ControllerModeKind
Which ControllerMode variant a ConditionKind::ControllerModeIs predicate matches - the variant only, since ControllerMode::Joints’s joint-name list is irrelevant to the check. Deliberately mirrors ControllerMode’s own variant names (and mecha10_core::node::Capability::Locomotion/Joints) rather than inventing a parallel vocabulary.
NodeStatus
ParallelPolicy

Traits§

BehaviorNode
BehaviorNodeExt

Functions§

boxed_children_mut
Maps an iterator of boxed child behaviors to BehaviorNode::children_mut’s trait-object return type.

Type Aliases§

BoxedBehavior