Behavior:Wall Following

From Bespoke Robot Society
Revision as of 16:48, 11 October 2025 by John (talk | contribs) (Claude edited based on my notes, prompt, and SimpleBot code repository)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Wall Following
Type Behavior (Algorithm)
Requires Capabilities Capability:Time-of-Flight Sensing or Capability:Ultrasonic Sensing, Capability:Differential Drive
Enables Activities Activity:Maze Solving
Difficulty Beginner
Status Stub - Algorithm not yet implemented


Wall Following is a behavior (algorithm) that maintains a constant distance from a wall while moving parallel to it.

Overview

This is a stub page. This behavior is not yet implemented in any BRS robot. This page exists to:

  • Document the algorithmic concept
  • Invite community members to implement it
  • Provide a starting point for algorithm design

Required Capabilities

This behavior requires:

Enables Activities

Implementing this behavior enables:

Algorithm Outline

Wall following uses distance sensing and proportional control:

  1. Measure distance to wall
  2. If distance < target: turn away from wall
  3. If distance > target: turn toward wall
  4. Drive forward

For maze solving, consistently follow left or right wall until exit is reached.

Pseudocode

# Wall Following
TARGET_DISTANCE = 20  # cm

while True:
    distance_to_wall = read_distance_sensor()
    error = distance_to_wall - TARGET_DISTANCE

    turn_adjustment = error * gain  # Proportional control

    left_speed = BASE_SPEED + turn_adjustment
    right_speed = BASE_SPEED - turn_adjustment

    set_motors(left_speed, right_speed)

Implementation Challenges

  • **Corners**: Detecting and handling inside/outside corners
  • **Gaps**: What to do when wall disappears (doorways, openings)
  • **Obstacles**: Handling objects protruding from wall
  • **Sensor placement**: Angled sensors vs perpendicular sensors

Contributing

Want to implement this behavior? Here's how:

  1. Study the algorithm outline above
  2. Implement in your language of choice (MicroPython, C++, Arduino)
  3. Test on a robot with the required capabilities
  4. Create an Implementation page (e.g., YourRobot:Wall Following Implementation)
  5. Update this page with algorithm refinements
  6. Share working code on GitHub

See Also