Professional Documents
Culture Documents
Lecture2 Bugs PoF
Lecture2 Bugs PoF
Lecture2 Bugs PoF
The slides are a compilation of work based on notes and slides from Morteza Lahijanian, Howie
Choset, Lydia Kavraki, Greg Hager, Mark Moll, G. Ayorkor Mills-Tetty, Hyungpil Moon, Zack
Dodds, Nancy Amato, Steven Lavalle, Seth Hutchinson, George Kantor, Dieter Fox, Vincent Lee-
Shue Jr., Prasad Narendra Atkar, Kevin Tantiseviand, Bernice Ma, David Conner, and other
members of previous versions of this class. HC wants to especially thank Greg Hager and Ji
Yeong Lee for their help in supplying template slides and figures.
Today’s topic: Bug Algorithms
• Bug 1 Algorithm
• Bug 2 Algorithm
Start
Why Bug Algorithms?
• Workspace:
• Notation: 𝑊
Goal
• Generally, either 2- or 3-dimensional
Euclidean space: ℝ2 or ℝ3
Start
• Obstacle 𝑖 in workspace 𝑊 is denoted by 𝑊𝑂𝑖
• Reasonable world:
Goal
1. finitely many obstacles in finite area
2. a line will intersect an obstacle finitely many times
3. workspace is bounded:
𝑊 ⊂ 𝐵𝑟 (𝑥), 𝑟 < ∞
Ball with
radius 𝑟
centered 𝐵𝑟 (𝑥) = { 𝑦 ∈ ℝ2 ∣ 𝑑(𝑥, 𝑦) < 𝑟 } Start
at 𝑥
The Bug Algorithms
• Assumptions
Start
Bugginer Strategy
𝑞start
how?
Bugginer Strategy
• Strategy:
1. head toward goal
2. follow obstacles until you can
head toward the goal again
3. continue
𝑞start
path?
“Bug 0” Algorithm
𝑞goal
“Bug 0” algorithm
done?
Bug Zapper
“Bug 0” algorithm
goal
1. head toward goal
2. follow obstacles until you can
head toward the goal again
3. continue
“Bug 0” algorithm
goal
1. head toward goal
2. follow obstacles until you can
head toward the goal again
3. continue
• Assumptions:
• known direction to goal
• otherwise local sensing
walls/obstacles & encoders
• Has memory
goal • Strategy:
1. head toward goal
2. if an obstacle is encountered,
circumnavigate it and
remember how close you get
to the goal
start 3. return to that closest point (by
wall-following) and continue
“Bug 1” Algorithm
𝑞start
“Bug 1” Algorithm
Algorithm: Bug 1
Algorithm: Bug 1
𝐷 𝑃2 Lower bound: 𝐷
What’s the shortest
distance it might travel?
𝑃1 Upper bound:
What’s the longest
distance it might travel?
𝑞start
“Bug 1” Analysis
𝐷 𝑃2 Lower bound: 𝐷
What’s the shortest
distance it might travel?
3
𝑃1 Upper bound: 𝐷 + ∑ 𝑃𝑖
What’s the longest
distance it might travel?
2
𝑞start
“Bug 1” Analysis
• Definition (Completeness):
• an algorithm is complete if, in finite time, it finds a path if such a path exists
or terminates with failure if it does not
𝑞goal
“Bug 1” algorithm
• Strategy:
1. head toward goal
2. If an obstacle is encountered,
circumnavigate it and
remember how close you get
to the goal
3. return to that closest point (by
wall-following) and continue
𝑞start
Better Bug?
𝑞goal B
“Bug 1” algorithm
• Strategy:
1. head toward goal
2. If an obstacle is encountered,
A circumnavigate it and
remember how close you get
to the goal
3. return to that closest point (by
wall-following) and continue
𝑞start
Better Bug?
𝑞start
“Bug 2” Algorithm
𝑞goal
“Bug 2” algorithm
done?
𝑞start
“Bug 2” Algorithm
“Bug 2” algorithm
start
done?
Goal NO! How do we fix this?
“Bug 2” Algorithm
“Bug 2” algorithm
Algorithm: Bug 2
Draw worlds in which Bug 2 does better than Bug 1 (and vice versa).
𝑞start
“Bug 1” VS “Bug 2”
Bug 1
Bug 2 – partial strategy
“Bug 1” VS “Bug 2”
Lower bound:
What’s the shortest
𝐷
distance it might travel?
Upper bound:
What’s the longest
distance it might travel?
Lower bound:
What’s the shortest
𝐷
distance it might travel?
1
Upper bound: 𝐷 + ∑ 𝑛𝑖 𝑃𝑖
What’s the longest 2
distance it might travel?
𝑈: ℝ𝑚 → ℝ
• Gradient is a vector
𝑇
𝑇
𝜕𝑈 𝑞 𝜕𝑈 𝑞
∇ 𝑈 𝑞 = 𝐷𝑈 𝑞 = ,…,
𝜕𝑞1 𝜕𝑞𝑚
• Potential functions viewed as landscapes moving the robot from high-value state
to low-value state
𝑐ሶ = −∇ 𝑈 𝑐(𝑡)
• Hessian matrix
𝜕2𝑈 𝜕2𝑈
⋯
𝜕𝑞12 𝜕𝑞1 𝜕𝑞𝑛
𝐻= ⋮ ⋱ ⋮ maximum
𝜕2𝑈 𝜕2𝑈
⋯
𝜕𝑞1 𝜕𝑞𝑛 𝜕𝑞𝑛2
• In gradient descent,
𝑈 𝑞 = 𝑈𝑎𝑡𝑡 𝑞 + 𝑈𝑟𝑒𝑝 𝑞
𝑈𝑎𝑡𝑡 attracts the robot (goal) and 𝑈𝑟𝑒𝑝 repels the robot (obstacles)
• Designing 𝑈𝑎𝑡𝑡
• Idea:
• 𝑞 𝑖 : value of 𝑞 at iteration 𝑖
• Brushfire algorithm:
• …
• Called Brushfire because the fire (obstacle value) grows from each of the
obstacles until it consumes all of the free-space cells
Computing Distance – Brushfire Algorithm
• Brushfire algorithm:
Computing Distance – Brushfire Algorithm
• if multiple neighbors with the same lowest value, just simply pick one
• Use a grid
• Wave-front algorithm
• …
• Wave-front algorithm
Wave-Front Planner
• All the points on the wave front have the same Manhattan distance
• Wave-front planner essentially forms a potential function on the grid, which has
only one local minimum
• Wave-front planner
• Discretization-based approach and uses only 𝑈𝑎𝑡𝑡 (removes obstacles)
• Resolves local minima problem
• Complete planner w.r.t. discretization
• Suffers from state-explosion problem in high dimensions