You are on page 1of 7

A Haptic Device With Collision Detection Response For Sculpting

Virtual Objects

S K Yeung E M Petriu

Department of Mechanical & Automation Department of Electrical Engineering


Engineering University of Ottawa
The Chinese University of Hong Kong Ottawa, Ontario
Shatin, NT, Hong Kong K1N 6N5 CANADA
e-mail: skyeungQmae.cuhk.edu.hk e-mail
petriuQ elg.uottawa.ca

Abstract: To enhance the visual interaction device, the objects lack the “feel” of the real world.
with virtual environment, a hand-controller
equipped with force reflection provides a To sculpt a virtual object in a virtual environment, it is
human operator an additional sensory required for a hand-controller or other human interfaces to
dimension to feel force during manipulation of provide force resistant sensation to an operator when he
virtual objects. The design of the device is visualizes to touch the object on the screen. The haptic
based upon ergonomic ease of use; back- device which is a force reflecting hand controller will send
driveability which includes low inertia, mass, position information to the virtual world. The virtual world will
friction and backlash and simplicity of model react to this position and transmit force vectors to the device
and control. To sculpt objects on a computer, which will these force vectors to simulate resistant force to
the operator needs an instrument to enable the operator. The collision detection response algorithm will
himself to feel the virtual object. This ensure that the surfaces of the virtual object will not be inter-
requirement can be facilitated by the haptic penetrated. The algorithm will stop the surfaces at the point
device with a a collision detection response of penetration and send force-feedback information to the
algorithm. The algorithm will ensure that the device to indicate the user that the current operation on the
surfaces of the virtual object do not inter- virtual object is not permissible.
penetrate. When the user attempts to inter-
penetrate two surfaces, the algorithm will stop This paper will address the design, kinematics and dynamic
the surfaces at the point of penetration and analysis of a six link parallel mechanism and the hardware
send force-feedback information to the haptic implementation. In addition, a collision detection response
device which in term will generate simulated algorithm for sculpting virtual objects in the virtual
resistant force to him to indicate that the environment will be discussed.
operation is not permissible.
2.0 HAPTIC DEVICE
1.O INTRODUCTION:
The objective in force reflection is to have the user feel
Interaction with computer-generated, virtual virtual objects as though they were real. Creating the
environments is becoming more commonplace as sensation of manipulating a virtual object involves simulating
the computing power required to generate contact forces when the user touches the object as well as
convincing 3D graphics in real time grows less generating inertial forces when user accelerates the object
expensive. Commercial visualization packages for [l].The user should not feel the weight of the haptic device
architecture and the pharmaceutical industry are as this would conflict with the tactile feedback from the
already available. Even with the development of virtual environment. A good device should have low inertial
visualization tools such as stereo displays, properties that are invariant throughout the work volume. A
interaction with these environments remains mechanism resemble an umbrella is developed to feature a
awkward due to the lack of sensory feedback, lightweight design whose moving parts weigh less than 50
other than visual. Although one can typically see grams. Moreover, its symmetric layout means its inertial
and even manipulate objects in a virtual properties change little throughout its work.
environment using a mouse, trackball, other input

