cs5247 slide template - artificial...

44
NUS CS 5247 David Hsu 1 Last lecture Path planning for a moving Visibility graph Cell decomposition Potential field Geometric preliminaries Implementing geometric primitives correctly and efficiently is tricky and requires careful thought.

Upload: others

Post on 20-Jun-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 1

Last lecturePath planning for a moving

Visibility graphCell decompositionPotential field

Geometric preliminariesImplementing geometric primitives correctly and efficiently is tricky and requires careful thought.

Page 2: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu

Configuration SpaceConfiguration Space

Page 3: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 3

What is a path?

Page 4: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 4

Rough ideaConvert rigid robots, articulated robots, etc. into pointsApply algorithms for moving points

Page 5: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 5

Mapping from the workspace to the configuration space

workspace configuration space

Page 6: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 6

Configuration spaceDefinitions and examplesObstaclesPaths

Page 7: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 7

Configuration spaceThe configuration of a moving object is a specification of the position of every point on the object.

Usually a configuration is expressed as a vector of position & orientation parameters: q = (q1, q2,…,qn).

The configuration space C is the set of all possible configurations.

A configuration is a point in C.

q=(q1, q2,…,qn)

qq11qq22

qq33

qqnn

Page 8: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 8

Topology of the configuration paceThe topology of C is usually not that of a Cartesian space Rn.

C = S1 x S1

φ

ϕ

0 2π

φ

ϕ

Page 9: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 9

Dimension of configuration spaceThe dimension of a configuration space is the minimum number of parameters needed to specify the configuration of the object completely.It is also called the number of degrees of freedom (dofs) of a moving object.

Page 10: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 10

Example: rigid robot in 2-D workspace

robot

reference point

x

reference direction

workspace

3-parameter specification: q = (x, y, θ ) with θ ∈[0, 2π).3-D configuration space

Page 11: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 11

Example: rigid robot in 2-D workspace4-parameter specification: q = (x, y, u, v) with u2+v2 = 1. Note u = cosθ and v = sinθ .

dim of configuration space = ???Does the dimension of the configuration space (number of dofs) depend on the parametrization?

Topology: a 3-D cylinder C = R2 x S1

Does the topology depend on the parametrization?

3

x

Page 12: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 12

Example: rigid robot in 3-D workspaceq = (position, orientation) = (x, y, z, ???)

Parametrization of orientations by matrix: q = (r11, r12 ,…, r33, r33) where r11, r12 ,…, r33 are the elements of rotation matrix

with r1i

2 + r2i2 + r3i

2 = 1 for all i ,r1i r1j + r2i r2j + r3i r3j = 0 for all i ≠ j,det(R) = +1

=

333231

232221

131211

rrrrrrrrr

R

Page 13: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 13

Example: rigid robot in 3-D workspaceParametrization of orientations by Euler angles: (φ,θ,ψ)

xx

y

zz

xxyy

zz

φφ

x

y

z

θ

xx

yy

zz

ψψ1 2 3 4

Page 14: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 14

Example: rigid robot in 3-D workspaceParametrization of orientations byunit quaternion: u = (u1, u2, u3, u4) with u1

2 + u22 + u3

2 + u42 = 1.

Note (u1, u2, u3, u4) = (cosθ/2, nxsinθ/2, nysinθ/2, nzsinθ/2) with nx

2 + ny2+ nz

2 = 1.

Compare with representation of orientation in 2-D:(u1,u2) = (cosθ, sinθ )

n = (nx, ny, nz)

θ

Page 15: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 15

Example: rigid robot in 3-D workspaceAdvantage of unit quaternion representation

CompactNo singularityNaturally reflect the topology of the space of orientations

Number of dofs = 6Topology: R3 x SO(3)

Page 16: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 16

Example: articulated robot

q = (q1,q2,…,q2n)Number of dofs = 2nWhat is the topology?

qq11

qq22

An articulated object is a set of rigid bodies connected at the joints.

Page 17: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 17

Example: protein backboneWhat are the possible representations?What is the number of dofs?What is the topology?

Page 18: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 18

Configuration spaceDefinitions and examplesObstaclesPaths

Page 19: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 19

Obstacles in the configuration spaceA configuration q is collision-free, or free, if a moving object placed at q does not intersect any obstacles in the workspace.The free space F is the set of free configurations.A configuration space obstacle (C-obstacle) is the set of configurations where the moving object collides with workspace obstacles.

Page 20: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 20

Disc in 2-D workspace

workspace configuration spaceworkspace

Page 21: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 21

Polygon robot translating in 2-D workspace

configuration space

workspace

Page 22: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 22

Polygon robot translating & rotating in 2-D workspace

configuration space

workspace

Page 23: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 23

Polygon robot translating & rotating in 2-D workspace

x

Page 24: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 24

