Behavior Executor Node
Loads and executes behavior trees for autonomous robot control.
Overview
The behavior executor node runs behavior trees at a configurable tick rate, providing autonomous control for robots. It supports enable/disable control from the dashboard and advanced interrupt/resume functionality for seamless integration with manual control.
Features
- Behavior Tree Execution: Loads and runs behavior trees from JSON files
- Built-in Actions: Wander, move, timer, sensor_check nodes
- Configurable Tick Rate: Control execution frequency
- Dashboard Control: Enable/disable via dashboard UI
- Smart Interruption: Pause for manual commands, auto-resume when done
- Status Publishing: Real-time execution status and statistics
- Health Monitoring: Reports behavior tree health and tick counts
Configuration
# Behavior Executor Configuration
= "patrol" # Name of behavior to load (from behaviors/)
= "behaviors" # Directory containing behavior JSON files
= 10.0 # Execution frequency in Hz
= 10000 # Optional maximum tick count
= true # Log periodic statistics
[]
= "/behavior/control" # Control topic for enable/disable/interrupt/resume
= "/behavior/status" # Status publishing topic
Control Messages
The behavior executor listens to /behavior/control for control commands:
Basic Control (Dashboard)
Enable Behavior Tree
Disable Behavior Tree
Advanced Control (Node Interruption)
Interrupt with Auto-Resume
When duration_secs is provided, the behavior tree will automatically resume after the timeout.
Manual Resume
Resumes the behavior tree immediately, cancelling any pending auto-resume.
Status Messages
Published to /behavior/status every second:
Control Flow
Startup
- Node starts with behavior execution disabled
- Waits for
enablecommand from dashboard - When enabled, resets behavior tree and starts ticking
Interruption Flow
1. Behavior tree is running (enabled)
2. Receives "interrupt" command from node (e.g., llm-command)
→ Behavior execution pauses
→ If duration_secs provided, schedules auto-resume
3. Manual command executes
4. After timeout OR manual resume:
→ Behavior tree resets and resumes execution
Manual Control
Dashboard:
- "Enable" button → Starts behavior tree
- "Disable" button → Stops behavior tree
Nodes:
- Send "interrupt" → Pauses for user command
- Send "resume" → Resumes autonomous behavior
Behavior Tree Files
Behavior trees are loaded from JSON files in the behaviors/ directory:
Example: behaviors/patrol.json
Built-in Action Nodes
Wander
Moves the robot with random velocity:
Move
Moves with fixed velocity:
Timer
Waits for a duration:
Sensor Check
Checks sensor values:
Integration with LLM Command
The behavior executor works seamlessly with the llm-command node:
- Robot is patrolling (behavior tree enabled)
- User says "stop" via LLM
- llm-command sends interrupt with 30s timeout
- Behavior tree pauses, robot stops
- After 30 seconds, behavior tree auto-resumes
- Robot continues patrolling
This provides a natural "take control, then hand back" UX.
Running
The node is launched automatically by mecha10 dev when included in mecha10.json.
To run manually:
Health Check
The health check monitors:
- Behavior execution status (Success/Failure)
- Tick count
- Last status
If the behavior status is Failure, the health check reports unhealthy.
Dependencies
- mecha10-core: Framework core (Context, Topic, Message)
- mecha10-behavior-runtime: Behavior tree runtime
- tokio: Async runtime
- serde/serde_json: Serialization
- anyhow: Error handling
See Also
- mecha10-behavior-runtime - Behavior tree implementation
- llm-command - Natural language commands with interruption
- Behavior Interrupt System - Reusable interrupt trigger