95
15-780: Graduate AI Lecture 2. Spatial Search Geoff Gordon (this lecture) Ziv Bar-Joseph TAs Michael Benisch, Yang Gu

15-780: Graduate AI Lecture 2. Spatial Search

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 15-780: Graduate AI Lecture 2. Spatial Search

15-780: Graduate AILecture 2. Spatial Search

Geoff Gordon (this lecture)Ziv Bar-Joseph

TAs Michael Benisch, Yang Gu

Page 2: 15-780: Graduate AI Lecture 2. Spatial Search

Admin

WEH 5409, Sep 18, 4:30-5:30pm: matlab tutorialPlease send your email address to TA Michael Benisch (mbenisch at cs), who is compiling a class email listPlease check the website regularly for readings (for Lec. 1–2, Ch. 1–4 of RN)

Page 3: 15-780: Graduate AI Lecture 2. Spatial Search

Last episode, on Grad AI

Page 4: 15-780: Graduate AI Lecture 2. Spatial Search

Topics covered

What is AI? (Be able to discuss an example or two)Types of uncertainty & corresponding approachesHow to set up state space graph for problems like the robotic grad student or path planning

Page 5: 15-780: Graduate AI Lecture 2. Spatial Search

Topics covered

Generic search algorithm & data structuresSearch methods: be able to simulate

BFS, DFS, DFIDHeuristic searchA*: define admissibility; show optimality, efficiency

What are advantages of each?

Page 6: 15-780: Graduate AI Lecture 2. Spatial Search

A* Planning on Big Grids

2D grids: 500,000 nodes = ~ 0.8 sec 10 million nodes = ~ 12 sec

Credit: Kuffner

Page 7: 15-780: Graduate AI Lecture 2. Spatial Search

A* on Big Grids

Page 8: 15-780: Graduate AI Lecture 2. Spatial Search

Projects

Page 9: 15-780: Graduate AI Lecture 2. Spatial Search

Project ideas

Plan a path for this robot so that it gets a good view of an object as fast as possible

Page 10: 15-780: Graduate AI Lecture 2. Spatial Search

Project ideas

Implement a distributed market-based planner and test the contribution of learning to overall performance

Page 11: 15-780: Graduate AI Lecture 2. Spatial Search

Project ideas

Give me an excuse to buy the new Lego Mindstorms set

plan footstep placementsplan how to grip objects

Page 12: 15-780: Graduate AI Lecture 2. Spatial Search

Spatial Planning

Page 13: 15-780: Graduate AI Lecture 2. Spatial Search

Plans in Space…

Last time, we saw A* for spatial planning

Optimal Solution End-effector Trajectory Probability of Obstacle Appearing Probability of Obstacle Appearing

Solu

tion

Cos

t

Stat

eEx

pans

ions

Figure 10: Environment used in our second experiment, along with the optimal solution and the end-effector trajectory (withoutany dynamic obstacles). Also shown are the solution cost of the path traversed and the number of states expanded by each ofthe three algorithms compared.

other words, by adding a fixed value to the key of each newstate placed on the queue, the old states are given a rela-tive advantage in their queue placement. When a state ispopped off the queue whose key value is not in line withthe current bias term, it is placed back on the queue with anupdated key value. The intuition is that only a small num-ber of the states previously on the queue may ever makeit to the top, so it can be much more efficient to only re-order the ones that do. We can use the same idea when εdecreases (from εo to εn, say) to increase the bias term by(εo − εn) · maxs∈OPEN h(sstart, s). The key value of eachstate becomeskey(s) = [min(g(s), rhs(s)) + ε · h(sstart, s) + bias,

min(g(s), rhs(s))].By using the maximum heuristic value present in the queueto update the bias term, we are guaranteeing that each statealready on the queue will be at least as elevated on the queueas it should be relative to the new states being added. It isfuture work to implement this approach but it appears to bea promising modification.