Articulated robot in 2-D workspace

workspace configuration space

Page 25: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 25

Configuration spaceDefinitions and examplesObstaclesPaths

Page 26: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 26

Paths in the configuration space

A path in C is a continuous curve connecting two configurations q and q’ :

such that τ(0) = q and τ(1)=q’.

workspace configuration space

Css ∈→∈ )(]1,0[: ττ

Page 27: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 27

Constraints on paths

A trajectory is a path parameterized by time:

ConstraintsFinite lengthBounded curvatureSmoothnessMinimum lengthMinimum timeMinimum energy…

CtTt ∈→∈ )(],0[: ττ

Page 28: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 28

Free space topologyA free path lies entirely in the free space F.The moving object and the obstacles are modeled as closed subsets, meaning that they contain their boundaries.One can show that the C-obstacles are closed subsets of the configuration space C as well.Consequently, the free space F is an open subset of C. Hence, each free configuration is the center of a ball of non-zero radius entirely contained in F.

Page 29: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 29

Semi-free spaceA configuration q is semi-free if the moving object placed q touches the boundary, but not the interior of obstacles.

Free, orIn contact

The semi-free space is a closed subset of C. Its boundary is a superset of the boundary of F.

Page 30: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 30

Example

Page 31: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 31

Example

Page 32: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 32

Homotopic pathsTwo paths τ and τ’ with the same endpoints are homotopic if one can be continuously deformed into the other:

with h(s,0) = τ(s) and h(s,1) = τ’(s).

A homotopic class of pathscontains all paths that arehomotopic to one another.

Fh →× ]1,0[]1,0[:

Page 33: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 33

Exampleτ1 and τ2 are homotopicτ1 and τ3 are not homotopicInfinity number of of homotopy classes exists.

τ2

τ3

q

q’

τ1

R1 x S1

Page 34: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 34

Connectedness of C-SpaceC is connected if every two configurations can be connected by a path.C is simply-connected if any two paths connecting the same endpoints are homotopic.Examples: R2 or R3

Otherwise C is multiply-connected.Examples: S1 and SO(3) are multiply- connected:

In S1, infinite number of homotopy classesIn SO(3), only two homotopy classes

Page 35: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 35

Metric in configuration spaceA metric or distance function d in a configuration space C is a function

such thatd(q, q’) = 0 if and only if q = q’,d(q, q’) = d(q’, q),

0)',()',(: 2 ≥→∈ qqdCqqd

)',"()",()',( qqdqqdqqd +≤

Page 36: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 36

ExampleRobot A and a point x on Ax(q): position of x in the workspace when A is at configuration qA distance d in C is defined by

d(q, q’) = maxx∈A || x(q) − x(q’) ||

where ||x - y|| denotes the Euclidean distance between points x and y in the workspace.

q’q

Page 37: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 37

Examples in R2 x S1

Consider R2 x S1

q = (x, y, θ), q’ = (x’, y’, θ’) with θ, θ’ ∈ [0,2π)α = min { |θ − θ’| , 2π - |θ − θ’| }

d(q, q’) = sqrt( (x-x’)2 + (y-y’)2 + α2 ) )

d(q, q’) = sqrt( (x-x’)2 + (y-y’)2 + (αr)2 ), where r is the maximal distance between a point on the robot and the reference point

θθ’’

θθ

α

Page 38: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu

MinkowskiMinkowski SumSum

Page 39: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 39

ProblemInput:

Convex polygonal moving object translating in 2-D workspace Convex polygonal obstacles

Output: configuration space obstacles represented as polygons

Page 40: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 40

Minkowski sumThe Minkowski sum of two sets P and Q, denoted by P+Q, is defined as

P+Q = { p+q : p ∈P, q∈Q }

Similarly, the Minkowski difference is defined as

P – Q = { p–q : p∈P, q∈Q }

p

q

Page 41: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 41

Minkowski sum of convex polygonsThe Minkowski sum of two convex polygons Pand Q of m and n vertices respectively is a convex polygon P + Q of m + n vertices.

The vertices of P + Q are the “sums” of vertices of P and Q.

Page 42: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 42

ObservationIf P is an obstacle in the workspace and M is a moving object. Then the C-space obstacle corresponding to P is P – M.

P

M

O

Page 43: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 43

Computing C-obstacles

Page 44: CS5247 Slide Template - Artificial Intelligenceai.stanford.edu/~latombe/cs326/2009/class3/david.pdfmodeled as closed subsets, meaning that they contain their boundaries. One can show

NUS CS 5247 David Hsu 44

Computational efficiencyRunning time O(n+m) Space O(n+m) Non-convex obstacles

Decompose into convex polygons (e.g., triangles or trapezoids), compute the Minkowski sums, and take the unionComplexity of Minkowksi sum O(n2m2)

3-D workspace