Behaviors

From Bespoke Robot Society
Jump to navigation Jump to search

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

Navigation Behaviors

Control Behaviors

Planning Behaviors

Mapping Behaviors

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:

  1. Overview - What the behavior does and why it matters
  2. Algorithm description - Step-by-step logic in plain language
  3. Pseudocode - Language-agnostic code structure
  4. Variants - Different approaches (simple, intermediate, advanced)
  5. Tuning parameters - Variables you can adjust (speed, thresholds, gains)
  6. Required capabilities - What hardware is needed
  7. Activities enabled - What this behavior allows robots to do
  8. Implementation links - Robot-specific code examples

Implementing Behaviors on Your Robot

Want to implement a behavior on your robot?

  1. Read the behavior page - Understand the algorithm
  2. Verify capabilities - Ensure your robot has required sensors/actuators
  3. Choose a variant - Pick an algorithm complexity that fits your needs
  4. Study the pseudocode - Understand the logic flow
  5. Write code for your platform - Translate to Python, C++, Arduino, etc.
  6. Test incrementally - Start simple, verify each step works
  7. Tune parameters - Adjust speeds, thresholds, timing
  8. Document it! - Create an implementation page for your robot
  9. 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:

  1. Is it distinct? - Different from existing behaviors?
  2. Is it reusable? - Can it enable multiple activities?
  3. Is it well-understood? - Can you explain the algorithm clearly?
  4. Can you provide variants? - Simple and advanced approaches?

Then:

  1. Create a Behavior page using Template:Behavior
  2. Describe the algorithm in plain language
  3. Provide clear pseudocode
  4. Explain tuning parameters and trade-offs
  5. Show which capabilities it requires
  6. List activities it enables
  7. Implement it on your robot
  8. Create implementation documentation with real code

See Also