Finally, it may be possible to reduce the effect of un-derconsistent states in our repair of previous solution paths.With the current version of AD*, underconsistent states needto be placed on the queue with a key value that uses an un-inflated heuristic value. This is because they could reside onthe old solution path and their true effect on the start statemay be much more than the inflated heuristic would suggest.This means, however, that the underconsistent states quicklyrise to the top of the queue and are processed before manyoverconsistent states. At times, these underconsistent statesmay not have any effect on the value of the start state (forinstance when they do not reside upon the current solutionpath). We are currently looking into ways of reducing thenumber of underconsistent states examined, using ideas veryrecently developed (Ferguson & Stentz 2005). This couldprove very useful in the current framework, where much ofthe processing is done on underconsistent states that may notturn out to have any bearing on the solution.

ConclusionsWe have presented Anytime Dynamic A*, a heuristic-based,anytime replanning algorithm able to efficiently generate so-

lutions to complex, dynamic path planning problems. Thealgorithm works by continually decreasing a suboptimal-ity bound on its solution, reusing previous search efforts asmuch as possible. When changes in the environment areencountered, it is able to repair its previous solution incre-mentally. Our experiments and application of the algorithmto two real-world robotic systems have shown it to be a valu-able addition to the family of heuristic-based path planningalgorithms, and a useful tool in practise.

AcknowledgmentsThe authors would like to thank Sven Koenig for fruitfuldiscussions. This work was partially sponsored by DARPA’sMARS program. Dave Ferguson is supported in part by anNSF Graduate Research Fellowship.

ReferencesBarbehenn, M., and Hutchinson, S. 1995. Efficient searchand hierarchical motion planning by dynamically maintain-ing single-source shortest path trees. IEEE Transactions onRobotics and Automation 11(2):198–214.Barto, A.; Bradtke, S.; and Singh, S. 1995. Learning toAct Using Real-Time Dynamic Programming. ArtificialIntelligence 72:81–138.Bonet, B., and Geffner, H. 2001. Planning as heuristicsearch. Artificial Intelligence 129(1-2):5–33.Chakrabarti, P.; Ghosh, S.; and DeSarkar, S. 1988. Ad-missibility of AO* when heuristics overestimate. ArtificialIntelligence 34:97–113.Dean, T., and Boddy, M. 1988. An analysis of time-dependent planning. In Proceedings of the National Con-ference on Artificial Intelligence (AAAI).Edelkamp, S. 2001. Planning with pattern databases. InProceedings of the European Conference on Planning.Ersson, T., and Hu, X. 2001. Path planning and navigationof mobile robots in unknown environments. In Proceedingsof the IEEE International Conference on Intelligent Robotsand Systems (IROS).Ferguson, D., and Stentz, A. 2005. The Delayed D* Algo-rithm for Efficient Path Replanning. In Proceedings of the

Page 14: 15-780: Graduate AI Lecture 2. Spatial Search

What’s wrong w/ A* guarantees?

(optimality) A* finds a solution of depth g*(efficiency) A* expands no nodes that have f(node) > g*

Page 15: 15-780: Graduate AI Lecture 2. Spatial Search

What’s wrong with A*?

Discretized space into tiny little chunksa few degrees rotation of a jointLots of states ⇒ slow

Discretized actions tooonly allowed to move one joint at a time

Results in jagged paths

Optimal Solution End-effector Trajectory Probability of Obstacle Appearing Probability of Obstacle Appearing

Solu

tion

Cos

t

Stat

eEx

pans

ions

Figure 10: Environment used in our second experiment, along with the optimal solution and the end-effector trajectory (withoutany dynamic obstacles). Also shown are the solution cost of the path traversed and the number of states expanded by each ofthe three algorithms compared.

other words, by adding a fixed value to the key of each newstate placed on the queue, the old states are given a rela-tive advantage in their queue placement. When a state ispopped off the queue whose key value is not in line withthe current bias term, it is placed back on the queue with anupdated key value. The intuition is that only a small num-ber of the states previously on the queue may ever makeit to the top, so it can be much more efficient to only re-order the ones that do. We can use the same idea when εdecreases (from εo to εn, say) to increase the bias term by(εo − εn) · maxs∈OPEN h(sstart, s). The key value of eachstate becomeskey(s) = [min(g(s), rhs(s)) + ε · h(sstart, s) + bias,

min(g(s), rhs(s))].By using the maximum heuristic value present in the queueto update the bias term, we are guaranteeing that each statealready on the queue will be at least as elevated on the queueas it should be relative to the new states being added. It isfuture work to implement this approach but it appears to bea promising modification.

