2PP

CS 188: Artificial Intelligence
Fall 2006
Lecture 5: Robot Motion Planning
9/14/2006
Dan Klein – UC Berkeley
Many slides over the course adapted from either Stuart
Russell or Andrew Moore
Announcements
ƒ Project 1.2 is up (Single-Agent Pacman)
ƒ Critical update: make sure you have the most
recent version!
ƒ Reminder: you are allowed to work with a
partner!
ƒ Change to John’s section: M 3-4pm now in
4 Evans
1
Today
ƒ Local search
ƒ Robot motion planning
Local Search Methods
ƒ Queue-based algorithms keep fallback
options (backtracking)
ƒ Local search: improve what you have until
you can’t make it better
ƒ Generally much more efficient (but
incomplete)
2
Hill Climbing
ƒ Simple, general idea:
ƒ Start wherever
ƒ Always choose the best neighbor
ƒ If no neighbors have better scores than
current, quit
ƒ Why can this be a terrible idea?
ƒ Complete?
ƒ Optimal?
ƒ What’s good about it?
Hill Climbing Diagram
ƒ Random restarts?
ƒ Random sideways steps?
3
Iterative Algorithms for CSPs
ƒ Hill-climbing, simulated annealing typically work with
“complete” states, i.e., all variables assigned
ƒ To apply to CSPs:
ƒ Allow states with unsatisfied constraints
ƒ Operators reassign variable values
ƒ Variable selection: randomly select any conflicted
variable
ƒ Value selection by min-conflicts heuristic:
ƒ Choose value that violates the fewest constraints
ƒ I.e., hillclimb with h(n) = total number of violated constraints
Example: 4-Queens
ƒ
ƒ
ƒ
ƒ
States: 4 queens in 4 columns (44 = 256 states)
Operators: move queen in column
Goal test: no attacks
Evaluation: h(n) = number of attacks
4
Performance of Min-Conflicts
ƒ Given random initial state, can solve n-queens in almost constant
time for arbitrary n with high probability (e.g., n = 10,000,000)
ƒ The same appears to be true for any randomly-generated CSP
except in a narrow range of the ratio
Simulated Annealing
ƒ Idea: Escape local maxima by allowing downhill moves
ƒ But make them rarer as time goes on
5
Simulated Annealing
ƒ Theoretical guarantee:
ƒ Stationary distribution:
ƒ If T decreased slowly enough,
will converge to optimal state!
ƒ Is this an interesting guarantee?
ƒ Sounds like magic, but reality is reality:
ƒ The more downhill steps you need to escape, the less
likely you are to every make them all in a row
ƒ People think hard about ridge operators which let you
jump around the space in better ways
Beam Search
ƒ Like greedy search, but keep K states at all
times:
Greedy Search
ƒ
ƒ
ƒ
ƒ
Beam Search
Variables: beam size, encourage diversity?
The best choice in MANY practical settings
Complete? Optimal?
Why do we still need optimal methods?
6
Genetic Algorithms
ƒ Genetic algorithms use a natural selection metaphor
ƒ Like beam search (selection), but also have pairwise
crossover operators, with optional mutation
ƒ Probably the most misunderstood, misapplied (and even
maligned) technique around!
Example: N-Queens
ƒ
ƒ
ƒ
ƒ
Why does crossover make sense here?
When wouldn’t it make sense?
What would mutation be?
What would a good fitness function be?
7
Continuous Problems
ƒ Placing airports in Romania
ƒ States: (x1,y1,x2,y2,x3,y3)
ƒ Cost: sum of squared distances to closest city
Gradient Methods
ƒ How to deal with continous (therefore infinite)
state spaces?
ƒ Discretization: bucket ranges of values
ƒ E.g. force integral coordinates
ƒ Continuous optimization
ƒ E.g. gradient ascent
Image from vias.org
8
Robot motion planning!
Robotics Tasks
ƒ Motion planning (today)
ƒ How to move from A to B
ƒ Known obstacles
ƒ Offline planning
ƒ Localization (later)
ƒ Where exactly am I?
ƒ Known map
ƒ Ongoing localization (why?)
ƒ Mapping (much later)
ƒ What’s the world like?
ƒ Exploration / discovery
ƒ SLAM: simultaneous localization and
mapping
9
Mobile Robots
ƒ High-level objectives: move
around obstacles, etc
ƒ Low-level: fine motor control to
achieve motion
ƒ Why is this hard?
Immovable
Obstacles
Start
Configuration
Goal Configuration
Manipulator Robots
ƒ High-level goals: reconfigure
environment
ƒ Low-level: move from configuration
A to B (point-to-point motion)
ƒ Why is this already hard?
ƒ Also: compliant motion
10
Sensors and Effectors
ƒ Sensors vs. Percepts
ƒ Agent programs receive
percepts
ƒ Agent bodies have sensors
ƒ Includes proprioceptive
sensors
ƒ Real world: sensors break,
give noisy answers,
miscalibrate, etc.
ƒ Effectors vs. Actuators
ƒ Agent programs have
actuators (control lines)
ƒ Agent bodies have effectors
(gears and motors)
ƒ Real-world: wheels slip,
motors fail, etc.
Degrees of Freedom
ƒ The degrees of freedom are the
numbers required to specify a robot’s
configuration
ƒ Positional DOFs:
ƒ (x, y, z) of free-flying robot
ƒ direction robot is facing
2 DOFs
ƒ Effector DOFs
ƒ Arm angle
ƒ Wing position
ƒ Static state: robot shape and position
3 DOFs
ƒ Dynamic state: derivatives of static
DOFs (why have these?)
Question: How many
DOFs for a polyhedron
free-flying in 3D space?
11
Example
ƒ How many DOFs?
ƒ What are the natural
coordinates for specifying the
robot’s configuration?
ƒ These are the configuration
space coordinates
ƒ What are the natural
coordinates for specifying the
effector tip’s position?
ƒ These are the work space
coordinates
Example
ƒ How many DOFs?
ƒ How does this compare to your arm?
ƒ How many are required for arbitrary positioning of
end-effector?
12
Holonomicity
ƒ Holonomic robots control
all their DOFs (e.g.
manipulator arms)
ƒ Easier to control
ƒ Harder to build
ƒ Non-holonomic robots do
not directly control all
DOFs (e.g. a car)
Configuration Space
ƒ Workspace:
ƒ The world’s (x, y) system
ƒ Obstacles specified here
ƒ Configuration space
ƒ The robot’s state
ƒ Planning happens here
ƒ Obstacles can be
projected to here
13
Kinematics
ƒ Kinematics
ƒ The mapping from
configurations to workspace
coordinates
ƒ Generally involves some
trigonometry
ƒ Usually pretty easy
ƒ Inverse Kinematics
ƒ The inverse: effector
positions to configurations
ƒ Usually non-unique (why?)
Forward kinematics
Configuration Space
ƒ Configuration space
ƒ Just a coordinate system
ƒ Not all points are
reachable / legal
ƒ Legal configurations:
ƒ No collisions
ƒ No self-intersection
14
Obstacles in C-Space
ƒ What / where are the obstacles?
ƒ Remaining space is free space
More Obstacles
15
Topology
ƒ You very quickly get into
issues of topology:
ƒ Point robot in 3D: R3
ƒ Directional robot with fixed
position in 3D: SO(3)
ƒ Two rotational-jointed robot in
2D: S1xS1
ƒ For the present purposes, we’ll
just ignore these issues
ƒ In practice, you have to deal
with it properly
Example: 2D Polygons
Workspace
Configuration Space
16
Example: Rotation
Example: A Less Simple Arm
17
Summary
ƒ Degrees of freedom
ƒ Legal robot configurations form
configuration space
ƒ Obstacles have complex images in cspace
Motion as Search
ƒ Motion planning as path-finding problem
ƒ Problem: configuration space is continuous
ƒ Problem: under-constrained motion
ƒ Problem: configuration space can be complex
Why are there two
paths from 1 to 2?
18
Decomposition Methods
ƒ Break c-space into discrete regions
ƒ Solve as a discrete problem
Exact Decomposition?
ƒ With polygon obstacles: decompose exactly
ƒ Problems?
ƒ Doesn’t scale at all
ƒ Doesn’t work with complex, curved obstacles
19
Approximate Decomposition
ƒ Break c-space into
a grid
G
ƒ Search (A*, etc)
ƒ What can go wrong?
ƒ If no path found, can
subdivide and
repeat
ƒ Problems?
ƒ Still scales poorly
ƒ Incomplete*
ƒ Wiggly paths
S
Hierarchical Decomposition
ƒ Actually used in practical
systems
ƒ But:
ƒ Not optimal
ƒ Not complete
ƒ Still hopeless
above a small
number of
dimensions
20
Skeletonization Methods
ƒ Decomposition methods
turn configuration space
into a grid
ƒ Skeletonization methods
turn it into a set of points,
with preset linear paths
between them
Visibility Graphs
ƒ Shortest paths:
ƒ No obstacles: straight line
ƒ Otherwise: will go from
vertex to vertex
ƒ Fairly obvious, but
somewhat awkward to prove
qgoal
ƒ Visibility methods:
ƒ All free vertex-to-vertex lines
(visibility graph)
ƒ Search using, e.g. A*
ƒ Can be done in O(n3) easily,
O(n2log(n)) less easily
qstart
ƒ Problems?
ƒ Bang, screech!
ƒ Not robust to control errors
ƒ Wrong kind of optimality?
21
Voronoi Decomposition
ƒ Voronoi regions: points colored by closest obstacle
Y
R
G
B
ƒ Voronoi diagram: borders between regions
ƒ Can be calculated efficiently for points (and polygons) in 2D
ƒ In higher dimensions, some approximation methods
Voronoi Decomposition
ƒ Algorithm:
ƒ Compute the Voronoi diagram
of the configuration space
ƒ Compute shortest path (line)
from start to closest point on
Voronoi diagram
ƒ Compute shortest path (line)
from goal to closest point on
Voronoi diagram.
ƒ Compute shortest path from
start to goal along Voronoi
diagram
ƒ Problems:
ƒ Hard over 2D, hard with
complex obstacles
ƒ Can do weird things:
22
Probabilistic Roadmaps
ƒ Idea: just pick random points
as nodes in a visibility graph
ƒ This gives probabilistic
roadmaps
ƒ Very successful in practice
ƒ Lets you add points where you
need them
ƒ If insufficient points, incomplete,
or weird paths
Roadmap Example
23
Potential Field Methods
ƒ So far: implicit preference for short paths
ƒ Rational agent should balance distance
with risk!
ƒ Idea: introduce cost for being close to an
obstacle
ƒ Can do this with discrete methods (how?)
ƒ Usually most natural with continuous
methods
Potential Fields
ƒ Cost for:
ƒ Being far from goal
ƒ Being near an
obstacle
ƒ Go downhill
ƒ What could go
wrong?
24