- Bug algorithms are inspired by ants 04/21/2019
- Bug algorithms do not assume global knowledge, they only assume local knowledge of the environment and a global goal
- Behaviors are
- Follow a wall
- Move in a straight line toward a goal
- Blog post borrows from motion planning lecture slides of Howie Choset
Assumptions
- Known direction to goal. Robot can measure distance d(x,y) and between points x and y
- Local sensing: walls/obstacles, encoders for odometry
- Reasonable world
- finitely many obstacles in any finite area
- a line will intersect an obstacle finitely many times
- Workspace is bounded
- The world has a finite area
Routines
- follow_wall():
- Move along the length of the obstacle til you get to the end of it. There will be free space at the end of the wall
- go_to_point(p):
- Move in a straight line to point p.
Flavors
- Bug 0
- Robot orients itself to face goal position
- If there are no obstacles between robot and goal (or in the robot’s locale), go_to_point(goal)
- If there is an obstacle, turn left and follow_wall()
- Go to (a)
Fails in this world. Algorithm is not complete.
2. Bug 1
- Robot orients itself to goal position.
- go_to_point(goal)
- If there is an obstacle, follow_wall() along entire obstacle til you get to start position. On your way, store your coordinate closest to goal
- Move from start position to that coordinate. Make current position start position
- Go to (a)
Bug 1 basically first scouts the environment to find a way around the obstacle that gets the robot closer to the goal. It then goes back to its start position and moves to that position.
3. Bug 2
- Draw m-line, a straight line from start to goal position.
- Orient robot in m-line direction and go_to_point(goal)
- If there is an obstacle, follow wall til robot intersects m-line again at a point closer to goal than start position. Update current position as start position
- Go to (b)
Bug 2 illustration
Bug 1 vs Bug 2
- Both are complete algorithms
- Bug 1 is an exhaustive search algorithm. It looks at all choices before commiting.
- Bug 2 is a greedy algorithm. It takes the first thing that looks better.
- Bug 2 outperforms Bug 1 in many cases.
- Bug 1 has a more predictive performance overall.