Visibility Graph

advertisement
Visibility Graphs
Shmuel Wimer
Bar-Ilan Univ., Eng. Faculty
Technion, EE Faculty
May 2012
1
We would like to find a good path, rather than any feasible
path as done in motion planning.
Shortest path is usually good, but not necessarily the best.
Number of turns is important, speed is important, etc.
We consider only translating planar robot and seek shortest path.
May 2012
2
Roadmap Reminder
Free area obtained
Minkowski sum
Get trapezoids of
free area
Roadmap
construction
Find shortest path
in roadmap
This is not necessarily the shortest path
May 2012
3
Roadmap
Shortest path
Pstart
Pgoal
Shortest path
of roadmap
When BFS is used, path of minimum number of vertices is found.
For weighted roadmap Dijkstra’s algorithm can be used.
May 2012
4
L em m a : A ny shortest path betw een Pstart and Pgoal
am ong the set S of polygonl objects is a polygonal
path w hose inner vertices are of S .
P roof : If the shortest path
 w as not polygonal, it w ould
have a point p interior of free
space (not a vertex of S ), and
not contained in any line
segm ent of  ( otherw ise 
m ust be polygonal).
May 2012
5
A disc around p can be found and a short cut can
be established, yielding a paths shorter than  .
 is polygonal, and assum e it has a verte x  interior
of free area. A s before, a disc and a sh ortcut can be
established, yielding a shorter path.
Sim ilarly,  cannot lie on the interior o f an obstacle's
edge. O therw ise there w as a disc partially intersecting
the interior of the free area and a shor tacut couls be
found.
May 2012

6
Visibility Graph: Nodes are the vertices in S. Edge is defined
for each vertices visible to each other.
C orollary : T he shortest path betw een Pstart and Pgoal
am ong a set S of disjoint polygonal obstacles
consists of arcs of the visibility graph G vis  S
w here S  S
*
May 2012
P
start
*
,
, Pgoal  .
7
Shortest path
Pgoal
Pstart
May 2012
8
void S h ortestP ath ( S , p start , p goal ) {
G vis  V isibilityG raph ( S
p
start
, p goal  ) ;
A ssign w eigh t to each e  u , v   G vis ; // E uclide an length u v
Find shortest path from p start to p goal w ith D ijkstr a's algorithm ;
}
With n polygonal objects and O(n) nodes, naïve computation
of Gvis would take O(n3) time.
Dijkstra’s algorithm finds shortest path between two nodes of
n nodes and k arcs graph in O(nlogn + k) time.
It is possible to compute Gvis in O(n2logn) time.
May 2012
9
Computing the Visibility Graph
graph V isib ility G rap h ( S ) {
Initialize G  V , E  , V is all vertices of S , E   ;
 u V {
W  V isibleV ertices( u , S ) ;
 v  W { add e  u , v  to E }
} return G  V , E  ; }
Checking the visibility between two vertices, not much can
be done. All objects must be tested for intersection, taking
O(n) time. By ordering the vertices it is possible to accelerate
tests by using info obtained in previous tests.
May 2012
10
Scanning Ray – Rotational Planar Sweep
4
5
3
2
6
1
p
7
8
14
9
13
10
May 2012
12
11
11
The intersection status of edges with the scanning ray is stored
in a balanced binary tree T, were edges are stored at leaves. It
is possible by bi-section to locate the vertex w with respect to
the edges. It is visible from p if it falls left to the leftmost
(nearest to p) leaf.
If p and w are of the same
w
polygon w is invisible.
p
May 2012
12
e4
e3
e4
e6
e5
e2
e1
e5
e2
e1
e5
e3
e1
e2
e3
e6
e4
Scanning ray maintains a binary balances tree T. Vertices are
first sorted in clockwise order. Vertices are checked for visibility
and then incident edges are inserted and / or deleted to / from
T, depending on their position with respect to the scanning ray.
May 2012
13
All such operations take O(logn) time per vertex.
T is initialized by inserting all the edges intersecting the ray
of negative X axis (angle 0), an operation taking 0(nlogn)
time.
Vertices are sorted clockwise starting from angle 0.
May 2012
14
w2
c
initialize T :
w4
w1
g
w3
p
b
f
d
w7
w8
May 2012
a
w6
h
w5
 h,
f ,d,b
w1 T :
 h, g , d , b 
w2 T :
 h, g , d , c 
w3 T :
d,c
w4 T :
 
w5 T :
 h, e 
w6 T :
 h, e, d , a 
w7 T :
 h,
f ,d,a
w8 T :
 h,
