Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

2013 IEEE/RSJ International Conference on

Intelligent Robots and Systems (IROS)


November 3-7, 2013. Tokyo, Japan

An Analytical Method to Detect Collision between Cylinders Using


Dual Number Algebra*
Rajeevlochana G. Chittawadigi and Subir K. Saha

Abstract— Cylinder, a common geometric entity has a Exact collision detection between two cylinders in the 3D
discontinuity at the joining of cylindrical surface and circular- Cartesian space, either for broad phase or narrow phase
disks. Hence, collision detection between two cylinders in space testing has been reported by few. Eberly [3] considered
is a difficult task and few have reported formulations to solve Separating Axis Tests (SAT) to determine overlap of two
it. In this paper, a novel analytical methodology is proposed to cylinders along certain directions (each of the cylinder axes, a
detect collision or intersection between two cylinders. The vector connecting the centers of the cylinders and vectors on
configuration, i.e., position and orientation, between the a plane perpendicular to each of cylinder axes and passing
cylinders was represented using the four Denavit-Hartenberg through their respective centers). It also required optimization
(DH) parameters plus two extra parameters. Dual Number of a function over a spherical surface. A method was
Algebra was used to extract these six parameters. Tests proposed by Ketchel and Larochelle [4] using line geometry
involved in collision detection between the cylinders were
to detect if two cylinders intersect, by determining the
between the lines and rectangles in a plane, thus considerably
simplifying the problem of collision detection. As an
common normal between the cylinder axes and the points
illustration, an one-DOF arm modeled as a cylinder with where the normal intersects the axes. Based on the condition
cylindrical shaped obstacles were modeled and tested for their of these points lying inside respective cylinders, different
collisions. The results were validated with an analytical method tests were proposed. However, detailed logical derivation
available in the literature and a commercial software. was not reported. Choi [5] reported cylinder as a Composite
Quadric Model (CQM), where cylindrical surface (quadric) is
I. INTRODUCTION bounded by a circular edge and plane on either side,
The term ‘cylinder’ typically refers to the volume bound collectively referred as boundary elements. As CQMs are
by a right-circular cylindrical surface and two circular disks semi-algebraic entities, firstly, algebraic methods were used
as end-caps. Along with spheres, cuboids, cones, etc., to compute contact points between all possible pairs of
cylinders are one of the main geometric primitives used in boundary elements. Secondly, the contact points were
Computer Graphics, Computer Aided Geometric Design and verified if they lay on the actual CQMs. Biermann et al. [6]
related areas. In applications related to Robotics, medical and used optimization techniques to determine the distance
surgical simulations, simulation of various processes, between different entities of cylinders (cylindrical surface,
intersection of different geometric objects in the environment circular edge and circular face). A concept of Minkowski
needs to be determined for realistic simulation, which is Portal Refinement (MPR) was used in XenoCollide [7] to
referred as ‘Collision Detection’. represent convex shapes, including cylinder, using a support
function and collision between two cylinders was reported
Collision detection, by itself is a very large field and using an iterative technique. XenoCollide has been
researchers have proposed different formulations for implemented in libccd [8], an open-source collision library
geometric objects of various shapes [1]. To simplify the for convex bodies. Kodam et al. [9] used cylinder-cylinder
process, typically, geometric objects (shapes) are enclosed intersection in Discrete Element Method (DEM) to simulate
inside simpler bounding volumes such as spheres, Axis the dynamics of particulate systems. They recognized six
Aligned Bounding Box (AABB), Oriented Bounding Box contact scenarios between bands (cylindrical surfaces), faces
(OBB), etc. and a broad phase test is done between the (circular faces) and edges (circular edges) and gave analytical
bounding volumes. If these volumes intersect, narrow phase expressions to determine the occurrence and type of contact.
testing is done between the actual geometry (shape) [2]. However, the axisymmetric nature of cylinders was not
Cylinder, though a very commonly used geometric entity, is exploited by them. Guo et al. [10] reported limitations with
usually not considered as a bounding volume because methodologies proposed by Kodam et al. [9] in certain
collision detection between two cylinders is reported [3] to be configurations of cylinders and proposed several additional
expensive. Instead, a capsule (cylinders with hemi-spherical tests and modifications to be incorporated for accurate tests
ends) has been suggested to be used as bounding volumes. between finite cylinders. The cylinder-cylinder collision
Note that the latter tests are quite simple. module in Teikitu Gaming System [11] also uses separating
axis tests but it is based on heuristic solutions and no formal
* This research was funded by BARC/ BRNS, Mumbai, India, under the derivation is available in open literature. An analytical
project, “Setting up of a Programme for Autonomous Robotics” at formulation was reported in [12] to find the proximity of two
IIT Delhi, India. cylinders in 3D space. Each cylinder comprised of four
R. G. Chittawadigi is an M.S. (Research) student in the Department of geometric primitives and shortest distance between five
Mechanical Engineering, Indian Institute of Technology Delhi, New Delhi, combinations of these primitives was used to conclude if two
India (e-mail: rajeevlochan.iitd@gmail.com).
S. K. Saha is a professor in the Department of Mechanical Engineering, cylinders collide or not. However, four of these were solved
Indian Institute of Technology Delhi, New Delhi, India (phone: +91 11 in closed form, whereas the fifth combination required
26591135; fax: +91 11 26582058; e-mail: saha@mech.iitd.ac.in). solution of an eighth-order polynomial equation.