IEEE
0-7803-3312-8/97/$5.0001997 322
The development of this device evolves from a
planar 5-bar, parallel manipulator. This 5-bar
mechanism is extended into the third dimension
by placing the base shoulder joints at 120
degrees on the circumference of a circle. The
actuators at the elbow joints will be replaced by a
3 degree-of-freedom ball joint or an equivalent;
and the three 2-link structure are connected by a
spherical joint as shown in Figure 1 [2]. The
arrangement of the links enables the placement of
motors on the base and decreases the weight of
the whole structure.
FIGURE 2: A DI-TETRAHEDRAL FORM HAPTIC DEVICE
where x l , y l , z l represents the position of the joint
connecting the fh secondary link to the end-effeutor,
whereas x, , y , ,z , position coordinates of the fhspherical
elbow joint, and I, is the length of the fb secondary link. The
FIGURE 1: EVOLUTION OF A HAPTIC DEVICE FROM
three revolute joints at the top are bound to each other,
TWO-LINK MECHANISM forming three more equations:
(xl-X,)2+(Y,-Y,)2+(Zl-Z,)2 =P4 29
2.1 KINEMATICS
i = 1,2,3;j = 1,2,3;i f j EQ (2)
In a true di-tetrahedral form as shown in Figure 2. where 8, is the distance between the fh and f“ joints.
Each secondary link emulates from a vertex of Finally, three more equations can be obtained from the
the common base of the tetrahedrons similarly to orientation of the projection of the secondary link onto the
a radius of a sphere; the locus of its tip is indeed end-effector plate which is fixed with respect to the plate:
a sphere with the vertex as the center. In general,
three spheres can only intersect at two points -
the vertex at the top and the image of this point
about the plane of the base.
i, j , k = 1,2,3,i f j f k
If the links do not meet at a single point, we define These nine equations match the nine coordinates require to
the offset to be the distance between the center of describe the positions of the three joints and thus form the
the bottom triangle formed, and the revolute general forward kinematic equation of the mechanism.
joints. In such a case the mechanism takes the
general form as shown in Figure 3. The end- 2.2 DYNAMICS OF THE DEVICE
effector, which is the triangular “plate” bounded by
three revolute joints represented by the vectors,
- The dynamic equations of the device can be formulated by
Gee(from joint j to k) and its normal vector Pjk is Lagrangian approach. Since the moving platform as shown
in Figure 3 assumes a circular plane, the center of gravity of
uniquely determined by the positions of the three the moving platform will be at the origin of the xyz
joints. The position of the end-effector joints are coordinate frame
defined by three sphere equations representing
the locus of the tip of the secondary links. The kinetic energy of the primary link1 and secondary link 1
2 2 2
( x 1- x a 1 ) ’ + ( y j - y a j ) + ( ~ j -z,> =I i, can be written as
i = 1,2,3 EQ(1) = TfiAl + EQ(4)
T ~ *=, + J & ~ =+(+m12)b12
=+m128,2 EQ(5)

TA,B,
where
- _1
- mvLJ2 +
2 + J,A2
J , =&ml 2 and v, 2 = x-2 2 + z , 2
EQ(6)

323
x2 =R+ zcose, ++p1
z2 = Z sin 8, + +sin PI
Combining EQ(4), (5), and (6), we have
T ~ ,=~+[zeI2
, +$&'+z2e,&cos(e, -p, 11
++(+mZ2)Bl2 EQ(7)
Substituting (7) and (3)into (2), we have
+:z2jl + m z 2 e l j lcos(e, - p l )
q =+[$mz2812
The total kinetic energy of the haptic device can
be written as
+
T = M ( X 2+ y2 + z 2 ) + i ( Z , ~ , 2 + Z,,,,W,.~+ ZzZaz2) X
FIGURE 3: 3 DOF HAPTIC DEVICE
3
++mz2C[+q.2++fi"fi.cos(@ -p,)] 3.0 A COLLISION DETECTION-RESPONSE
,=I
ALGORITHM FOR SCULPTING VIRTUAL OBJECTS
Where
M mass of the moving platform For this algorithm, the virtual object is represented by a
m mass of the link series of interconnected triangles. Each triangle connects to
¶az
a,,a,, angular velocity of the body axes exactly three other triangles through its edges. This means
of the moving platform with each edge connects to two triangles. This simplifications will
respect to a moving frame allow the algorithm to increase its speed.
parallel to the XYZ frame
moment of inertia of the moving 3.1 MODEL OF THE VIRTUAL OBJECT
I , ,Zyy , I ,
platform about x, y, z axes The user shapes the virtual object by grabbing an existing
respectively vertex of a triangle or creating a new vertex and moving that
Since the moving platform is in symmetry, vertex while the other vertices staying stationary.
Z,,Z,,Z, are identically equal to zero, and
I , = I , = I,, = 71 Mr 2 The model imposes only one constraint on the movement of
the vertices. The constraint is that the three vertices of a
The potential energy of the device is given by triangle cannot be collinear, since each triangle connects to
3
exactly three other triangles through its edges. However, for
P=Mgz+mgC[+sine, +lsinel ++sinp,] practical reasons when detecting collisions with triangles, a
i= 1
vertex should not be within a delta distance from the line
The Lagrangian equations of the motion becomes joining the other two vertices making up that triangle.
d aL dL Otherwise the vertices can move anywhere.
-(-)--=yi , i = 1,2,3 EQ(8)
dt ae, ae,
The only restriction for adding new vertices is that it cannot
and L = T - P
be created at the same position as another vertex.
Since the kinetic energy T, the potential energy P,
Otherwise a new vertex V can be created on the face of
are functions of 0,,e2,f3, and their time triangle ABC by deleting triangle ABC and creating three
derivatives, the torque required to actuate the ith new triangles, ABV, BCV and CAV. A new vertex V can also
primary link can be obtained from EQ(8) as be created on edge BD joining the two triangles ABD and
follows: BCD. This is done by deleting both triangles ABD and BCD
d J T J T d P and creating four new triangles ABV, BCV, CDV and DAV
q=-(-)--
dt aei aei +-aei where i = 1,2,3 as shown in Figure 4.

324
B B object and we have to determine it collides with any object
as it moves from S to T in Figure 4.

3.2.1 NON-INTERACTING MODE

The five types of collisions listed above can be detected


A with the following three collision algorithms; namely (I)
FIGURE 4: CREATING A NEW VERTEX ON A TRIANGLE vertex on triangle collision, (11) edge on edge collision, and
FACE (Ill) face on vertex collision. The vertex on vertex, vertex on
edge and vertex on face type collisions are detected using
Each vertex V can be connected to n number of one method, a vertex on triangle algorithm.
other vertices P, ... P, in clockwise order. To
delete V, all the triangle connected to V will be (I) Detection of Vertex On Triangle Collisions
deleted. n-2 new triangles will be created. These
new triangles are formed by connecting vertices The first step in the algorithm is a quick calculation to
P,, P,., and P, for 3 I i I n . Vertices can continue eliminate most triangles. A triangle ABC also defines a
to be removed until the object becomes a plane with normal vector N. The plane has a front side,
tetrahedron. At this point, no further vertices can positive N, and a back side, negative N. As a vertex moves
be removed without violating the constraint that from point S to point T, it can collide with the triangle only if
each triangle connects to three other triangles as

@:$p
one point is on the front side of the plane and the other is on
shown in Figure 5. the back side. This can be detected by using the dot
product. If AS. N and AT. N (Figure 6 ) have the same sign,
then the points are on the same side of the plane, so there
is no intersection. Otherwise, there is a possibility of
intersection and we precede to the next test.
P5 S T

Pl Pl
FIGURE 5: REMOVING A VERTEX

3.2 THE COLLISION DETECTION ALGORITHM

Since the virtual object is constructed on FIGURE 6: AS N AND AT N HAVE THE SAME SIGN; NO
triangles, the only collisions possible are between COLLISION
two triangles. Each triangle consists of edges,
vertices and a face. So there are a total of nine If the dot products AS N and AT. N are both equal to 0,
possible types of collisions, but some of these are then they lie on the plane ABC. There is a possibility of
redundant. For example, face on edge collisions collision with one of the edges of the triangles. This can be
can be detected by edge on edge and face on detected by solving the parametric equation
vertex collisions. So there are only five types that
need to be detected as follows: (a) vertex on S+(T-S)u = A+(B-A)v
vertex (b) vertex on edge (c) vertex on face (d)
edge on edge and (e) face on vertex. for each of the line segments AB, BC and CA. If
0 I U 5 land 0 I v I 1then there is a collision, else no
A vertex, edge or face can be in one of two collision occurs.
modes, interacting or non-interacting. When an
object is in interacting mode, it is currently in As a vertex moves from point S to point T, it creates a line
collision with another object and we have to segment ST. To test line segment ST whether it intersects
determine if it can lift off that object or slide along triangle ABC. This can be achieved by solving the
the surface of the object. If an object is in non- parametric equation:
interacting mode, it is not in collision with an
S+(T-S)u = A+(B-A)v+(C-A)w

325
If there is a collision, we need to find the point at which
If u>l , v<O, w<O or U + w >1, then the vertex did vertex J stops as it moves from S to T. The point of collision
not collide with the triangle. If there is a collision, G is found by A+(B-A)u. Now the point that vertex J must
then the values of v and w will reveal the type of stop at is given by the intersection of the infinite lines ST
collision: and VG. This is found by solving the parametric equation:
(i) It is a vertex on vertex collision if (a) v=O and
u=O or (b) v=l and u=O or 0 u=l and v=O. S+(T-S)u = V+(G-V)W.
(ii) It is a vertex on edge collision if (a) v=O and
O<u<l or (b) O<v<l and u=O or (c) u+v=l .
(iii) It is a vertex on face collision if v>O, u>O and
U+V<l.

Since movement of a vertex from point S to T is


guided by the haptic device, line segment ST can
become arbitrarily small. Floating point errors may "V
occur in the calculations and a collision will not be FIGURE 8:TRIANGLE CREATED AS VERTEX MOVES FROM S TO T.
detected. This will verify the occurrence of actual
collision. First, the point S is projected onto the (111) Detection of Face on Vertex Collisions
plane defined by triangle ABC, by translating the
point S by the projection of SA onto the normal of Each vertex also has triangles connected to it. As the vertex
the plane N. We will call the projection of S, R. If moves, collisions between these triangles and other vertices
R lies within triangle ABC, then a collision did also have to be detected.
occur. This is determined by using the cross
As vertex J moves from point S to point T, the triangle SGI
product. If vectors R;i X R i , R i X R e and connected to vertex J will create a tetrahedron SGIT.
R e x R;i are in the same direction, then R lies Detection of a face on a vertex is simply done by
within triangle ABC and a collision did occur. determining if the point A lies within this tetrahedron. Each
of the triangles of the tetrahedron form a plane. Let N be the
normal vector of plane SGI. If STaN and S A o N have
different signs, then there is no collision. If they have the
same sign or SA N = 0, then we perform the same tests on
planes STI, GIT and SGT. If it is true for all four planes, then
there is a collision.
FIGURE 7: R IS THE PROJECTION OF S ONTO THE
PLANE ABC If there is a collision, we need to find the point at which
vertex J stops as it moves from S to T. This can be found by
(11) Detection of Edge On Edge Collisions: finding the intersection of line segment ST and infinite plane
GIA. The intersection can be found by solving the
Since the object is shaped by moving a vertex, parametric equation:
we also need to detect collisions between the
edges connected to that vertex and other edges. S+(T-A)u = G+(I-G)V+(A-G)W

As vertex J moves from point S to point T, it will 3.2.2 INTERACTING MODE


form a triangle STV with another vertex
connected to J. Now, for the detection of If a vertex is currently interacting with a surface, these
collisions with other edges AB, we test if line algorithms will determine if the object can move off the
segment AB intersects triangle STV by solving the surface, slide along the surface or stay at the same position.
parametric equation: If the vertex can move off the surface, then the algorithms
for non-interacting objects will be applied to determine if it
A+(B-A)u = S+(T-S)v+(V-S)w collides with any other objects as it moves from point S to T.
If the vertex can't move off the surface, then this is the point
If u>l, v<O, w<O or U + w > 1, then there is no that it will move to.
collision

326
The three vertex algorithms, vertex on face, (ii) To determine if vertex J moves to vertex A, we take the
vertex on edge and vertex on vertex are closely cross products &A? and AE x A c . If the vectors
inter-connected. They allow the vertex to move are in the same direction, then G is outside
smoothly over the surface of the virtual object and Vertex
therefore need the ability to call each other. This
means that a movement from S to T could result
in a dozen calls to the three vertex algorithms as
it traverses the surface of the virtual object and
attempts to find the closest position on the
surface to T.
Face
Each triangle has two sides, one facing outside
the virtual object and the other facing inside the
virtual object. It is assumed that the normal vector Vertex
Br Edge IC
Vertex
N of each triangle points outside the virtual object. FIGURE 9: DIVISION OF AREA OUTSIDE THE TRIANGLE
For the vertex on vertex, vertex on edge and
vertex on face algorithms, it is assumed that the the triangle and could move to A. If BA AG 2 0,
vertex hits the outside of the triangle. If the vertex then vertex J moves to vertex A. A similar method is
hits the inside of the triangle, then just reverse the used for vertices B and C.
direction of normal vector N in the algorithms. The
five types of detection (a) vertex on face (b) (iii) Vertex J will stay on the face if the above two tests fail
vertex on edge (c) vertex on vertex (d) edge on or all edges and vertices.
edge and (e) face on vertex are as follows:
(b) Detection of Vertex On Edge
(a) Detection of Vertex On Face
Let AB be the edge joining triangles ABC with normal N I
Let ABC be a triangle with normal vector N, and T and ABD with normal N2, and let T be the position that
be the position that vertex J will be moved to. vertex J will be moved to.

Vertex J can lift off the face if it returns to the There are two cases for this test. (i) the first case: when
same side from which it entered. This can be triangles ABC and ABD create an angle less than or equal
determined by taking the dot product. If AT. N > to 180' from the point of view of vertex J (i.e. side of the
0, then the vertex can lift off the triangle. If triangles that vertex J is on). (ii) the second case: when the
AT. N I 0, then we proceed to the following test angle is greater than 180'. This can be determined by a
as shown in the next paragraph. simple dot product. If Ni A B 2 0, then the angle is less
than or equal to 180'.
The point T is projected onto triangle ABC and D
call this point G. We now need to determine if G C
lies on a face, edge or vertex of triangle ABC. If G
lies outside triangle ABC, we will move vertex J to
the closest edge or vertex of triangle ABC.

(i) To determine if vertex J moves to edge AB, V A


we take the cross products A& and FIGURE 10: EDGE-ON VIEWS OF TWO TRIANGLES WITH ANGLE
A E X A G . If the vectors are not in the LESS THAN 180'
same direction, then G is not on the same
side as C. It is necessary to determine if G is (c) Detection of Vertex On Vertex
between the points A and B. If AB B6<0 Let A be the vertex that collides with vertex J, and T be the
and BA A(? < 0 then G is between AB point to where J will move. Let the other vertices connected
and vertex J moves to edge AB. A similar to A be P, ... P, in counter-clockwise order.
method is used for edges BC and CA.

327
This algorithm basically lets the other two vertex product. The normal vector N is given by SG X SI. If SP
algorithms, (namely, vertex on face and vertex on N and ST N have the same sign, then vertex J can move
edge), determine if vertex J lifts off the surface. It to T. If SP N and ST N have different signs or ST N
determines which face or edge is closest to point = 0 then vertex J stays at position S.
T and calls the appropriate algorithms. If none of
the edges or faces is closer to T then vertex A, 4.0 CONCLUSION
vertex J will stay at the vertex A.
This algorithm has been implemented on an SGI Indigo
To determine if vertex J moves onto triangle workstation and real-time performance has been achieved.
AP,P,+,, we first project T onto triangle AP,P,+, We have found that as the complexity of the algorithm
and call this point Gi. If vector AP, X AP,, increases linearly with the number of triangles added while
and GI I G, for all 1 I k I n. We perform increases exponentially with the number of vertices
the vertex on face algorithm with triangle connected to the vertex being moved. When the number of
AP,P,+,- triangles is in the hundreds, the algorithm becomes
inefficient. This problem can be solved by creating a
To determine if vertex J moves onto edge bounding box around all the triangles. Each triangle will
AP,. This edge connects two triangles AP,P,+, have an upper and lower x, y, z value. These values can be
and AP,P,,. T is projected onto triangle placed into six lists; one for each upper and lower x, y, z
AP,P,+,and call this point G1. If AP,X AG1 is values which are sorted in order. When a vertex V is
in the opposite direction of AP,X AP,,,, then T selected to be moved, a bounding box is created around
is projected onto triangle AP,P,+,on another vertex V and the other vertices connected to vertex V. The
point G2. If it is on the opposite direction of six lists can then be examined for x, y, z values that fall
AP,x AP,, then we test whether T is moving within the bounding box of vertex V. The triangles found can
along the edge or staying at the vertex. If AP, be placed in another list, called checklist, that will contain
AT > 0 and this is the closest edge found, the triangles that need to be checked for collision. While
then we perform the vertex on edge moving the vertex around, six pointers, one for each list, can
.
algorithm with edge AP, If no face or edge move up and down the lists to indicate which is the next
is found, then vertex J stays at vertex A. triangle that should be checked. This keeps all the triangles
organized so that the algorithm knows the next closest
Detection of Edge On Edge triangle to the vertex. This should keep the number of
triangles that need to be detected for collision relatively
Let the two edges be AB and VS where S is the small and allow the algorithm to operate in real-time for
position of the vertex being moved. We will call hundreds of triangles.
this vertex J. Let T be the point to where J will
move and let the previous position of J before Reference:
hitting the edge be P. Since the collision of the
two edges AB and VS define a plane, vertex J PI Millman, P, and Colgate, J., “Design of a Four Degree-of-
can only move to the side of the plane that P is Freedom Force-Reflecting Manupulandum with a Specified
Forceflorque Workspace”, froceddings of the /E€€ lnt. Conf.
on. We find the normal of the plane by taking the
On Robotics and Automation, Sacramento, CA, USA, 1991,pp.
cross product, The normal vector N is given by 1488-1493.
ABx AV. If SP N and ST N have the same PI Yeung, S, and Hui, R., “Mechanical and Electronics Design of a
sign, then vertex J can move to T. If SP N and Parallel Kinematic Linkage for Haptic Applications”, CSNDSM
ST 0 N have different signs or ST N = 0 then Technical Memorandum #3522,November 15,1995.
vertex J stays at position S. [31 Lee, K. and Shah, D., “Kinematic Analysis of a Three Degrees
of Freedom ln-Parallel Actuated Manipulator’; Proc. Of I€€€ lnt.
Conf. On robotics and Automation, 1987,pp. 345-350
(e) Detection of Face On Vertex

Let the triangle be SGI where S is the vertex


being moved. We will call this vertex J. Let the
point to where J move be T and the previous
position of J before hitting the edge be P. since
triangle SGI defines a plane, vertex J can only
move to the side of the plane that P is on. We find
the normal of the plane by taking the cross

328

You might also like