Preprints of the Fourth IFAC Symposium on Robot Control September 19-21, 1994, Capri, Italy
PREPROCESSING FOR DETECTION
ACCELERA TION
OF
COLLISION
C. H. FEDROWITZ and R. KAMMULLER University of Siegen, Department of Electrical Engineering and Compurer Science, Siegen, Gennany
Abstract. This paper presents a method for fast and reliable collision detection in complex production cells which is part of the PC-based robot off-line programming system of the University of Siegen (Ropsus). The cell objects are composed of primitive solids. All solids are bounded by orthogonal boxes which can be tested for collision very fast only by checking their vertices. Based on Cameron's S-bound theory an algorithm for preprocessing has been derived which reduces the complexity of the production cell by eliminating most of the collision-free solids very fast, i. e . with time depending linearly on the number of solids. Key Words. Computer graphics, industrial robots , model reduction, simulation, off-line programming, collision detection
1. INTRODUCTION Timely detection of possibly colliding objects is one of several advantages which make off-line programming technics attractive for a wide area of robot applications. The obvious aim, however, can be missed easily by excessive demands of computational time for executing intersection algorithms used in geometrical computation. In addition collision detection should run in parallel to animation of usually complex models of robots and conveyances. Therefore the acceleration of interference detection is a necessary demand. This requirement becomes essential as soon as off-line programming methods have to be implemented on PC-hardware to develop low-cost systems. In case of constructive modeling systems it is a common method to reduce model complexity in order to gain computational time. A large amount of publications deal with such methods.
By Lozano-Perez and Wesley (1979), Lozano-Perez (1981, 1983) and Chen and Vidyasagar (1988) a configuration space method is used which maps the cell objects into a configuration space created by the robot axes. Because of the often complex shapes of the configuration space obstacles only the robot main axes are mapped to save memory and computational time. On the other hand this reduces the accuracy of the method. Furthermore the mapping of the obstacles into the configuration space is done by
discret methods, because in most cases an analytical description is not possible. But discrete mapping owns the disadvantage of computational inefficiency. Also variants, using a cartesian configuration space (Hormann, 1987), do not solve these problems. By Lozano-Perez and Wesley (1979) and Lozano-Perez (1981, 1983) swept volumes are introduced which allow to neglect the dimension of the robot and so to reduce its complexity. Nevertheless, dependent on the accuracy of the approximation of the cell objects, this causes a considerable loss of free motion space. Other publications (Ozaki et aI., 1984; Abramowski and Miiller, 1988; Bonner and Kelley, 1889; Cameron, 1989) use convex hulls to obtain a fast pre-
ses on the S-bound method of Cameron (1989) which claims to run linear in size of the constructive solid geometry (CSG) description. The method calculates better bounds for CSG structures from initial bounds, thus reducing the number of objects which finally have to be checked for intersection. Performance tests comprising different configurations of robot working cells confirm the linear timedependence of the method as expected.
( XillS, Y UIS' Z illS' x rubS' Y rubS' Z rubS) = (x 11ft' Y 11ft, Z Uft, X rub!' Y rub I , Z rubl)
n
(XUf2' Yllf2' ZlIf2. Xrub2, Yrub2. Zrub2) {(x, Y, z)!max(xUfl,XUf2):5x:5min(x ru blo Xrub2) 1\ max( Y1In ,Y 111'2) :5 Y :5 mine Y rubl ,Y rub2) 1\ max( Z Uft ,Z 11f2) :5 z:5 mine Z rub! ,Z rub2)}
(2) 2. APPLICATION OF THE S-BOUND-ALGORITHM FOR COLLISION DETECTION
2.1. Intersection Detection To detect the intersection between two convex polyhedra several sequential steps are recommended. The first step performs a linear refinement of primitive solids, used to compose complex cell objects, with unbalanced edge rate (e. g. a pillar). This is done by a linear division of only those edges which exceed an allowed edge rate. By this a set of smaller solids is created which is a good approximation of the original solid. So in contrast to the hierarchical refinement very fast a sufficient, only little free motion space removing approximation of the solid by smaller ones will be reached. In the second step the primitive solids as well as the refinement are covered by convex hulls. A favourable hull is the orthogonal bounding box, the edges of which are aligned with the axes of the world coordinate system. Such a hull can be described as follows: ( XIlf' Y IIf, Z IIf' x rub' Y rub' Z rub) = {(x, Y, z) ! xUf:5x:5x ru b 1\
The intersection test is very simple and fast, because only six comparisons are necessary for each pair of bounding boxes. The third step aims at the reduction of the solid set to limit the number of solids of a production cell which have to be examined for intersection. By this much computational time will be saved. For this purpose the S-bound algorithm, which fundamentals are described below, is used. The fourth and last step calculates the intersection of those solids for which step three is not able to provide a collision decision. This calculation is done by the Simplex algorithm (Fedrowitz, 1994) which is not subject of this paper.
2.2. Fundamentals of the S-bound Algorithm Using a CSG modeling system entities are described constructively. The resultant expression is equivalent to a binary tree, called CSG-tree, with the branch nodes ~, ® and e, where ~ stands for set union, ® for set intersection and e for set difference. The leaf nodes of the CSG-tree represent transformed and scaled primitive shapes. In case that the intersection between CSG-structures has to be detected, many modelling systems form convex hulls around the primitives. These hulls are used to describe bounds of validity, i. e. to separate a subset of RD outside of which the value of the corresponding node should be ignored. The bounding function is denoted by 6. It takes the node of a tree and returns the appropriate valid subset of RD.
(1)
Yllf:5y:5y rub 1\ Z IIf :5 Z :5 Z rub }
Therein the components ~,y and ~ state the left lower front vertex of the orto~onal bounding box. The components xrub ,yrub and Z rub state its right upper behind vertex. These vertices can be evaluated in a simple manner by searching the minimal and maximal vertex coordinates of the solids which shall be bounded. Two orthogonal boxes
The objective of using bounds on the CSG-structures is to prune the subset of space in which to search for collision. Extending constraint operations over every node of a CSG-tree requires bounding functions which do not change the normal semantics of the tree. As such a bounding function Cameron (1989) introduces the S(Super)-bound function.
and intersect if the Uf2 rub2 rub2 rub following orthogonal intersection box <
X
UfS'
YUfS' z.IIts' x rubS' YrubS'
Z
rubS
>
exists:
These functions together with the returned sets, called S-bounds, represent a constraint manipUlation system in which information about individual bounds, e. g. on primitives, are passed to other 790
subtrees. This enables the use of S-bounds in a preprocessing stage to reduce complexity of CSGstructures. The objective is to reduce the size of the bounds. To do this Cameron (1989) stated two theorems, that describe procedures for generating a new S-bound function from an old one. Since these procedures are implemented on tree structures, he named them upward- and downward-theorem. Theorem 1 (Upward-Theorem). Let r be a bounded tree with S-bound function B. If T is any subtree of r with immediate subtrees T 1 and T~, then another S-bound function for r is given by B' , where {3' = {3 [T
~
S
n
(3( T) ]
and the set S is given by S =
{3( T d U (3( T 2) {3(Td n (3(T2) { (3(Td
,T = T 1ffiT 2 ,T = Tl®T2 ' T = T 1 8T 2
Theorem 2 (Downward-Theorem). Let r be a bounded tree with S-bound function B. If T is any subtree of r, and T' is an immediate subtree of T, then another S-bound function for r 1S
{3' = {3 [T'
~
(3( T)
n
(3( T' ) ]
Here f[T I- S] denotes a function that is equal to f everywhere, except that the value at T is replaced by the value S.
ditional graphic adapter, which is optimized for CAD and animation applications, is used. This adapter compensates the restricted numerical power of the computer and relieves it from complex operations like scaling, orienting and drawing of convex polyhedra, drawing the cell objects by means of shaded primitive solids. The model data are administered by means of a CSG-model which is strongly simplified, because boolean operations between the solids are not supported by the graphical subsystem. Therefore the binary ;tree used in the CSG-model to administer the cell objects degenerates to a linear list containing the successive, no syntactic attributes possessing primitive solids which reproduces a cell object by connecting surfaces, edges or vertices of suitable scaled and transformed solids. Also this model is strongly simplified it still enables a detailed mapping of any production cell. This solution only needs little memory capacity, because merely position, orientation and scaling of the primitives have to be saved. Moreover the computational costs are small, because the graphical subsystem calculates the data which are needed to draw the primitives. Considering the restraints of this geometrical model the S-bound algorithm was modified to be applicable to Ropsus. So at first each primitive is completed by a new attribute which describes the actual scope of such a primitive by means of a parameterized convex hull. For this purpose the complete CSG-list will be defined as follows:
The proofs of these theorems are given by Cameron (1989). To apply these theorems to a given CSG-structure one could choose the following procedural order: start with the computation of a set of initial Sbounds for every node of the tree, then repeatedly apply the upward theorem in a bottom-up manner and the downward theorem in a top-down manner for a given number of times.
Definition 1 (Complete CSG-List). The complete CSG-List of a cell object is composed of elements which contains the constructively described volume primitives in the order caused by the modeling process. Additionally each primitive is completed by its actual bound.
Cameron (1989) remarks, that convergence in finite time is ensured for S-bound bounding functions. When testing robot assemblies for intersection a three-fold iteration of the above procedure delivers good results and runs in linear time with the size of the CSG-tree.
2.4. The S-bound Method for CSG-Lists
If the S-bound method of Cameron (1989), which originally is deduced for syntactic CSG-trees, will be adapted to CSG-lists a relative simple set of rules is obtained by which the set of primitives can be reduced. While using the method bounding operations are executed on the CSG-structures. According to chapter 2.2 it is garanteed, that the bounding operations change only the object's scopes leaving the geometrical meaning of the model unchanged.
2.3. Model Description To manipulate a real production cell by a computer a method for mapping this cell to suitable data structures is needed. For this purpose a model of the real cell was developed which describes the geometry of the objects, their position and their relationship and which regards the properties of the used computer. So for runtime a PC-AT 486 with an ad-
To start the reduction algorithm appropriate boun-
791
test operations are only simple comparisons.
ding volumes are generated by applying an initial bounding function to the CSG-structures. Such a bounding function belongs to the class of S-bound functions which do not change the semantic of the CSG-structure.
Example of S-bounds. Using rule 1 the resultant bound of a list of primitive solids (complete CSGlist) will be computed. This is done forwardly, i. e. beginning with the primitives and ending with the whole list. As bounds orthogonal, appropriate parameterized boxes are used, because they demand only little computational time. Part a) and part d) of Fig . 1 show this forward process for the sublists T) and T 2. The resultant bounds will be intersected. If a common orthogonal intersection box does not exist, the primitives of both sublists are collisionfree. Otherwise, Fig. 1 S in part b) and S in part e), the collision bound will be processed b~ckward on both primitive lists by means of rule 2. According to rule 3 those primitives drop which lie outside the collision bound, Fig. 1 part c) and part f). They are collision-free, and so they need not be considered for further examinations. The primitive sets will be reduced extensively if the forward and backward rules are used repeatedly on both primitive lists.
Definition 2 (Initial Bounding Volume) . The initial bound for each primitive solid of the CSG-list is the orthogonal bounding box of minimal size. To execute the reduction algorithm the following rules will be applied to the cell objects. Rule 1 (Forward Rule). Let r be a complete CSG-list and T any sublist of r which consists of two successive sublists Tl and T 2· Let Hl and H2 are bounds of the sublists T 1 and T 2· The execution of the union operation to Hl and H 2 provides a new bound RH which is valid for the whole sublist T. The recursive application of this rule produces the resultant bounding volume of a cell object. Definition 3 (Collision Volume) . Let RH) and RH2 are the resultant bounding volumes of two objects. The intersection of RH) and RH2 provides a new bound which is named the collision volume of the two objects.
I-T 41
If this set operation provides a collision volume, which is equal to the 'empty set', the two objects are collision-free. Otherwise the following rules will be used for both objects.
..
.~
Rule 2 (Backward Rule). Let r be a complete CSG-list with the new bound RH called collision bound. Let T be any sublist of r with the already evaluated bound H . Then the intersection between RH and H provides a new, for T valid bound RH'. Rule 3 (Reduction Rule). Let r be a complete CSG-list with the new collision bound RH . Let T be any sublist of r with the already evaluated bound H. If the use of the backward rule to T, i. e. the intersection between RH and H, results in the 'empty set', the sublist T can be eliminated from the CSG-list r.
a)
b)
d)
e)
c)
Legend: ~
Elements of object 1
~
Elements of object 2
iIIIIIIIIlII Intersection set S
Rules 1 to 3 are processed iteratively to both objects which will be checked for collision .
g)
Cameron (1989) shows that the method converges against a collision bound which either is empty or contains only a few, closely arranged primitive volumes which are candidates for collision . Up to three iterations the operational costs of the S-bound method increase with O(n + m), i. e. linearly with the sum of the number of primitives n and m of both colliding objects. According to (2) the atomic
Fig. 1. Example of the reduction algorithm
3. PERFORMANCE TESTS The reduction algorithm implemented in Ropsus uses orthogonal bounding boxes in connection with a preceding linear refinement after which the modi-
792
fied S-bound method follows. To comment on the performance of this algorithm, it will be compared with a similar one. This algorithm uses a listwise test (commonly used in commercial systems) to reduce the primitive sets, i. e. it tests each object of the one list against each object of the other list. So the operational costs to evaluate those objects, which run the risk of collision, are O(n*m). Therein n is the number of objects in one of the lists and m is that number in the other list.
CSG-model to those ones which are in the risk of collision. For this the algorithm uses orthogonal bounding boxes in connection with special bounding operations. Additionally a linear refmement is used which accelerates the reduction process. This approach was adapted to the simplified CSG-model used in Ropsus. So the algorithm reduces the complexity of the cell model for the fmal collision test which bases on the Simplex algorithm.
By means of some representative production cells, from which a choice is given in Fig. 3 in the appendix, the behaviour of both approaches is examined according to the used PC-based system. The results are combined in Fig. 2. Therein the approach, which uses orthogonal boxes in connection with the modified S-bound method, is evidently faster. This is valid also for those cells (cells b, d and f), which are rotated 45 ° about the z-axis of the world coordinate system, because this is an unfortunate constellation for the S-bound method. The reasons for this performance advantage are the linear operational costs to reduce the primitive set, the collision test which only consists of simple comparisons and the little administrational costs for the linear li sts used exclusively.
5. ACKNOWLEDGEMENT The authors are grateful to ZESS (Centre for Sensor Systems, University of Siegen) for the support of the Ropsus project.
6. REFERENCES Abramowski, S., H. Miiller (1988). Collision avoidance for nonrigid objects. ZOR-Methods-andModels-of-Operations-Research, 32, No . 3-4, 165-186. Bonner, S., R. B. Kelley (1989). Planning 3-D collision-free paths. In: Proceedings of the IEEE Illternational Symposium on Intelligent Control, Albany, USA, pp. 550-555. Cameron, S. (1989). Efficient intersection tests for objects defined constructively. Intern. Journal of Robotics Research, 8, No. 1,3-25. Chen, Y.-c., M . Vidyasagar (1988). Optimal trajectory planning for planar n-link revolute manipulators in the presence of obstacles. In: Proceedings of the IEEE International Conference on Robotics and Automation, Philadelphia, USA, Vol. 1, pp. 202-208. Fedrowitz, C. H. (1994). A fast intersection detection algorithm for PC-based robot off-line programming. In: Proceedings of the European Symposium on Optics for Productivity in Manufacturing, Frankfurt/Main, Germany. Hormann, K. (1987). Kollisionsfreie Bahnenfur Industrieroboter - Ein Planungsverjahren. Springer-Verlag, Karlsruhe. Liu , Y.-H., S. Arimoto, H . Noborio (1991) . A new solid model HSM and its application to in. terference detection between moving objects. Journal of Robotic Systems , 8, No . I , 39-54. Lozano-Perez, T., M . A. Wesley (1979). An algorithm for planning collision-free paths among polyhedral obstacles. Communications of ACM, 22, No. 10, 165-175. Lozano-Perez, T. (1981) . Automatic planning of manipulator transfer movements . IEEE Transactions on Systems, Man and Cybernetics, 11, No. 10, 682-698. Lozano-Perez, T . (1983) . Spatial planning: a confi-
time in ms
900 800 700 600 500 400 300 200 100
o production cells I) listwise test
Fig. 2.
f
2) S-bounds
Computational times of the examined reduction algorithms
4 . CONCLUSION
The paper introduces a fast and efficient preprocessing algorithm for collision detection which is used in the PC-based robot off-line programming system Ropsus. In particular the algorithm takes into consideration the restricted performance of the used computer system as well as the huge complexity of real production cells. In essential parts it bases on the S-bound method published by Cameron (1989). In linear time it reduces the set of primitives of the
793
guration space approach. IEEE Transactions on Computers, 32, No. 2, 108-120. Ozaki, H., A. Mohri, M. Takata (1984). On the collision free movement of a manipulator. In: Advanced Software in Robotics (A. Danthine, M. Geradin, Ed.), pp.189-200, North-Holland,
Amsterdam. Udupa, S. M. (1977). Collision detection and avoidance in computer controlled manipulators. In: Proceedings of the 5th .International Joint Conference on Artificial Intelligence, Los Altos, USA, pp. 737-748.
6. APPENDIX
ceU_a: 177 primitives, thereof158 movable, 75 boxes, 54 wedges,8 pyramids, 2 cones, 36 cylinders, 2 spheres. time aUtogether/coUision test 300ms160 InS
ceU_b: 177 primitives, thereof 158 movable, 75 boxes, 54 wedges, 8 pyramids, 2 cones, 36 cylinders, 2 spheres. time aUtogether/coUision test : 410 msl170 InS
ceU_c: 182 primitives, thereof 158 movable, 80 boxes, 54 wedges, 8 pyramids, 2 cones, 36 cylinders, 2 spheres. time aUtogether/coUision test: 320 ms/8Oms
ceU_d: 182 primitives, thereof 158 movable, 88 boxes, 54 wedges, 8 pyramids, 2 cones, 36 cylinders, 2 spheres. time aUtogether/coUision test: 370 InS I 130ms
ceU_e: 196 primitives, thereof 158 moveable, 88 boxes, 62 wedges, 8 pyramids, 2 cones, 36 cylinders, 2 spheres. time aUtogether/coUision test: 320 ms/8Oms
ceUJ 255 primitives, thereof 226 movable, 113 boxes, 74 wedges, 10 pyramids, 3 cones, 52 cylinders, 3 spheres. time aUtogether/coDision test: 600 msl240 rns
Fig. 3. Overview of some production cells selected for performance tests
794