Finally, it may be possible to reduce the effect of un-derconsistent states in our repair of previous solution paths.With the current version of AD*, underconsistent states needto be placed on the queue with a key value that uses an un-inflated heuristic value. This is because they could reside onthe old solution path and their true effect on the start statemay be much more than the inflated heuristic would suggest.This means, however, that the underconsistent states quicklyrise to the top of the queue and are processed before manyoverconsistent states. At times, these underconsistent statesmay not have any effect on the value of the start state (forinstance when they do not reside upon the current solutionpath). We are currently looking into ways of reducing thenumber of underconsistent states examined, using ideas veryrecently developed (Ferguson & Stentz 2005). This couldprove very useful in the current framework, where much ofthe processing is done on underconsistent states that may notturn out to have any bearing on the solution.

ConclusionsWe have presented Anytime Dynamic A*, a heuristic-based,anytime replanning algorithm able to efficiently generate so-

lutions to complex, dynamic path planning problems. Thealgorithm works by continually decreasing a suboptimal-ity bound on its solution, reusing previous search efforts asmuch as possible. When changes in the environment areencountered, it is able to repair its previous solution incre-mentally. Our experiments and application of the algorithmto two real-world robotic systems have shown it to be a valu-able addition to the family of heuristic-based path planningalgorithms, and a useful tool in practise.

AcknowledgmentsThe authors would like to thank Sven Koenig for fruitfuldiscussions. This work was partially sponsored by DARPA’sMARS program. Dave Ferguson is supported in part by anNSF Graduate Research Fellowship.

ReferencesBarbehenn, M., and Hutchinson, S. 1995. Efficient searchand hierarchical motion planning by dynamically maintain-ing single-source shortest path trees. IEEE Transactions onRobotics and Automation 11(2):198–214.Barto, A.; Bradtke, S.; and Singh, S. 1995. Learning toAct Using Real-Time Dynamic Programming. ArtificialIntelligence 72:81–138.Bonet, B., and Geffner, H. 2001. Planning as heuristicsearch. Artificial Intelligence 129(1-2):5–33.Chakrabarti, P.; Ghosh, S.; and DeSarkar, S. 1988. Ad-missibility of AO* when heuristics overestimate. ArtificialIntelligence 34:97–113.Dean, T., and Boddy, M. 1988. An analysis of time-dependent planning. In Proceedings of the National Con-ference on Artificial Intelligence (AAAI).Edelkamp, S. 2001. Planning with pattern databases. InProceedings of the European Conference on Planning.Ersson, T., and Hu, X. 2001. Path planning and navigationof mobile robots in unknown environments. In Proceedingsof the IEEE International Conference on Intelligent Robotsand Systems (IROS).Ferguson, D., and Stentz, A. 2005. The Delayed D* Algo-rithm for Efficient Path Replanning. In Proceedings of the

Page 16: 15-780: Graduate AI Lecture 2. Spatial Search

What’s wrong with A*?

Page 17: 15-780: Graduate AI Lecture 2. Spatial Search

Wouldn’t it be nice…

… if we could break things up based more on the real geometry of the world?Robot Motion Planning by Jean-Claude Latombe

Page 18: 15-780: Graduate AI Lecture 2. Spatial Search

Physical system

A moderate number of real-valued coordinatesDeterministic, continuous dynamicsContinuous goal set (or a few pieces)Cost = time, work, torque, …

Page 19: 15-780: Graduate AI Lecture 2. Spatial Search

Typical physical system

Page 20: 15-780: Graduate AI Lecture 2. Spatial Search

A kinematic chain

Rigid links connected by joints

revolute or prismatic (1 dof each)

Configurationq = (q1, q2, …)

Page 21: 15-780: Graduate AI Lecture 2. Spatial Search

Mobile robots

Translating in space = 2 dof

Page 22: 15-780: Graduate AI Lecture 2. Spatial Search

More mobility

Translation + rotation = 3 dof

Page 23: 15-780: Graduate AI Lecture 2. Spatial Search

Q: How many dofs?

3d translation & rotation

Page 24: 15-780: Graduate AI Lecture 2. Spatial Search

credit: Andrew M

oore