f ,d,b
e
15
points V isib leV ertices ( p , S ) {
1. S ort vertices of S clockw ise w .r.t p . In case of
tie closer precedes farther. L et
 w1 ,
, w n  be the
points ;
2. C onstruct balanced search tree T sto ring edge
intersections w ith scanning ray ; Initialize T ;
W   ; // initialize visible point s
for ( i  1 to n ) { // traverse all points
if V isible ( p , w i ) { W  W
 wi 
} // visibility tes t
add / delete to / from T edges startin g / end in g at w i .
} return W ; }
May 2012
16
p
p
w i 1
w i 1
wi
wi
p
wi is visible
p
wi is not visible
w i 1
w i 1
wi
wi
All special cases can be detected at visibility test of wi
May 2012
17
boolean V isib le ( p , w i )
if ( pw i intersects w i 's object, locally at w i ) { return false}
// ordinary hiding tes t
else if (( i   1 ) || ( w i 1 is not on pw i )) {
find in T the leftm ost edge e ;
if (( e exists) & & pw i (intersects e )) { return false}
else { return true}
}
// colinea r p , w i 1 , w i
else if ( w i 1 is not visible) { return false}
e lse {
find in T e dge e intersecting w i 1 w i ;
if ( e exists) { return false}
else { return true} } }
May 2012
18
Probabilistic Roadmaps
Planar problems with translational robot (2 degrees of freedom)
are simple. Finding visibility graph explodes with degrees of
freedom increase.
Q - configurations space (coordinates, ro tation angle, etc.)
q  Q - a configuration
Q free - collision free configurations
 : Q free  Q free a local planner w hich for every
 q , q    Q free  Q free
returns eithe r a collision free path from q  to q , or  if such one
not exists.
d : QQ  R
May 2012

 0
is a distance function
19
Random roadmap construction
graph C on stru ctR oad M ap (# nodes: n , # closest neighbors k ) {
V   ; E   ; // initialization
w hile ( V  n ) { // find n nodes i n Q free
random ly dra w q  Q ; if ( q  Q free ) { V  V
 q
}
}
 q  V { g et N q  V , the k closest neighbors according to d }
q  N q {
if ( (
 q, q  E
) & & (   q, q   ) ) { E  E
  q , q  
}
}
}
May 2012
20
May 2012
21
Sampling Strategies
Random sampling works well in many practical cases involving
robots with large number of degrees of freedom. It is not well
performing when essential narrow passage exists, or when
more intensive sampling is required near obstacles.
Quasirandom is a deterministic alternative to random sampling,
ensuring better uniformity.
L et P be a sam ple of points in a space X , P  N .
H ow uniform ly P covers X ?
May 2012
22
Discrepancy provides a measure of how uniformly points
are distributed over a space X
R is a collection of axis-alined rectangu lar subsets
of X . R  R is a rectangle.  is a m easure.
T he discrepan cy of P w ith respect to range space R
over X is defined as D  P , R
  sup
RR
May 2012
 R
X


P
R
.
N
23
T he largest portion of X that contains no points of
P is called the dispersion  of point set P w ith
respect to the m etric    P ,    sup m in   x , p  .
x X
p P
For a sam ple P of N points in d -dim entiona l unit cube
there exists   P ,   
1
2  N
1 d


.
d
S o to obtain dispersion 
*
 1 
at least N  
.
* 
 2 
T o m inim ize dispersion grid sam pling is the best.
July 2011
24
For X   0,1  V an der C orpu t sequence gives a
set of sam ples that m inim izes both dispe rsion and
discrepancy.
Its n
th
sam ple is generated by using the binary
representation n 
T he n
th
 n 
May 2012
 i a i 2 , a i   0,1 .
i
elem ent,   n  , is defined as

i
ai 2
  i 1
.
25
1
T he first 16 sam ples are 0,
2
3
8
,
7
,
8
1
1
,
8
,
16
9
,
16
5
,
16
13
16
,
,
1
,
4
3
3
1
,
4
,
16
,
8
11
16
,
5
,
8
7
,
16
15
16
V an det C orput sequence can be used only for the
real line. H alton sequ en ce generalizes it to d
dim ensions.
G iven a sequence
 bi  =  2, 3, 5, 7, 
of prim e
num bers, an integer n is represented in b ase b j
by n 
May 2012

i
a ij b , a ij   0,1,
i
j
, b j  1 .
26
 b is defined as  b
j
T he n
th
j
n 
  i 1
 i a ij b j
.
sam ple is then defined by the
coordinates

n,

1
pn   b
May 2012
b
n,

2
,b
d
n .
27
Download