978-1-4673-6358-7/13/$31.00 ©2013 IEEE 5353


In this paper, a novel analytical methodology is proposed A. Dual Angle
to detect collision between two finite cylinders in 3D space. It The concept of dual angle is now introduced which is used to
exploits the axisymmetric nature of the cylinders to simplify represent the relative displacement and orientation between
the tests which has not been used, to the best knowledge of two lines in space [14]. The dual angle ( ), as illustrated in
the authors, in the reported literature. The reminder of the Fig. 1(b), is defined as
paper is arranged as follows: Concepts of Dual Number
Algebra and Denavit-Hartenberg (DH) [13] parameters are (8)
defined in Section II, which are used in Section III for the
where is the projected angle between the lines and is the
derivation of proposed methodology. As an illustration,
shortest distance between them. If and are considered
collision between a rotating arm and few static cylindrical
dual unit vectors representing two lines and is the dual unit
objects was tested in Section IV. The results were verified
vector along common normal, the dual angle between them is
with those obtained using the algorithm of [4] and the
determined using
collision detection module of Autodesk Inventor software.
cos . (9)
II. DUAL NUMBER ALGEBRA
sin . (10)
A dual number or a dual vector is represented as a sum of
a real part and a dual part. The latter begins with the dual where , , y and are real numbers and the dual angle is
entity ε, which is nilpotent, i.e., ε2 = 0 [14]. Dual Number
Algebra is often used in the field of displacement analysis, arctan2 sin , cos (11)
kinematic synthesis and dynamic analysis of spatial
arctan2 ,
mechanisms as it produces concise and compact notations
[15-16]. The same when extended to vectors is known as Using (8) and (11), the relative orientation ( ) and distance
Dual Vector Algebra, which was used by the authors in [17] between the lines ( ) can be determined. Note that, for
to derive an analytical methodology to extract DH parameters parallel lines, no unique common normal exists and a method
of a serial robot from its CAD model. Here, the concept is used in [17] should be followed.
improvised and extended to test collision between cylinders.
A dual number ( is represented by
P
p
(1) Q

where and are real scalar number and corresponding


dual number, respectively, whereas ε2 = 0. Similarly, a dual
vector ( is expressed as (a) Line as dual vector (b) Dual angle between two lines
T T
(2) Figure 1. Line representation using Dual Number Algebra

where is called the resultant vector and is called the B. DH Parameters Based Transformation
moment vector, which are related as
To represent a coordinate frame with respect to another,
(3) six coordinates or parameters are required, of which three
correspond to the relative position (e.g., position vector) and
In (3), is the position vector of any point P on the line remaining three for their relative orientation (e.g., Euler
shown in Fig. 1(a). Operations on dual vectors are performed angles). Melchiorri [19] reported that four Denavit-
similar to those on Cartesian vectors. For example, dot- and Hartenberg (DH) [13] parameters, typically used in geometric
cross-products of two dual vectors, also referred to as line modeling of serial robots, and additional two parameters can
dot- and cross-products [14], are defined by also be used as the required six parameters, referred here as
. . (4) six DH (SDH) parameters. As illustrated in Fig. 2, the four
IV IV
DH parameters between frames and ,
. . . relates a line ( IV ) relative to frame . The extra
(5) parameter c is required to locate the origin of frame
along IV and parameter φ to orient V (parallel to IV ) with
. The six DH parameters are described in Table I.
In the same way, the Euclidean norm of a dual vector is
given by TABLE I. DESCRIPTIONS OF SIX DH PARAMETERS

. Parameters Description
(6)
b Distance between and I along
where and are the Euclidean norms of the dual θ Angle between and II about I
I
vector and vector , respectively. Dual unit vector is a Distance between II and III along II
defined as a dual vector whose Euclidean norm is equal to
unity [18], i.e.,
α Angle between III and IV about III
c Distance between IV and V along IV
(7) φ Angle between V and along V

5354
V V IV IV
,
IV
I II
,
V V
,
II V

III II
I II V
IV
I III III
IV
II
II III
III ,
I
,
III IV I
,

Figure 2. Six DH parameters between two coordinate frames


Figure 4. Six DH parameters: Sequence θ, b, α , c, a and φ
Given the homogeneous transformation matrix of
Frame 2 ( ) with respect to Frame 1 ( , which is cylinders are axisymmetric, θ and φ do not play any role in
denoted as , the common normal (i.e., II = IV ) deciding whether two cylinders intersect or not. Hence, only
between and is determined. The corresponding SDH four parameters, namely b, a, α and c, between the frames
parameters can then be found as three dual angles between I I I
and V V
are sufficient. For the sake of
dual vectors mentioned in Table II and by using (8-11). convenience, Cartesian frame I I I henceforth is referred
V V
as and as . Note that all vector equations in the
TABLE II. SIX DH PARAMETERS AS DUAL ANGLES
formulation are referred in these frames.
Parameters Dual Angle Dual Vectors
A. Methodology
θ and b II
and As an input to the proposed methodology, transformation
α and a II IV ( ) of with respect to is required. Further the radii
and
IV ( and ) and half of the heights of the cylinders, referred
φ and c and here as half-extents ( and ), are needed. Given two
cylinders, one can find the SDH parameters using the Dual
III. COLLISION BETWEEN CYLINDERS Number Algebra presented in Section II. To detect collision,
A novel analytical method is proposed here to detect intersection of cylinders of infinite length is tested first by
collision between two cylinders using the SDH parameters checking if the separation distance (a) is greater than the sum
given in Table I. Referring to Fig. 3, a coordinate frame ( ) of radii ( + ). If so, the cylinders do not intersect and there
is attached to the center of the cylinder , whose Z axis ( ) is no need of further tests. Else, further tests on finite
is along the axis of the cylinder. Similarly, is attached to cylinders need to be performed. For finite cylinders, the
cylinder . For any transformation between them, following strategies are undertaken:
corresponding SDH parameters are determined using (8-11). • If the cylinders are parallel (i.e., α = 0° or 180° and
V
b = 0, c ), as shown in Fig. 5(a), the sum of half-
, V
extents ( and ) is checked with axial distance
between the centers of the cylinders, i.e., the value of
I II
, c. If the sum is greater or equal to the value of c, the
V
II
cylinders intersect. If the sum is less, the two
I cylinders do not intersect.
I III
IV
II
IV • For non-parallel cylinders, the points on cylinder
III
axes where the common normal ( II ) intersects are
tested. If these points are within respective cylinders
III
, IV
(i.e., | | and | | ), then the two cylinders
intersect, as illustrated in Fig. 5(b). This is similar to
“On-On Test” reported in [4]. Here it is referred as
Figure 3. Six DH parameters: Sequence b, θ, a, α , c and φ Non Parallel Test (NPT).
If either or both common normal points is/are outside
In this formulation, a modified sequence of
the respective cylinders, and are projected onto
transformations is used. The angular parameter θ is moved to
the beginning of the series of transformations and distance plane resulting in two rectangles and ,
parameter a, is moved towards the end, before angle respectively, as shown in Fig. 6. A simple Separating
parameter φ. This is done to take the advantage of cylinders Axis Test [2] is performed between the rectangles
being axisymmetric and to facilitate projected rectangles tests and if they do not intersect (Fig. 6(a)), the cylinders
in the proposed formulation. Note that the transformation do not intersect and no further test is required. The
coordinates of the vertices of the projected rectangles
between and is still the same, as shown in Fig. 4. Since

5355
B
Volume of
intersection
B
A B
A
B
A

(a) Volume of intersection (c) Cross-section at

(a) Parallel Test (b) Non Parallel Test


Plane
Figure 5. Finite cylinder tests

are computed as explained later. If the projected A


rectangles intersect, as shown in Fig. 6(b), the two
cylinders at hand may or may not intersect, which is A
determined by the Vertex Edge Test explained
below.
(b) Boundary conditions (Top-view) (d) Cross-section at

Figure 7. Boundary conditions of Vertex Edge Test


Plane
For the cross-section plane at a distance of u from as
shown in Fig. 8, the expressions of the coordinates of vertices
of in A , are
T
(13)
(a) Non-intersecting rectangles (b) Intersecting rectangles
T
(14)
Figure 6. Projection Test between rectangles T
(15)
B. Vertex Edge Test T
(16)
First, a hypothesis is proposed which will be verified where and are half-breadth and half-extent,
later. respectively, of as shown in Fig. 8(a). Similarly, vertices
Hypothesis: If two cylinders are colliding, a volume of of in and after transforming to are given by
intersection exists between them which can be determined
using numerical integration techniques [20]. In the proposed B

methodology, this step is avoided by considering only the


boundary conditions of the volume of intersection along .
At these boundary conditions, the cross-sections of the A
Frame B
and on a plane parallel to result in rectangles and
, which would be touching each other.
B
For example, in Fig. 7(a), the volume of intersection of
two intersecting cylinders is illustrated, for which the
boundary conditions at and from along in the A

top-view shown in Fig. 7(b). The cross-section of the Frame A


cylinders at boundary condition is shown in Fig. 7(c).
(a) Touching rectangles
Note that the two rectangles are touching. Similarly
rectangles are shown touching for boundary condition of
Fig. 7(d).
Proof: The homogeneous transformation matrix ( )
representing B with respect to A is determined as
1 0 0
0 cos sin sin (12)
0 sin cos cos (b) Geometry of (c) Geometry of
0 0 0 1
Figure 8. Rectangles and at a boundary condition

5356
T
; (17) 2 (30)
T
; (18) 4 4 (31)
T
; (19) 2 2 2 2 (32)
T
; (20) 6 2 2 2
where , and are half-breadth and half-extent 4 4 4 4 (33)
of , respectively.
2 2 (34)
The condition for touching at the boundary exists if two
2 2
rectangles just touch each other. It can be established by
constraining a vertex of one rectangle to lie on an edge of the 2 2
other. This can be derived as algebraic equation in u. The
tests are done for 32 possible combinations of edges and Equation (29) can be solved using the analytical technique
vertices, of which two are illustrated here. Tests on remaining reported in [21]. Note that only two solutions of u are real
combinations are similar. and geometrically feasible. If one or both of the real solutions
of u lie(s) in the interval defined in (24), the Z coordinate of
1) Vertex on Edge vertex is determined to find if lies on the edge
The condition for vertex to lie on edge is and not beyond it. Hence collision is concluded.
obtained by equating the Z components of vertex and
Note that by substituting u = 0 and a = 0 in (13-20), the
in using (13) and (20), as illustrated in Fig. 8(a), i.e.,
coordinates of the projected rectangles and , introduced
(21) in Fig. 6 can be determined.
which is rearranged as B Frame B
(22) B A

Using the geometry of , Fig. 8(c), a quadratic equation in u Frame A


is formed, i.e., A

(23)
After solving (23), one or both of the real solutions of u are
Figure 9. Condition for vertex to lie on edge
tested to lie in the interval defined by
| min , max , (24) IV. APPLICATION
For value(s) of u lying in the interval of (24), the Y For broad phase collision tests between robot links and
component of is tested if it lies on the edge and not objects in the environment, Oriented Bounding Box (OBB)
beyond it. If so, it is concluded that the projected rectangles was used in [22], whereas Axis Aligned Bounding Box
and intersect and hence the cylinders and (AABB) was used in [23]. If they collide, actual geometric
intersect and tests for the remaining combinations of vertices shapes of the robot links are then tested for collision. As most
and edges are not required. of the robot links are not rectangular blocks but cylindrical in
shape, the broad phase tests are too conservative. Hence, to
2) Vertex on Edge overcome this, the links are considered as cylinders
The condition for vertex to lie on edge , as (bounding volume), as also reported in the literature, e.g., [4].
shown in Fig. 9, is obtained by equating Y components of
and using (14) and (20), i.e., In this paper, as a proof-of-concept, cylindrical shaped
link for one-DOF arm and cylindrical obstacles were
cos sin (25) modeled in Autodesk Inventor software, as shown in Fig. 10.
Which, unlike (21), has term of . Substituting f ≡ 1, g ≡ The proposed analytical method was implemented as an
cos and h ≡ sin in (25), a general form is addin module inside the software using Visual C#. The joint
given by was rotated programmatically and the collision tests between
the arm and the obstacles were determined using the
0 (26) proposed methodology. The tests were also performed using
the methodology in [4] and collision detection module of
From cylinders’ geometry, Fig. 8(b-c), two equations are
Autodesk Inventor. The results of the collision tests, i.e., the
(27) boolean (true or false) value, matched perfectly for each
increment in joint angle, thus, validating the proposed
(28) methodology. Note that Autodesk Inventor uses a 3rd party
Combining (26-28), a quartic equation in u is then obtained commercial library by D-Cubed [24] for collision detection.
as follows: No detailed mathematical formulation on D-Cubed is
available in open literature. On the other hand, the authors of
0 (29) [4] used MATLAB environment for the implementation of
where the coefficients of the equation are their algorithm.

5357
relies on planar geometries, thereby, making the collision
Joint Axis tests fairly straightforward, unlike those reported in the
Obstacle 1
Obstacle 2 literature which are based on either 3-dimensional spatial
geometries or iterative procedure. Based on the CPU times of
three different algorithms used to test the collision of the task
shown in Fig. 10, the proposed algorithm has been proven to
Arm
Obstacle 3 be accurate and most efficient.

Figure 10. One-DOF arm with obstacles REFERENCES


[1] M. C. Lin and S. Gottschalk, “Collision detection between geometric
For the proposed methodology, the sequence or the flow models: A survey,” in Proc. IMA Conference on Mathematics of
of the collision tests conducted between ‘Arm’ and Surfaces, vol. 1, pp. 602-608, 1998.
‘Obstacle 1’, for one complete rotation of the joint axis, with [2] C. Ericson, Real-time collision detection, Morgan Kaufmann, 2005.
[3] D. Eberly, Intersection of Cylinders, Technical Report, Magic
an increment of 1° is reported in Fig. 11. Note that majority Software, 2000.
of the rejection occurred in “Infinite Cylinders Tests”. During [4] J. Ketchel and P. Larochelle, “Collision detection of cylindrical rigid
the finite cylinder tests, the “Projection Test” also had high bodies for motion planning,” in Proc. IEEE International Conference
percentage of rejection due to which very few number of on Robotics and Automation, pp. 1530-1535, 2006.
“Vertex Edge Test”, which are relatively expensive, were [5] Y. K. Choi, “Collision detection for ellipsoids and other quadrics,”
carried out. Similar results were obtained for the tests with Ph.D. dissertation, Dept. Comput. Sci., Univ. of Hong Kong, 2008.
[6] D. Biermann, R. Joliet and T. Michelitsch, “Fast distance computation
the other two obstacles having early exit from the tests. between cylinders for the design of mold temperature control
systems,” Technical Report, TU Dortmund University, 2008.
Arm and Obstacle1 [7] G. Snethen, “Xenocollide: Complex collision made simple,” Game
100% Programming Gems, vol. 7, pp. 165-178, 2008.
F
[8] Libccd, http://libccd.danfis.cz, accessed in July 2013.
Infinite Cylinders Test 65% No Collision [9] M. Kodam, R. Bharadwaj, J. Curtis, B. Hancock and C. Wassgren,
T “Cylindrical object contact detection for use in discrete element
35% 0%
method simulations. Part I–Contact detection algorithms,” Chemical
Non Parallel Test Parallel Test Engineering Science, vol. 65 no.22, pp. 5852-5862, 2010.
T F T F [10] Y. Guo, C. Wassgren, W. Ketterhagen, B. Hancock and J. Curtis,
9% 26% 0% 0%
“Some computational considerations associated with discrete element
Collision Projection Test Collision No Collision modeling of cylindrical particles,” Powder Technology, vol. 228, pp.
T F 193-198, 2012.
5.5% 20.5% [11] Teikitu Gaming System, http://www.andrewaye.com/, accessed in
Vertex Edge Test No Collision Sept. 2012.
Legend
[12] R. A. Srivatsan and S. Bandyopadhyay, “An analytical formulation for
T F
5% 0.5% T = True finding the proximity of two arbitrary cylinders in space,” Proc.
Collision No Collision F = False International conference on Advances in Robotics, 2013.
[13] J. Denavit and R. S. Hartenberg, “A Kinematic Notation for Lower-
pair Mechanisms Based on Matrices,” ASME Journal of Applied
Figure 11. Flow of collision tests between ‘Arm’ and ‘Obstacle 1’ Mechanisms, vol. 22, no. 2, pp. 215–221, 1955.
[14] I. S. Fischer, Dual-Number Methods in Kinematics, Statics and
In terms of efficiency, the proposed algorithm appears to Dynamics, CRC Press, 1998.
have performed best among the three algorithms compared [15] S. Bandyopadhyay, “Analysis and Design of Spatial Manipulators: an
for the present task, as it took CPU 1 time of about 0.05-0.12 Exact Algebraic Approach using Dual Numbers and Symbolic
Computations,” Ph.D. dissertation, Dept. Mech. Eng., Indian Institute
milliseconds (ms), whereas those using [4] and Autodesk of Science, Bangalore, India, 2006.
Inventor took about 0.17-1.8 ms and 2-16 ms, respectively. [16] E. Pennestrì and R. Stefanelli, “Linear Algebra and Numerical
Since the above computations were carried out in different Algorithms using Dual Numbers,” Multibody System Dynamics,
software platforms, the CPU times may not convey the vol. 18, no. 3, pp. 323-344, 2007.
effectiveness of the theoretical formulations provided by [17] C. G. Rajeevlochana, S. K. Saha and S. Kumar, “Automatic
Extraction of DH Parameters of Serial Manipulators using Line
different authors. However, they do reflect the efficiencies Geometry,” in CD Proc. The 2nd Joint International Conference on
the way they were implemented by the authors. In future, Multibody System Dynamics, 2012.
more rigorous tests will be carried out for more complex [18] M. A. González-Palacios and J. Angeles, Cam Synthesis, Springer,
tasks and using other cylinder-cylinder collision formulations 1993.
reported in the literature in order to establish the robustness [19] C. Melchiorri, “Kinematic Model of Robot Manipulators,” Online
and efficiency of the proposed algorithm. Lecture Notes, University of Bologna, accessed in Sept. 2012.
[20] Y. T. Lee and A. A. Requicha, “Algorithms for computing the volume
and other integral properties of solids. I. known methods and open
V. CONCLUSIONS issues,” Commun. of the ACM, vol. 25, no. 9, pp. 635-641, 1982.
[21] J. Schwarze, “Cubic and quartic roots," Graphics Gems, Academic
Cylinders are one of the most common geometric entities Press Professional, Inc., 1990.
that are used in various fields of visualization but there are [22] T. Reichenbach and Z. Kovacic, “Derivation of Kinematic Parameters
very few exact and accurate methods to detect collision or from a 3D Robot Model Used for Collision-free Path Planning,” in
intersection between them. In this paper, an analytical 11th Mediterranean Conference on Control and Automation, 2003.
methodology is proposed for the same. The methodology [23] X. Yang, Y. Zhao, W. Wu and H. Wang, “Virtual Reality Based
Robotics Learning System,” in Proc. IEEE International Conference
on Automation and Logistics, pp. 859-864, 2008.
1
System Configuration: Windows XP 32 bit Operating System, [24] D-Cubed, www.siemens.com/D-Cubed, accessed in Sept. 2012.
Intel Core 2 Duo (3.0 GHz) processor and 4 GB RAM

5358

You might also like