Behaviors
Behaviors: How Robots Think and Act
Behaviors are algorithms and software patterns that connect sensing to action. They represent the "how" of robotics - the intelligence that transforms sensor data into purposeful movement.
For an introduction to how Behaviors fit into the BRS knowledge structure, see Robotics Ontology.
What Makes a Behavior?
A Behavior has these characteristics:
- Algorithm-based: It's a defined process or decision-making pattern
- Language-agnostic: Can be implemented in any programming language
- Sensor-agnostic: Works with different hardware providing the same capability
- Reusable: The same behavior can be used in multiple activities
- Testable: You can verify if the behavior works correctly
Behaviors are different from Activities (which are user-facing tasks) and Capabilities (which are hardware). A Behavior defines "how" a robot thinks, not "what" it accomplishes or "what hardware" it uses.
Current Behaviors
These behaviors have full documentation with tested implementations on SimpleBot:
| Behavior | Type | Required Capabilities | Used In | Status |
|---|---|---|---|---|
| Behavior:Line Following | Navigation | Line Sensing, Differential Drive | Activity:Line Following | Fully Documented |
| Behavior:Dead Reckoning | Navigation | Odometry, Differential Drive | Activity:Dead Reckoning Navigation | Fully Documented |
Future Behaviors (Stubs)
These behaviors are not yet implemented in any BRS robot. They represent opportunities for community contribution! Implement these algorithms and document them.
| Behavior | Type | Required Capabilities | Enables Activities | Status |
|---|---|---|---|---|
| Behavior:PID Control | Control | Sensors + Actuators | Precise motion, line following improvements | Stub - Waiting for implementation |
| Behavior:Wall Following | Navigation | Distance Sensing, Movement | Maze solving, room navigation | Stub - Waiting for implementation |
| Behavior:Pathfinding | Planning | Mapping, Movement | Optimal navigation, maze optimization | Stub - Advanced algorithm |
| Behavior:SLAM | Mapping | LIDAR/Distance, Odometry | Room mapping, autonomous navigation | Stub - Advanced algorithm |
Behaviors by Type
- Behavior:Line Following (documented) - Follow visual guides
- Behavior:Dead Reckoning (documented) - Navigate using motion measurement
- Behavior:Wall Following (stub) - Follow walls and obstacles
Control Behaviors
- Behavior:PID Control (stub) - Proportional-Integral-Derivative feedback control
Planning Behaviors
- Behavior:Pathfinding (stub) - Calculate optimal routes
Mapping Behaviors
- Behavior:SLAM (stub) - Simultaneous Localization and Mapping
How Behaviors Connect Capabilities to Activities
Behaviors are the bridge between what your robot can do (capabilities) and what it should do (activities). Here's how they connect:
| Activity | Behavior | Required Capabilities | Status |
|---|---|---|---|
| Activity:Line Following | Behavior:Line Following | Line Sensing + Differential Drive | Implemented |
| Activity:Dead Reckoning Navigation | Behavior:Dead Reckoning | Optical Odometry + Differential Drive | Implemented |
| Activity:Maze Solving | Behavior:Wall Following + Navigation | Distance/Bump Sensing + Movement | Stub |
| Activity:Room Mapping | Behavior:SLAM | LIDAR + Odometry + Movement | Stub |
Algorithm Variations
Many behaviors have multiple algorithm variants. For example, Behavior:Line Following includes:
- One-sensor algorithm - Rotate until line found, drive forward, repeat (simple but choppy)
- Two-sensor algorithm - Turn toward whichever sensor detects the line (smooth beginner approach)
- Multi-sensor array with PID - Proportional control for smooth, fast tracking (advanced)
Good behavior documentation should:
- Describe multiple approaches (from simple to advanced)
- Explain trade-offs (speed vs complexity, smoothness vs code simplicity)
- Provide pseudocode for each variant
- Show when to use each variant
How to Use Behavior Pages
Each Behavior page provides:
- Overview - What the behavior does and why it matters
- Algorithm description - Step-by-step logic in plain language
- Pseudocode - Language-agnostic code structure
- Variants - Different approaches (simple, intermediate, advanced)
- Tuning parameters - Variables you can adjust (speed, thresholds, gains)
- Required capabilities - What hardware is needed
- Activities enabled - What this behavior allows robots to do
- Implementation links - Robot-specific code examples
Implementing Behaviors on Your Robot
Want to implement a behavior on your robot?
- Read the behavior page - Understand the algorithm
- Verify capabilities - Ensure your robot has required sensors/actuators
- Choose a variant - Pick an algorithm complexity that fits your needs
- Study the pseudocode - Understand the logic flow
- Write code for your platform - Translate to Python, C++, Arduino, etc.
- Test incrementally - Start simple, verify each step works
- Tune parameters - Adjust speeds, thresholds, timing
- Document it! - Create an implementation page for your robot
- Share your results - Help others learn from your experience
Pseudocode Standards
BRS behavior documentation uses consistent pseudocode conventions:
- Indentation shows control flow (loops, conditionals)
- CAPS_WITH_UNDERSCORES for configuration constants
- camelCase for variables
- Comments explain the "why", not just the "what"
- Functions are named with action verbs (driveForward, readSensor)
This makes pseudocode easy to translate to any real programming language.
Contributing New Behaviors
Want to add a new behavior?
Consider:
- Is it distinct? - Different from existing behaviors?
- Is it reusable? - Can it enable multiple activities?
- Is it well-understood? - Can you explain the algorithm clearly?
- Can you provide variants? - Simple and advanced approaches?
Then:
- Create a Behavior page using Template:Behavior
- Describe the algorithm in plain language
- Provide clear pseudocode
- Explain tuning parameters and trade-offs
- Show which capabilities it requires
- List activities it enables
- Implement it on your robot
- Create implementation documentation with real code
See Also
- Robotics Ontology - How Behaviors fit into the BRS knowledge structure
- Activities - What behaviors enable robots to accomplish
- Capabilities - Hardware that behaviors require
- SimpleBot - BRS's first robot, demonstrating two behaviors