Page 25: 15-780: Graduate AI Lecture 2. Spatial Search

Robot kinematic motion planning

Given a robot (coordinates q)… and a workspace with obstacles… get from a start to a goal

Page 26: 15-780: Graduate AI Lecture 2. Spatial Search

Kinematic planning

For any configuration q, can test whether it intersects obstaclesSet of legal configs is “configuration space” C (a subset of ℜdofs)

Path is a continuous function q from [0,1] into C with q(0) = qs and q(1) = qg

Page 27: 15-780: Graduate AI Lecture 2. Spatial Search

Note: dynamic planning

Includes inertia as well as configurationq, qHarder, since twice as many dofsMore later…

Page 28: 15-780: Graduate AI Lecture 2. Spatial Search

C-space example

Page 29: 15-780: Graduate AI Lecture 2. Spatial Search

More C-space examples

Page 30: 15-780: Graduate AI Lecture 2. Spatial Search

Another C-space example

image: J Kuffner

Page 31: 15-780: Graduate AI Lecture 2. Spatial Search

Topology of C-space

Topology of C-space can be something other than the familiar Euclidean worldE.g. set of angles = unit circle = SO(2)

not [0, 2π) !

Ball & socket joint (3d angle) ⊆ unit sphere = SO(3)

Page 32: 15-780: Graduate AI Lecture 2. Spatial Search

Topology example

Compare L to R: 2 planar angles v. one solid angle — both 2 dof (and neither the same as Euclidean 2-space)

Page 33: 15-780: Graduate AI Lecture 2. Spatial Search

Back to planning

Complaint with A* was that it didn’t break up space intelligentlyHow might we do better?Lots of roboticists have given lots of answers!

Page 34: 15-780: Graduate AI Lecture 2. Spatial Search

Shortest path in C-space

Page 35: 15-780: Graduate AI Lecture 2. Spatial Search

Shortest path in C-space

Page 36: 15-780: Graduate AI Lecture 2. Spatial Search

Shortest path

Suppose a polygonal C-spaceShortest path in C-space is a sequence of line segmentsEach segment’s ends are either start or goal or one of the vertices in C-spaceIn 3-d or higher, might lie on edge, face, hyperface, …

Page 37: 15-780: Graduate AI Lecture 2. Spatial Search

Visibility graph

http://www.cse.psu.edu/~rsharma/robotics/notes/notes2.html

Page 38: 15-780: Graduate AI Lecture 2. Spatial Search

Naive algorithm

For i = 1 … pointsFor j = 1 … points

included = tFor k = 1 … faces

if segment ij intersects face kincluded = f

Page 39: 15-780: Graduate AI Lecture 2. Spatial Search

Complexity

Naive algorithm is O(n3) in planar C-space (grows fast with d!)For algorithms that run faster, O(n2) and O(k + n log n), see [Latombe, pg 157]

k = number of edges that wind up in visibility graph

Once we have graph, search it!

Page 40: 15-780: Graduate AI Lecture 2. Spatial Search

Discussion of visibility graph

Good: finds shortest pathBad: complex C-space yields long runtime, even if problem is easy

get my 23-dof manipulator to move 1mm when nearest obstacle is 1m

Bad: no margin for error

Page 41: 15-780: Graduate AI Lecture 2. Spatial Search

Getting bigger margins

Could just pad obstaclesbut how much is enough? might make infeasible…

What if we try to stay as far away from obstacles as possible?

Page 42: 15-780: Graduate AI Lecture 2. Spatial Search

Voronoi

!1.5 !1 !0.5 0 0.5

!1

!0.5

0

0.5

1

Page 43: 15-780: Graduate AI Lecture 2. Spatial Search

Voronoi

Given a set of point obstaclesFind all places that are equidistant from two or more of themResult: network of line segmentsCalled Voronoi graphEach line stays as far away as possible from two obstacles while still going between them

Page 44: 15-780: Graduate AI Lecture 2. Spatial Search

Voronoi from polygonal C-space

Page 45: 15-780: Graduate AI Lecture 2. Spatial Search

Voronoi from polygonal C-space

Set of points which are equidistant from 2 or more closest points on border of C-spacePolygonal C-space in 2d yields lines & parabolas intersecting at points

