Project number: Project acronym: Title: IST-2001-39250 MOVIE Motion Planning in Virtual Environments Deliverable No D 2.2: Trade-offs between preprocessing time and query time Short description: The paths generated by a PRM usually contain self-loops and long detours, unnecessary motions and sharp turns. It is therefore necessary to find methods for generating more natural-looking motion paths. We describe various techniques for generating natural-looking motion paths for moving entities amidst a set of obstacles. We separate postprocessing techniques – which typically take a path generated from a PRM and make it shorter and smoother – and preprocessing techniques, which use data structures that can output more natural motion paths when given motion-planning queries. We also survey the progress made for infrastructure for robust collision-detection in 3D, and describe how we can preprocess the scene for quickly answering interference queries. Due month: Delivery month: Partners owning: Partners contributed: Classification: 24 24 TEL AVIV UU/CNRS-LAAS/TELAVIV/KINEO Public Project funded by the European Community under the “Information Society Technologies” Programme (1998-2002). Tradeoffs between Preprocessing Time and Query Time Producing Natural-Looking Motion Paths A central goal of the MOVIE project is to plan motion paths of entities in virtual environments that will be not just collision-free (i.e. the entities should not penetrate any static or moving obstacles and should not collide with one another) but also natural-looking. By “natural-looking” we mean that each entity should select a path that will be as close as possible to the path a human would take in the same scene to reach the goal configuration from its start configuration. This essentially means the following: a) The path should be short – that is, it should not contain long detours when significantly shorter routes are possible; b) it should have a guaranteed amount of clearance – that is, the distance of any point on the path from the closest obstacle should not be lower than some prescribed value; c) it should be smooth, not containing any sharp turns. We note that requirements (b) and (c) may conflict with the first requirement (a) in case it is possible to considerably shorten the motion path by taking a shortcut through a narrow passage. In such cases we may prefer a path with less clearance (and perhaps containing sharp turns). Many motion planning techniques, with the Probabilistic Roadmap (PRM) method being a good example, generate low-quality motion paths. A PRM is a graph that is usually constructed by incrementally adding new configurations as graph vertices, trying to connect each new configuration with its nearest neighbors. However, in order to keep the PRM compact, we usually do not try to connect to configurations if they already belong to the same connected component, so no cycles are created and the resulting PRM is a forest (or a tree) of free configurations connected by straight line segments (in the configuration space). As a result, the paths that PRMs output usually contain unnecessarily long detours and even loops. Moreover, as these paths are sequences of straight line segments, they have first order discontinuities, namely they contain sharp turns. Most known techniques use smoothing as a postprocessing step to improve the path obtained from the PRM. While smoothing is generally good at removing artifacts (mainly loops) from the path, it is not good at finding alternative routes that differ considerably from the original one. PRMs with Cycles Nieuwenhuisen and Overmars [1] suggest an alternative approach for constructing the PRM: Let u and v be two configurations that belong to the same connected component, such that the length of the path from u to v is dPRM(u,v). We will add an edge connecting u and v, whose length is d(u,v) only if dPRM(u,v) > K·d(u,v), where K ≥ 1 is a parameter. This way it is possible to created cycles in the PRM, but only if these cycles are “useful”, namely when they allow taking a significant shortcut instead of a long detour. The parameter K controls the amount of cycles in the graph: If K = 1 then all cycles are allowed, while for K = ∞ no cycles are allowed and the resulting PRM is a forest. Once we have a PRM with cycles, we can query it with a start and a goal configuration by simply connecting these configurations to the graph and running Dijkstra's algorithm from the start configuration. This algorithm, if implemented in a naïve manner, may considerably increase the time needed to construct the PRM (the preprocessing time). This is because for computing dPRM(u,v) we should repeatedly execute Dijkstra's algorithm for every pair of vertices we try to connect. However, Nieuwenhuisen and Overmars devise a simple augmentation for Dijkstra's algorithm that helps keeping the construction time reasonable. Recall that during the execution of Dijkstra's algorithm the vertices are stored in a priority queue, sorted by their increasing distance from u. So we can simply do the following: • Once v is popped out of the queue, we can terminate the process, since we have dPRM(u,v) and need not proceed to other vertices. • Once we pop a vertex w such that dPRM(u, w) > K·d(u,v), we can terminate the process, since it is obvious that dPRM(u,v) > dPRM(u, w) and we do not connect u and v. The new connection technique for PRMs decreases the average path length and the variance of the path lengths without increasing the preprocessing time considerably. Another important advantage is that its allows extracting alternative routes from the roadmap, which is important for some applications, for example it allows for variation in the routes computer entities in a game take, or helps avoiding deadlock situations when multiple entities move in the same environment. Improved Smoothing Techniques Unfortunately, although a PRM with cycles produce shorter paths, there is no guarantee that these paths are indeed the shortest ones available. These paths also contain sharp turns, as they are still sequences of straight line segments. Geraerts and Overmars [2] focused on postprocessing motion paths extracted from PRMs with cycles. They suggest a two-phase approach, where the first phase focuses on local path enhancements and is comprised of two steps: • Removal of redundant nodes. A node along the path (representing a free configuration) is considered redundant if its predecessor and its successor nodes can be connected using a straight line segment. Once a node is removed, new adjacencies are created along the path, so the removal process is performed iteratively. • Increasing clearance. The path is retracted to the medial axis of the obstacles. The resulting path may contain degenerate loops (known as branches or antennas), but they are easy to detect and remove. The second phase, called partial shortcut, aims to globally improve the path by removing redundant motions, and is suited for problems with a large number of degrees of freedom (DOFs). The main idea is to select a subset of the DOFs and to try to replace portions of the path by linearly interpolating on the set of selected DOFs (for example, we may wish to prevent unnecessary rotations when the entity translates along the path – see Figure 1 for an illustration). Figure 1 – Performing partial shortcut on the path to the left yields the path on the right, without the redundant rotations. Experiments show that the path length can be decreased considerably by removing redundant nodes and by enhancing the path clearance. The partial shortcut technique is able to remove redundant motions. The main disadvantage in this scheme is that it may add a few seconds to the query time (especially if partial shortcuts are applied), as it has to be performed as a postprocessing stage. The LAAS/Kineo group uses the Dubins steering method as a postprocessing step for producing natural-looking trajectories for moving entities. The initial motion path, generated using a PRM with cycles, is first optimized by eliminating any loops it may contain, they the Dubins method is applied to produce a smooth trajectory. The steering method is robust, having a low computational cost, and produces smooth trajectories formed by straight segments and circular arcs. Humanoids using the Dubins steering method can only walk on a fixed plane. In order to let them walk in a multi-level building with floors and stairs between them, an enhanced steering method , which allows planning on uneven terrains, is used. Improved Roadmap Generation Another drawback in having a postprocessing stage is that it may significantly modify the original path. Suppose we associate a weight with each of the PRM edges, according to some optimization criterion we wish to pursue. Using this weighting function Dijkstra's algorithm can compute the best path available in the PRM with respect to our optimization criterion, but after this path is postprocessed we can guarantee nothing about its optimality any more. A good example is the application of motion-planning for coherent groups of entities in a two-dimensional environment cluttered with obstacles. Kamphuis and Overmars [3] solve this problem by planning a collision-free path π from the start location to the goal for a single entity (a small disc). The entities are constrained to a group shape, which has a constant area A during traversal of the path. The group shape is constructed symmetrically about the path π and has a “pear”-like shape, created by sweeping a disc (with a diameter equal to the preferred group width w) along the path from the current position of the group. The disc becomes smaller only when it collides with obstacles. That is, its radius becomes equal to the amount of clearance along the path. This sweep extends along the path to the point where the total swept area by the disk becomes equal to the desired group area A. The motions of the individual entities inside the “pear”-like shape are governed by a potential field. A natural weighting criterion for this application is the time it takes the group to traverse an edge. While being proportional to the edge length, the clearance of the edge must also be taken into account, as the group needs more time to pass through a narrow passage. However, if we use a PRM with cycles and obtain a path from it, we will have to smooth it in order to achieve natural group behavior along the path. Nieuwenhuisen et al. [4] describe a method for constructing an enhanced PRM with cycles, guaranteeing that the paths generated from this PRM are smooth (C1continuous) and always keep some minimum amount of clearance from the obstacles in the scene. The preprocessing stage of constructing the PRM is performed as follows: 1. When a free configuration is randomly selected, we retract it to the Voronoi diagram (the medial axis) of the obstacles. This is done by identifying the pair of closest obstacles to the configuration and moving it so it will be equidistant from these obstacles. 2. When two configurations are connected by a straight line segment, this segment may get very close to the obstacles. The edges are therefore retracted to the Voronoi diagram as well. This is done by adding intermediate nodes (configurations) along them and retracting them to the Voronoi diagram. 3. In order to remove first order discontinuities, circular blends are added to the roadmap (see Figure 2). The radius of the circular blend is selected such that its clearance does not fall below some predefined threshold. Figure 2 – Adding circular blends to a node of degree 2 (left) and to a node of degree 4 (right). Whenever an entity has to move to a new location, it can search the graph in real-time to plan its route through the environment. To obtain a path we first need to connect the current position of the entity to the graph. This can easily be done by finding the closest vertex in the graph and connecting the current placement to this vertex using circular blends. We proceed in the same way for the goal placement of the entity. Now we can use a shortest path algorithm in the graph to find the path between the current and goal positions. Because of the properties of the roadmap, paths will be short, have enough clearance from the obstacles, and are smooth. No postprocessing is required in this case and no overhead is incurred during the query stage. The VV(c)-diagram and the VV-Complex A different data structure, called the VV(c)-diagram, for planning natural motion paths in the plane amidst polygonal obstacles is introduced by Wein et al. [5]. Given a preferred clearance value c, we dilate the polygonal obstacles by a radius c and compute the visibility graph of the dilated obstacles. This visibility graph contains all shortest paths with a clearance of at least c from the obstacles. Moreover, as each convex polygon vertex becomes a circular arc of radius c, the valid visibility edges are bitangents to two circular arcs (note that the dilated polygon edges are also valid visibility edges). This guarantees that a shortest path extracted from such a visibility graph is C1-smooth, and contains no sharp turns. However, even though the original polygonal obstacles are disjoint, the dilated obstacles may no longer be disjoint, meaning that narrow, yet collision-free, passages can be blocked when we dilate the obstacles. It is clearly not possible to pass in such passages with a clearance of at least c, but we still wish to allow a path with the maximal clearance possible in these regions. To do this, we compute the portions of the free configuration space that are contained in at least two dilated obstacles, and add their intersection with the Voronoi diagram of the original polygons to our diagram. The resulting structure is called the VV(c)-diagram. It should be noted that if a path contains a portion of the Voronoi diagram it may not be smooth any more. This is however acceptable, as we consider making sharp turns inside narrow passages to be natural. An interesting observation is that for c = 0, the VV(c)-diagram equals the visibility graph, while for c = ∞ it equals the Voronoi diagram. Thus, the diagram interpolates between the visibility graph and the Voronoi diagram. Figure 3 – The VV(c)-diagram of four polygons inside a rectangular room. The dilated obstacles boundaries are drawn in blue, the Voronoi chains that are contained in the diagram are drawn in red and the visibility edges are drawn in dashed black lines. Given a start and a goal configuration we just have to connect them to the VV(c)diagram by computing the visibility edges from these configurations to the circular arcs and to the endpoints of the Voronoi chains in the diagram. We then compute the shortest path between the start and goal using Dijkstra's algorithm, with the proper weights associated with the diagram edges. The weighting function controls whether we prefer taking shortcuts through narrow passages on selecting longer routes with more clearance. Like the retracted PRM with circular blends, the construction the VV(c)-diagram is performed as a preprocessing stage, while the queries achieve run-time performance. The main advantage of the VV(c)-diagram is its deterministic nature: If constructed in an exact manner, it is guaranteed to contain the shortest possible paths. Moreover, due to the probabilistic nature of PRM method it is not complete, namely a PRM may fail to connect two configurations even if there exists a collision-free path between them. The VV(c)-diagram does not suffer from this drawback. In some cases, we may want to plan paths between two configurations using different c-values and select the best one. Wein et al. [5] further explain how to preprocess a scene of polygonal obstacles and to create a data structure called the VV-complex that can be used to efficiently plan motion paths for any start and goal configuration and any clearance value c, without having to explicitly construct the VV(c)-diagram for that c-value. The preprocessing time of constructing the VV-complex is O(n2 log n), where n is the total number of obstacle vertices, and the query takes O(n log n + k) time, where k is the number of edges encountered during the search. It is possible to construct both the VV(c)-diagram and the VV-complex in a robust manner, using costly exact arithmetic. However, once we have the data structure, we can query it using just floating-point arithmetic. This way we reduce the number of costly geometric operations in the query stage and perform the time-consuming computations only in the preprocessing stage. Collision Detection in 3D A basic operation for motion-planning in 3D is detecting collision between to objects, the moving entity and one of the obstacles. Let P and Q be two closed polyhedra in R3. The Minkowski sum of P and Q is the polyhedron: P ⊕ Q = { p + q | p∈ P, q ∈ Q }. In order to determine whether P and Q intersect we can simply check whether the origin is contained in P ⊕ -Q (where -Q is the polyhedron Q rotated by 180°). It should be noted that as the combinatorial structure of the Minkowski sum is invariant to translations of P or Q, then precomputing P ⊕ Q is especially desirable when the motion of the polygons is restricted to translations only,. Fogel and Halperin [6] present an exact implementation of an efficient algorithm that computes Minkowski sums of convex polyhedra in R3. Their implementation is complete in the sense that it does not assume general position, namely, it can handle degenerate input, and produces exact results. The key idea is to use a dual representation for a convex polyhedron. A well-known representation is the Gaussian map GP of a compact convex polyhedron P in R3 is a set-valued function from P to the unit sphere S2, which assigns to each point p the set of outward unit normals to support planes to P at p. Thus, an entire facet f of P is mapped under GP to a single point, which is the outward unit normal to f. An edge e of P is mapped to a geodesic segment GP (e) on S2 whose length is easily seen to be the exterior dihedral angle at e. And a vertex v of P is mapped by GP to a spherical polygon whose sides are the images under of edges incident to v. However, Fogel and Halperin use a modified representation called the cubical Gaussian map (CGM). The CGM CP of a polytope P in R3 is obtained by defining a similar mapping from P’s features to the six faces of the parallel-axis cube circumscribing the unit sphere, referred to as the unit cube, instead of mapping them to the unit sphere itself. The decomposition of the unit cube faces into maximal connected regions, so that the extremal point is the same for all directions within any region forms the CP. It is possible to show that CP⊕Q is the overlay of CP and CQ, so using the CGM representation of two convex polyhedra it is easy to construct the dual representation of their Minkowski sum (see Figure 34 for an illustration). Once the structure of the Minkowski sum is determined, it is possible to answer collision-detection queries very efficiently, as it is only necessary to check whether the origin is contained in the sum. Moreover, as this method is exact, it is possible to determine whether the two polygons just touch but do not penetrate one another, which is impossible to do in an approximate scheme. Figure 4 – A dioctagonal pyramid (above) and the Minkowski sum of two orthogonal dioctagonal pyramids (below). The figures on the left show the primal space, the middle ones show the corresponding cubical Gaussian roadmaps, while the figures on the right show the folding of the cubical map into 6 planar maps. References [1] D. Nieuwenhuisen, M.H. Overmars, Useful Cycles in Probabilistic Roadmap Graphs. Technical report UU-CS-2004-064, 2004. [2] R. Geraerts, M.H. Overmars, Clearance Based Path Optimization for Motion Planning. In IEEE International Conference on Robotics and Automation (ICRA'04) pp. 2386-2392, 2004. [3] A. Kamphuis, M.H. Overmars, Motion Planning for Coherent Groups of Entities. In IEEE International Conference on Robotics and Automation (ICRA'04) pp. 3815-3822, 2004. [4] D. Nieuwenhuisen, A. Kamphuis, M. Mooijekind, M.H. Overmars, Automatic Construction of High Quality Roadmaps for Path Planning. Technical report UUCS-2004-068, 2004. [5] R. Wein, J.P. van den Berg, D. Halperin, The Visibility-Voronoi Complex and Its Applications. Manuscript, submitted to the 21st ACM Symposium on Computational Geometry (SoCG’05). www.cs.tau.ac.il/~wein/publications/pdfs/vv_complex_TR.pdf [6] E. Fogel, D. Halperin, Exact an Efficient Construction of Minkowski Sums of Convex Polyhedra with Applications. Manuscript, submitted to the 21st ACM Symposium on Computational Geometry (SoCG’05). www.cs.tau.ac.il/~efif/collision_detection