lines from 2 pointsparabolas from line & point

Page 46: 15-780: Graduate AI Lecture 2. Spatial Search

Voronoi method for planning

Compute Voronoi diagram of C-spaceGo straight from start to nearest point on diagramPlan within diagram to get near goal (guess which algorithm)Go straight to goal

Page 47: 15-780: Graduate AI Lecture 2. Spatial Search

Discussion of Voronoi

Good: stays far away from obstaclesBad: assumes polygonsBad: assumes 2d, gets kind of hard in higher dimensions (but see http://voronoi.sbp.ri.cmu.edu/~motion/)

Page 48: 15-780: Graduate AI Lecture 2. Spatial Search

Voronoi discussion

Bad: kind of gun-shy about obstacles

Page 49: 15-780: Graduate AI Lecture 2. Spatial Search

Exact cell decompositions

We can try to break C-space into a bunch of convex polygons

Page 50: 15-780: Graduate AI Lecture 2. Spatial Search

Exact cell decompositions

Will not discuss how to doCommon approach for video game NPCsBut is also hard in higher than 2dAnd can result in wobbly paths

Page 51: 15-780: Graduate AI Lecture 2. Spatial Search

Approximate cell decompositions

Page 52: 15-780: Graduate AI Lecture 2. Spatial Search

Planning algorithm

Lay down a grid in C-spaceDelete cells that intersect obstaclesConnect neighborsA* (surprise!)If no path, double resolution and try again

never know when we’re done

Page 53: 15-780: Graduate AI Lecture 2. Spatial Search

Approximate cell decomposition

This decomposition is what we were using for A* in examples from last classWorks pretty well except:

need high resolution near obstacleswant low res away from obstacles

Page 54: 15-780: Graduate AI Lecture 2. Spatial Search

Fix: variable resolution

Lay down a coarse gridSplit cells that intersect obstacle borders

empty cells goodfull cells also don’t need splitting

Stop at fine resolutionData structure: quadtree

Page 55: 15-780: Graduate AI Lecture 2. Spatial Search
Page 56: 15-780: Graduate AI Lecture 2. Spatial Search
Page 57: 15-780: Graduate AI Lecture 2. Spatial Search
Page 58: 15-780: Graduate AI Lecture 2. Spatial Search
Page 59: 15-780: Graduate AI Lecture 2. Spatial Search

Discussion

Works pretty well, except:Still don’t know when to stopWon’t find shortest pathStill doesn’t really scale to high-d

Page 60: 15-780: Graduate AI Lecture 2. Spatial Search

Better yet

Adaptive decompositionSplit only cells that actually make a difference

are on path from startmake a difference to our policy

Page 61: 15-780: Graduate AI Lecture 2. Spatial Search

Parti-game paper

Andrew Moore and Chris Atkeson. The Parti-game Algorithm for Variable Resolution Reinforcement Learning in Multidimensional State-spaces http://www.autonlab.org/autonweb/14699.html

Page 62: 15-780: Graduate AI Lecture 2. Spatial Search
Page 63: 15-780: Graduate AI Lecture 2. Spatial Search
Page 64: 15-780: Graduate AI Lecture 2. Spatial Search
Page 65: 15-780: Graduate AI Lecture 2. Spatial Search
Page 66: 15-780: Graduate AI Lecture 2. Spatial Search

Parti-game algorithm

Try actions from several points per cellTry to plan a path from start to goalOn the way, pretend an opponent gets to choose which outcome happens (out of all that have been observed in this cell)If we can get to goal, we winOtherwise we can split a cell

Page 67: 15-780: Graduate AI Lecture 2. Spatial Search

Parti-game example

G

Start

Goal

G

G

G

Page 68: 15-780: Graduate AI Lecture 2. Spatial Search

9dof planar arm

Fixed

base

Start

Goal

85 partitions total

Page 69: 15-780: Graduate AI Lecture 2. Spatial Search

Potential-based algorithms

Page 70: 15-780: Graduate AI Lecture 2. Spatial Search

Potential-based algorithms

Add a fictitious force that moves us away from obstacles

stronger when closerAdd a force towards goalLocal minima galore …Or, expensive but cool ways to calculate potentials that don’t have local minima

Page 71: 15-780: Graduate AI Lecture 2. Spatial Search

Randomness in search

Page 72: 15-780: Graduate AI Lecture 2. Spatial Search

We can be very lucky or unlucky

Page 73: 15-780: Graduate AI Lecture 2. Spatial Search

“I heard onst of a barque,” said Murphy.“Becalmed, that couldn’t get a breath,Till all the crowd was sick with scurvyAn’ the skipper drunk himself to death.”

Doldrums: One Of Murphy's Yarnshttp://oldpoetry.com/opoem/56157 Cicely Fox Smith

Page 74: 15-780: Graduate AI Lecture 2. Spatial Search

Simple idea

Try multiple starting points, random seeds for order of expanding neighborsInterleave computation (or iterative lengthening)When does this work?

Page 75: 15-780: Graduate AI Lecture 2. Spatial Search

Randomization cont’d

Randomization works well if search times are sometimes short but have heavy tail

Page 76: 15-780: Graduate AI Lecture 2. Spatial Search

RRTs

We will come back to randomness for more planning algorithms laterFor now, here’s a randomized way of dividing up C-space that seems to work quite well in high-dimensionsRapidly-exploring Random Trees

Page 77: 15-780: Graduate AI Lecture 2. Spatial Search

RRTs

Put landmarks into C-spaceBreak up C-space into Voronoi regions around landmarksPut landmarks densely only if high resolution is needed to find a pathWill not guarantee optimal path

Page 78: 15-780: Graduate AI Lecture 2. Spatial Search

RRT assumptions

RANDOM_CONFIGsamples from some distribution on C-space; can use to bias search

EXTEND(q, q’)uses a local controller to head towards q’ from qstops before hitting obstacle

FIND_NEAREST(q, Q)

Page 79: 15-780: Graduate AI Lecture 2. Spatial Search

Path Planning with RRTs

BUILD_RRT (qinit) { T.init(qinit); for k = 1 to K do qrand = RANDOM_CONFIG(); EXTEND(T, qrand)}

EXTEND(T, qrand)

qnear

qne

w

qinitqrand

[ Kuffner & LaValle , ICRA’00]

RRT = Rapidly-Exploring Random Tree

Page 80: 15-780: Graduate AI Lecture 2. Spatial Search

RRT example

Plan

ar h

olon

omic

robo

t

Page 81: 15-780: Graduate AI Lecture 2. Spatial Search
Page 82: 15-780: Graduate AI Lecture 2. Spatial Search
Page 83: 15-780: Graduate AI Lecture 2. Spatial Search
Page 84: 15-780: Graduate AI Lecture 2. Spatial Search
Page 85: 15-780: Graduate AI Lecture 2. Spatial Search
Page 86: 15-780: Graduate AI Lecture 2. Spatial Search

RRT example

Page 87: 15-780: Graduate AI Lecture 2. Spatial Search

RRT for a car (3 dof)

Page 88: 15-780: Graduate AI Lecture 2. Spatial Search

RRTs explore coarse to fine

Tend to break up large Voronoi regions

Limiting distribution of vertices is RANDOM_CONFIG

Key idea in proof: as RRT grows, probability that qrand is reachable with local controller (and so immediately becomes a new vertex) approaches 1

In limit, we get a Voronoi cell decomposition

Page 89: 15-780: Graduate AI Lecture 2. Spatial Search

Planning with RRTs

Build RRT from start until we add a node that can reach goal using local controller(Unique) path: root → last node → goal

Optional: cross-link tree by testing local controller, search within tree using A*Optional: grow forward and backward

Page 90: 15-780: Graduate AI Lecture 2. Spatial Search
Page 91: 15-780: Graduate AI Lecture 2. Spatial Search
Page 92: 15-780: Graduate AI Lecture 2. Spatial Search
Page 93: 15-780: Graduate AI Lecture 2. Spatial Search
Page 94: 15-780: Graduate AI Lecture 2. Spatial Search
Page 95: 15-780: Graduate AI Lecture 2. Spatial Search

What you should know

C-spaceWays of splitting up C-space

Visibility graphVoronoiExact, approximate cell decompositionAdaptive cells (quadtree, parti-game)

Potential fieldsRRTs