real-time trajectory generation in multi-rccllloyd/papers/rccltraject.pdf · real-time performance...

22
Real-Time Trajectory Generation in Multi-RCCL John Lloyd and Vincent Hayward April 1992 McGill Research Centre for Intelligent Machines McGill University Montr´ eal, Qu´ ebec, Canada Postal Address: 3480 University Street, Montr´ eal, Qu´ ebec, Canada H3A 2A7 Telephone: (514) 398-6319 Telex: 05 268510 FAX: (514) 283-7897 RCCL/RCI Bug Reports: [email protected] General Network Address: [email protected] RCCL/RCI Release 4.2, February 4,1996

Upload: others

Post on 15-Aug-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

Real-Time Trajectory Generation inMulti-RCCL

John Lloyd and Vincent Hayward

April 1992

McGill Research Centre for Intelligent MachinesMcGill University

Montreal, Quebec, Canada

Postal Address: 3480 University Street, Montreal, Quebec, Canada H3A 2A7Telephone: (514) 398-6319 Telex: 05 268510 FAX: (514) 283-7897

RCCL/RCI Bug Reports: [email protected] Network Address: [email protected]

RCCL/RCI Release 4.2, February 4,1996

Page 2: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

Real-Time Trajectory Generation in Multi-RCCL

John Lloyd and Vincent Hayward

Abstract

This paper describes the design of the trajectory generator for a robot programming system calledMulti-RCCL, which is a package of “C” routines for doing real-time manipulator control in a UNIXenvironment. RCCL has been used successfully in developing robot control applications in numer-ous research and industry facilities over the last several years. One of its strongest features is theability to integrate real-time sensor control into the manipulator task specification. RCCL primi-tives supply the trajectory generator with target points for motions in joint or Cartesian coordinates.Other primitives allow the code developer to specify on-line functions that can modify the targetpoints, or possibly cancel motion requests, in response to various sensor or control inputs. Thedesign requirements of the trajectory generator are that it be able to integrate these on-line modi-fications into the overall robot motion, and provide a smooth path between adjacent motions evenwhen sensor inputs make the future trajectory uncertain.

RCCL/RCI Release 4.2, February 4,1996

Page 3: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

1

1. Introduction

Multi-RCCL is a library of “C” routines and data structures for writing robot control programs.It is an extension to the original RCCL (Robot Control C Library), which was written at PurdueUniversity by Vincent Hayward [5]. Since then, various enhancements have been made to the sys-tem, including the ability to control multiple robots and distribute the trajectory control over severalCPUs. Most of this work has been done at McGill University and at the Jet Propulsion Laboratory[13, 12, 3].

RCCL’s two fundamental features are:

} A comprehensive set of “C” language primitives for specifying robot motions and actions ina UNIX workstation environment.

} The ability to write application code which processes sensory information and adjusts therobot trajectory in real-time.

These two features have made RCCL a particularly useful tool for developing applications wheremanipulator actions are controlled by various sensor and control inputs. Since the system providesdirect on-line control of the manipulator, special techniques have been used to obtain the requiredreal-time performance from conventional UNIX workstations [11].

Principal RCCL sites include the Jet Propulsion Laboratory, the General Electric AdvancedTechnology Laboratory (New Jersey), Columbia University, the University of Pennsylvania, theUniversity of Southern California, NASA Goddard Space flight center, the University of Illinois,Universitat Bielefeld (Germany), and several others. Specific applications for which it has beenused include manipulator force control and telerobotics [10, 9], multi-arm force control [4], visualservoing and tracking [1, 7], active visual exploration [18], and the development of robot program-ming interfaces [8].

The system’s trajectory generator, and its ability to integrate sensor inputs with preplanned ac-tions, has thus been thoroughly demonstrated over the last couple of years. The purpose of thispaper is to present the design of the trajectory generator in detail.

It should be noted that responding to dynamic events requires that virtually all of the trajectorygeneration be done directly on-line, in a manner that precludes some of the more optimal solutionsthat are possible if the trajectory is planned in advance [2, 15].

The reader is assumed to be familiar with the original book by Richard Paul [14] and all the no-tational conventions used there. For purposes of clarity, we have omitted describing certain detailsand special cases.

2. Overview

RCCL generates the trajectories necessary to move a manipulator through sequences of target po-sitions, which are submitted to a trajectory generator for asynchronous execution. Target positions

RCCL/RCI Release 4.2, February 4,1996

Page 4: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

2 2. OVERVIEW

can be specified in either Cartesian or joint coordinates. This paper will focus only on the former;joint target specifications can be handled in the same way. A Cartesian target is described by aposition equation, which is a closed kinematic loop of 4x4 homogeneous transforms containingthe manipulator’sT6 transform. The component transforms of such target equations may be time-varying, and motions to such targets will track the variations. For example, suppose we wish tohave a manipulator pick up an object on a moving platform. The application program could definethe following target equation,

Z T6(t) E = W P(t) (1)

and motions to this target will cause the manipulator to travel to a position where T6 satisfies theequation (see Figure 1). In this case P(t) is time-varying, and T6 will track the changes. A prin-cipal means by which the application program may vary a component transform is to attach it toa function that is evaluated once every control cycle by the trajectory generator; such a functionmay modify the transform based on either some preprogrammed plan or sensor inputs. “Stopping”at a time varying target implies that the manipulator will reach the target but continue to track itsmotions.

E

W

Z

T6 (t)

P (t)

Figure 1: Kinematic loop for a manipulator target attached to a moving platform.

The fact that the target specification is dynamic makes the system quite versatile but means thatvirtually all of the trajectory computation must be done on-line. This is, in fact, the greatest con-straint imposed on everything that we will discuss.

Internally, the trajectory generator divides the target position equation into a TOOL term and aCOORD term: TOOL is the set of transforms between T6 and whatever frame the application hasdesignated as the tool frame, and COORD is “other half” of the equation. In general, these termswill be time-varying if their components are. Assuming in the above example that the tool frame

RCCL/RCI Release 4.2, February 4,1996

Page 5: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

3

is designated by E, then RCCL would represent (1) internally as

T6(t) TOOL = COORD(t)

where

TOOL = E (2)

COORD(t) = Z�1 WP(t) (3)

This partioning is used for performing the drive computation (discussed later).

The job of the trajectory generator is to compute paths between successive (possible time-varying)target points. The application can specify whether this path is to be computed in Cartesian or jointcoordinates, and imposes velocity and acceleration constraints in the selected coordinate system.The velocity constraint determines the overall time of the path segment (�), while the accelerationconstraint determines the length of time (� ) spent doing a smooth transition between adjacent pathsegments.

σ

τ τA

B

C

path segment

transition interval time

posi

tion

Figure 2: Path segments between target positions.

Figure 2 shows (in one dimension) path segments connecting an initial point A, a via point B,and a stopping point C . The � and � values are shown for the path segment BC. Notice that � isactually one half the total transition time, which is symmetrical about the path segment endpoints.The action of “stopping” at C is also computed as a path segment (in effect another motion requestto the same target) whose � is specified explicitly. This technique is particularly useful since thetarget position we “stop” at might actually be in motion. Finally, notice that unless we actually dostop at a target point, the transitions are computed to “undershoot” it.

The trajectory computations are done in real-time at a fixed sample rate. The target position (i.e.,the COORD and TOOL terms) is re-evaluated once every control cycle; this action will includethe evaluation of any functions bound to the component transforms.

RCCL/RCI Release 4.2, February 4,1996

Page 6: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

4 2. OVERVIEW

For convenience, this paper will use a time scale where the start time of the path segment underdiscussion is given by tb and its end time is tc (such that � = tc � tb). Moreover, the time cor-responding to one control cycle will be defined as unity, and the time scale will be offset so thattb�� = 1. Under these coordinates, � and � are equal to their respective number of control cycles.

As stated above, the path interpolation can be done in either Cartesian or joint coordinates. Thelatter is accomplished using a drive transform constructed in the manipulator tool frame. Individualpath points are then computed from the equations

T6(t) = COORD(t) DRIVE(t) TOOL(t)�1

j6(t) = ��1(T6(t))

where ��1() indicates an inverse robot kinematics operation. At time tb, the drive transform ac-commodates the initial difference between the current position and the target. Over the course ofthe path segment, DRIVE(t) is computed so as to trace a “straight line” from its initial value to theidentity I. To do this, a function trsfToDrive() is used to convert DRIVE into a set of drive parame-ters (dp) which can be linearly scaled. Given a function driveToTrsf() that converts drive parametersback into transforms, and a normalized motion scale coordinate s, defined as

s =(t� tb)

�;

the subsequent values of DRIVE(t) can be computed from

DRIVE(t) = driveToTrsf ((1� s)dp)

The mechanics of the drive parameters are described in [14], chapter 5.

Computing the path in joint coordinates is similar except that in this case the drive interpolationis done in joint space. The corresponding computation is

TC(t) = COORD(t) TOOL(t)�1

j6(t) = ��1(TC(t)) + jdrive(t)

where TC indicates the value of the motion target in the T6 frame. Instead of using a CartesianDRIVE transform, we use a vector of joint coordinates jdrive. The drive parameters jdp are simplythe initial values of jdrive, which means that

jdrive(t) = (1� s) jdp

Notice that the path will still track time-variations in the Cartesian target position.

Following from the above discussion, the rest of this paper will describe, in general, how Multi-RCCL (1) computes transitions between path segments, (2) determines the drive parameters, and

RCCL/RCI Release 4.2, February 4,1996

Page 7: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

5

(3) computes � and � , under conditions where the target position may be changing. A detaileddescription of the specific Joint and Cartesian path generation algorithms is also included.

3. Transitions Between Path Segments

When we abut adjacent path segments, we must generally allow a transition time � during whichone path segment can be smoothly blended into another. The magnitude of � reflects the maximumamount of acceleration that can be tolerated by the manipulator; a longer value of � is necessaryfor path changes involving larger velocity changes. The � for any motion is computed dynamically(section 5.1).

The path segment blending algorithm used by RCCL is quite independent of the other parts ofthe trajectory calculation, and so we discuss it first. For illustration, we will consider the blendingof two one dimensional path segments S0(t) and S1(t). Each path segment is the combined resultof a drive toward a target plus variations in the target itself.

τ τ

β( )

S1

S1

S0

posi

tion

time

tb + τtbtb − τ ( = 1 )

Figure 3: Blending two path segments together.

To smoothly connect the path segments, a blend function� (see Figure 3) is applied to S1(t) overthe interval 1 � t � tb + � (recall that tb � � = 1). The implication of this is that the computationfor a path segment actually starts at time tb � � before the time tb when it officially starts.

All the parameters needed to compute the blend function can be determined from the initialposition, velocity, and acceleration of S0 and S1 at t = 1. Assume for the moment that the blendfunction can be applied simply by adding it to S1 (although this is not true for rotations; see section

RCCL/RCI Release 4.2, February 4,1996

Page 8: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

6 3. TRANSITIONS BETWEEN PATH SEGMENTS

3.2). It must then satisfy the following constraints:

S1(1) + �(1) = S0(1) (4)

S1(1)0 + �(1)0 = S0(1)

0

S1(1)00 + �(1)00 = S0(1)

00

�(tb + � ) = 0

�(tb + � )0 = 0

�(tb + � )00 = 0

These can satisfied by computing the blend function with a fifth order Hermite polynominal

�(h) = �5h5 + �4h

4 + �3h3 + �2h

2 + �1h+ �0 (5)

where h is a time parameter normalized to span the interval [0; 1] during the transition:

h =t� tb + �

2�

Defining the difference between S1 and S2 to be �(t) � S1(t) � S2(t), the coefficients of (5)that satisfy (4) are:

�0 = �(0)

�1 = �0(0)

�2 = 0:5 �00(0)

�3 = �10 �(0)� 6 �0(0)� 1:5 �00(0)

�4 = 15 �(0) + 8 �0(0) + 1:5 �00(0)

�5 = �6 �(0)� 3 �0(0)� 0:5 �00(0)

Joint space paths, and the translational components of Cartesian paths, can be blended by thedirect extension of this formulation to several dimensions. The blending of rotational trajectories,which is more complicated because rotations do not commute and therefore cannot be treated asvector quantities, is discussed in section 3.2.

The blend function is actually just the “DRIVE transform” revisited, only here discontinuitiesare being removed in the derivative terms. We could dispose of the drive computation all together,and simply make the transition interval cover the entire path segment. We don’t do this, however,since applications often desire constant velocity straight line trajectories.

Notice that in figure 3, S0 and S1 intersect at tb. Generally, the trajectory generator sequencesevents so this is in fact the case, yielding an “undershoot” transition (of the sort described in [14])that goes through the inside of the intersection point. However, the paths do not have to intersect attb; different blending behaviors will result depending on where (or even if) they intersect. Variationson the blend function described here have been suggested that allow the application to “tune” theextent of the via-point undershoot, or specify an overshoot [6].

The principal advantage of the blend technique is that it is robust: we do not need to know any-thing about the path S0 after time t = 1, and we do not need to know anything about path S1 inadvance. S0 and S1 do not even have to be straight lines, as illustrated in the figure. This is impor-tant since the target may be time-varying and sensor-driven and hence not completely predictable.

RCCL/RCI Release 4.2, February 4,1996

Page 9: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

3.1. INITIALIZING THE BLEND PARAMETERS 7

3.1 Initializing the blend parameters

To initialize the blend function it is necessary to know the values of S0 and S1 and their derivativesat time t = 1.

For computational reasons, RCCL does not presently worry about any initial difference in ac-celeration between the path segments: for purposes of computing the blend function, it is assumedthat S00

0 (1)� S 00

1 (1) = 0. We therefore need only S0(1), S0

0(1), S1(1), and S0

1(1). In general, how-ever, we don’t have S0

1(1) since we have only started computing S1(t) during the first control cycle.To accommodate this, the trajectory generator waits for one more control cycle and then computesS1(2), from which S0

1(1) may be estimated as S0

1(1) = S1(2)� S1(1). The output setpoints for thefirst control cycle are simply set equal to S0(1).

Two interface functions are defined which compute the required derivatives and blend parame-ters from the values of S0 and S1 at times 1 and 2:

setBlend0 (S0(0); S1(0))

setBlend1 (S0(1); S1(1); 2� )

The third argument to setBlend1() gives the total length of the transition time, which is needed tocompute h.

Since the blend function cannot always be applied by simple addition, its application to S1 willbe indicated generally as �(S1(t)).

The computation of S0(1) and S0(2) is currently done by extrapolating the initial path:

S0(1) = S0(0) + S0

0(0)

S0(2) = S0(0) + 2S0

0(0)

There are two reasons doing this, instead of computing S0(t) directly. The first is simply to savecomputation. The second is that we do not wish (under the present implementation) to compute S0

at the same time we are computing S1, since some of the transforms which define the first targetmay also be used in the definition of the second target. If any of these transforms are bound toan application defined function, then that function would have to be called twice during the samecontrol cycle in two different motion contexts. Resolving this properly would require adjustmentsto the present application interface. The small errors introduced by extrapolatingS1 have not causedany difficulties to date.

3.2 Blending Rotations

Analogous to the previous discussion, we can consider the problem of blending rotations as com-puting a smooth transition between two rotational paths R0(h) and R1(h) over a normalized timeinterval [0; 1]. Unlikely the treatment above, however, we cannot do this using a simple Hermitepolynominal since there is no vector-like representation for rotations that defines a proper metricfor them 1.

1Although vector blending can work if the rotational distance between R0 and R1 is not very large; for instance,interpolation of quaternions works quite nicely for displacements less than 45�.

RCCL/RCI Release 4.2, February 4,1996

Page 10: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

8 3. TRANSITIONS BETWEEN PATH SEGMENTS

One obvious solution to this problem is to find a space that does form a metric for rotations anddo the blending there. For instance, the unit sphere in<4 formed by the set of unit quaternions formsa metric for rotations, and is possible to construct curves on the surface of this sphere to smoothlyconnect different rotation states [16]. Unfortunately, this technique is a little too expensive (com-putationally) to be of use for one-line calculation.

Instead, we use a method that has some similarities to the work described in [17]. To beginwith, the computation has been simplified by ignoring initial rotational accelerations. This has notcaused any noticeable problems, and acceleration compensation could be added, if necessary, as asimple extension of the following method.

The blend function � takes the form of a blend rotation RB(h) that is applied to R1(h) overthe transition interval, producing the output rotation R(h):

R(h) = R1(h) RB(h)

Let the rotational velocities of R0, R1, and RB, be given by 0, 1, and B. We then have thefollowing boundary conditions:

RB(0) = R1(0)�1 R0(0)

RB(1) = IR0(0)B(0) = R0(0)0(0)�

R0(0)1(0)

B(1) = 0

The velocities in the third equation are described with respect to the R0(0) coordinate frame.Looking at the boundary conditions, we see that what we essentially want to do is remove the

initial displacement and velocity of RB. The initial displacement RB(0) can be expressed as asingle rotation about some axis. If this axis is parallel to B(0), then the whole problem reduces toa one dimensional one in terms of the rotation parameter about that axis. While this is not generallytrue, it suggests resolving RB into separate rotations that compensate for velocity and displacement.Let the notation rot(�;u) denote a rotation of � about the axis u. Now let !0 = kB(0)k, let uv bea unit vector parallel to B(0), and define RB as the following product:

RB(h) = R1(0)�1 R0(0) RC(h) RV(h)

The first two (constant) terms compensate for the initial displacement.The RV(h) term, which is initially equal to I, acts to bring B(0) to 0:

RV(h) = rot(!0gv(h)=2; uv)

where gv is the polynomialgv = (h3 � 2h2 + 2)h

defined so that RV satisfies the boundary conditions which require it to have an initial velocity of!0 and a final velocity of 0, and 0 acceleration at both ends.

Finally, the RC(h) term brings all displacements to 0, including those incurred by RV. SinceRB(1) = I, we have that

RC(1) = R0(0)�1 R1(0) RV(1)�1

RCCL/RCI Release 4.2, February 4,1996

Page 11: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

9

Letting uc be the axis of rotation for RC(1) and �c be the angle of rotation, RC(h) is computedfrom

RC(h) = rot(�cgc(h); uc)

where gc is the polynomialgc = (6h2 � 15h + 10)h3

which gives RC a velocity and acceleration of 0 at the transition endpoints.

4. Computing the drive parameters

In this section, we will continue to use the one dimensional paths S0 and S1 to illustrate how driveparameters are computed, first for fixed targets and then for time varying targets.

tb t c

posi

tion

time

1 ( = τ + 1 )

S0 C1

B

B

S1(1)

Figure 4: Computing the drive parameter for fixed targets.

4.1 Fixed Targets

Refer to figure 4. When the computation begins for path S1 at t = 1, the manipulator is followingpath S0 is on its way to some point B. If C0 is the official target point for path S0, and is constant,thenB = C0. If theC0(t) is not constant, thenB = C0(tb), which creates a minor problem becauseC0(tb) is generally not known ahead of time. In this case B can be estimated by extrapolation:

B = S0(0) + (� + 1)S0

0(0) (6)

RCCL/RCI Release 4.2, February 4,1996

Page 12: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

10 4. COMPUTING THE DRIVE PARAMETERS

Another instance where it becomes necessary to do this is when the motion along S0 is interruptedprematurely, before it has had time to approach the official target.

Assume that the (constant) target for the next path segment is C1. The drive parameter D forthis motion is then simply

D = B � C1 (7)

and S1 can be computed byS1(t) = C1 + (1� s)D (8)

4.2 Time-varying Targets

If C1(t) is time-varying, then there is another minor problem deciding how to compute the driveparameter. During the first cycle, the drive offsetO(1) can be computed from the initial target valueas

O(1) = B � C1(1)

But repeating the computation during the second cycle yields

O(2) = B � C1(2)

which may be different. What we really want is the drive offset for time tb (See figure 5):

O(tb) = B � C1(tb)

This yields an equation for S1 that looks like

S1(t) = C1(t) + (1� s) (B � C1(tb)) (9)

Substituting in for time tb, we notice that

S1(tb) = B

which is correct.WhileO(tb) cannot be known with certainty ahead of time, if it is assumed that C1(t) is roughly

linear in the transition region, then O(tb) can be estimated by extrapolation:

D � O(tb) = O(1) + � (O(2) �O(1))

This requires postponing the computation of D until the second control cycle, but we already haveto “coast” for the first cycle anyway, for purposes of calculating the blend parameters.

OnceD has been computed, it is necessary to computeS1(2) and “back compute”S1(1) in orderto initialize the blend parameters. This can be done using (9), which yields, with the 1 � s termexpanded,

S1(1) = C1(1) +�tc � 1

�D

S1(2) = C1(2) +�tc � 2

�D

RCCL/RCI Release 4.2, February 4,1996

Page 13: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

4.3. STOPPING 11

C (2)

C (1)

tb

posi

tion

time

1

S0

B

S1(1)

2

tbC ( )1

1

1

S1(2)

Figure 5: Computing the drive parameter for moving targets.

4.3 Stopping

The path generation methods given above are quite versatile and can handle a variety of cases. Forinstance, if we switch path interpolation modes from the previous cycle, then we only have to trans-form the initial velocity estimate associated with S0

0(0). Since path points are computed in bothCartesian and joint coordinates anyway, this is easy. We can also handle motion interruption eas-ily: if a motion is canceled before it has reached its anticipated target, its “virtual target” B can becomputed using (6), and the rest of the computation is the same.

There is one particular case that is treated separately, and that is stopping. Recall that this isimplemented as a duplicate motion to the same target point. This implies some simplification incomputing the the trajectory paths. For one thing, there is no need to do a drive computation: bydefinition, the manipulator has already reached its target. It might be necessary to maintain a fixeddrive offset, however: in cases where the preceding motion was interrupted before completion, themost natural option is to stop at the point where the motion was interrupted, rather than at a pointthat was never reached in the first place.

This is done in the following way: During the first computation cycle of the stop segment, thefinal scale factor sf associated with the previous motion is determined. If the motion went to com-pletion, then sf = 1; otherwise, sf < 1. The constant term (1 � sf)D is then used in (9) in place

RCCL/RCI Release 4.2, February 4,1996

Page 14: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

12 5. COMPUTING THE PATH SEGMENT AND TRANSITION TIMES

of the time varying term (1� s)D.

5. Computing the path segment and transition times

This section outlines briefly the calculation of � and �. It should be mentioned in passing that al-though these times are normally computed automatically, as described here, RCCL does permit theapplication to specify them explicitly. All operations described here are assumed to be normalizedto the appropriate units.

5.1 Transition times

RCCL computes its path segment transition times “on the fly”, taking into consideration the currentvelocity, the distance to the next target, and the specified velocity and acceleration limits. Whilethe method used is only a heuristic, it works reasonably well and is computationally tractable. Thecomputation for Cartesian motions will be described here. The equivalent computation for jointmotions is analogous.

Velocity and acceleration constraints for Cartesian motions are specified in terms of a maxi-mum translational “cruising” speed �vt, a maximum rotational speed �vr, a maximum translationalacceleration �at, and a maximum rotational acceleration �ar. To determine � , the system estimatesthe peak translational and rotational velocity (bvt and bvr) for the upcoming path segment, subtractsthese from the current velocities vt0 and vr0, and divides by the appropriate acceleration limit.

The path segment velocities are estimated as follows. Assume that the manipulator is currentlyheading toward a target point C1(t), and the target point for the next path segment is C2(t). Thedisplacement D between these two targets can be computed as

D = C1(t)�1 C2(t)

D is used to compute ut (a unit vector parallel to the translation vector), dt (the magnitude of thetranslation vector), ur (a unit vector describing the equivalent axis of rotation), and dr (the angleof rotation about ur).

The path segment is assumed to consist of an acceleration phase, a cruise phase, and a deceler-ation phase. Considering first the translational component, the system constructs estimates of thespeed (vt) and path segment time (�t). Let �a = �v2t =�at be the nominal translational distance coveredduring the acceleration/deceleration phase. If �a � dt, then vt and �t are given by

�t = 2�vt=�at + (dt � �a)=�vt

vt = �vt

Otherwise, if �a > dt, then the desired cruising velocity �vt will not be reached, and vt and �t aregiven by

�t = 2qdt=�at

vt = �t�at=2

RCCL/RCI Release 4.2, February 4,1996

Page 15: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

5.2. THE MOTION SEGMENT TIME 13

The same computation may be repeated for the rotational component to obtain �r and vr. Since�t and �r will generally not be equal, the actual estimate of the path segment time � is set to themaximum of the two:

� = max(�t; �r)

bvt and bvr can now be computed as

bvt = �tvt�

!ut

bvr = �rvr�

!ur

Finally, � is determined from

� =1

2max

kbvt � v0tk

�at;kbvr � v0rk

�ar

!

If the next path segment is a stop request, then bvt and bvr are 0 and may be eliminated from thecomputation altogether.

5.2 The Motion Segment Time

The motion segment time � was estimated during the computation of � . However, this consideredonly the anticipated displacement for the path segment, and was not updated to be consistent withthe final computed value of � .

During the first computation cycle of the path segment, � is re-computed using the distance tothe target and the known value of � . This calculation is quite simple, and is illustrated again usingthe translational component. This time, let �c = dt � 2��vt represent the total distance coveredduring the cruise phase of the path segment. If �c > 0, then �t is computed from

�t = 2� + dt=�vt

Otherwise, the path segment does not contain a cruise phase, and

�t = 2�

After repeating the these computations for the rotational component to obtain �r, the final value of� is computed from

� = max(�t; �r)

5.3 General Remarks

For joint interpolated motions, the computations are similar to those above, with each joint valuebeing treated as an independent constraint component.

RCCL/RCI Release 4.2, February 4,1996

Page 16: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

14 6. CARTESIAN MOTIONS

It is emphasized again that the computation of � is only approximate, with computation timebeing the chief limiting factor. In particular, a precise determination of bvt and bvr would have toalso consider the initial velocities vt0 and vr0.

These calculations require thatC2(t) be computed simultaneously with the current motion tar-getC1(t). It was mentioned briefly in section 3.1 that RCCL avoids computing two paths simulta-neously so as to not have to evaluate a functionally bound transform twice in two different motioncontexts. This rule is still adhered to;C2(t) is determined by multiplying the transforms of the as-sociated position equation but not calling any functions that may attached to them. This can causeinaccuracies if a transform’s function introduces discontinuities to its value at the beginning of themotion, although such cases are rare.

Finally, it should be mentioned that �at and �ar could be computed dynamically using the manip-ulator Jacobian and the joint acceleration limits, although this is not done at the present time.

6. Cartesian Motions

This section presents the specific computations used by the trajectory generator to do Cartesian in-terpolated motions. Some things have been omitted, including calculations related to sections 4.3and 5.

6.1 Special operations used

A few of the operations used in the general discussion need to modified for Cartesian coordinates.In particular, it is not possible to simply extrapolate a transform matrix M directly by computingsomething like

M(k) = M(0) + kM0(0) (10)

An equivalent computation is possible, however. Suppose that a displacement is represented, not bya transform, but by a 7-tuple consisting of a position vector, an axis of rotation, and an angle of rota-tion about that axis1RCCL maintains such objects and calls them DSPLs (for displacements). Thefunctions trsfToDspl() and dsplToTrsf() are used to convert between them and transforms. A DSPLrepresentation can be easily scaled by simply multiplying the position vector and the rotation angle.The combined operation of scaling a DSPL and converting it back to a transform is performed bythe function extrapTrsfByDspl() (notice that this function returns a transform). Since a DSPL canrepresent a velocity as well as finite displacement, the equivalent to (10) can be constructed as

M(k) = M(0)extrapTrsfByDspl(v; k)

where v is a DSPL representing a one-cycle displacement. This can be easily computed from twosuccessive transform values:

v = trsfToDspl(M0�1 M1)

Note that, like drive parameters, DSPLs can be easily interpolated. DSPLs could be used in placeof drive parameters, although the two-angle interpolation used for drive parameters offers someadvantages in robot task specification.

1This forms a computationally convenient representation for a finite screw.

RCCL/RCI Release 4.2, February 4,1996

Page 17: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

6.2. FIRST PATH SEGMENT COMPUTATION CYCLE 15

The blending of Cartesian path segments is done in the manipulator T6 frame, which means thatS0 and S1 correspond to values of T6 which will be designated as S0 and S1.

We are now ready to present the path computation algorithm.

6.2 First path segment computation cycle

It is assumed thatT6(0) and v0 (a DSPL representing the unit velocity in the T6 frame) are initiallyavailable. We first compute the value ofT6 towards which we are heading, either by setting it equalto the previous motion’s T6 target (if it is constant and the previous motion was not interrupted), orby estimating it from dTB = T6(0) extrapTrsfByDspl(v0; � + 1)

Next, an initial value drive offset is computed:

O(1) = COORD(1)�1 dTB TOOL(1)

S0(1) and S0(2) are then computed by extrapolation,

S0(1) = T6(0) extrapTrsfByDspl(v0; 1)

S0(2) = T6(0) extrapTrsfByDspl(v0; 2)

and S0(1) is used as the output setpoint:

j6(1) = ��1(S0(1))

6.3 Second path segment computation cycle

This cycle is the busiest. A second drive offset is computed, and then the two offsets are extrapo-lated to obtain the real drive parameters dp:

O(2) = COORD(2)�1 dTB TOOL(2)

ov = trsfToDspl(O(1)�1O(2))

dp = trsfToDrive(O(1) extrapTrsfByDspl(ov; � ) )

The values of DRIVE(t) corresponding to cycles 1 and 2 are then computed:

DRIVE(1) = extrapTrsfByDrive(dp; (tc � 1)=�)

DRIVE(2) = extrapTrsfByDrive(dp; (tc � 2)=�)

These are used to compute S1(1) and S1(2) and set the blend parameters:

S1(1) = COORD(1) DRIVE(1) TOOL(1)�1

S1(2) = COORD(2) DRIVE(2) TOOL(2)�1

setBlend1 (S0(1);S1(1))

setBlend2 (S0(2);S1(2); 2� )

Lastly, the output setpoint is determined by applying the blend function to S1(2):

j6(2) = ��1(�(S1(2)))

RCCL/RCI Release 4.2, February 4,1996

Page 18: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

16 7. JOINT COORDINATES

6.4 Remaining computation cycles

The value of DRIVE(t) is computed,

DRIVE(t) = extrapTrsfByDrive(dp; 1� s)

and used to compute the output setpoint directly. The application of the blend function � is omittedif t � tb + � :

j6(t) = ��1(�(COORD(t) DRIVE(t) TOOL(t)�1))

7. Joint Coordinates

This section presents the specific computations used by the trajectory generator to do joint interpo-lated motions. Because joint coordinates can be treated as vector quantities, their associated pathcomputations follow directly from the introductory discussion given earlier. Since the path segmentblending is done in joint coordinates, the values of S0 and S1 correspond to values of j6 which willbe designated as js0 and js1.

7.1 First path segment computation cycle

Assume that the initial joint angles j6(0) and velocities jv(0) are available. The value of j6 towardswhich we are heading is computed, either by setting it equal to the previous motion’s j6 target (if itis constant and the motion was not interrupted), or by estimating it fromcjb = j6(0) + (� + 1)jv(0)

Next, the value of the motion target is computed in joint coordinates (jc) and used to find an initialvalue for the drive offset jo:

jc(1) = ��1(COORD(1) TOOL(1)�1)

jo(1) = cjb� jc(1)js0(1) and js1(2) are then computed by extrapolation,

js0(1) = j6(0) + jv(0)

js0(2) = j6(0) + 2jv(0)

and j6(1) is set equal to js0(1).

7.2 Second path segment computation cycle

A second value for the drive offset is computed, and used with the first value to determine the driveparameters jdp:

jo(2) = cjb � ��1(COORD(2) TOOL(2)�1)

jdp = jo(1) + � (jo(2)� jo(1))

RCCL/RCI Release 4.2, February 4,1996

Page 19: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

7.3. REMAINING COMPUTATION CYCLES 17

js1(1) and js1(2) are then computed and used to set the blend parameters:

js1(1) = jc(1) +�tc � 1

�jd(� )

js1(2) = jc(2) +�tc � 2

�jd(� )

setBlend1 (js0(1); js1(1))

setBlend2 (js0(2); js1(2); 2� )

Lastly, the output setpoint is computed by applying the blend function � to js1(2):

j6(2) = �(js1(2))

7.3 Remaining computation cycles

The output setpoint is just computed directly, with the blend function � being omitted if t � tb+ � :

j6(t) = �(��1(COORD(t) TOOL(t)�1)) + (1� s)jdp)

8. Computation Times

How much CPU time do the trajectory computations described here require? On a microVAX IIsystem (now somewhat obsolete), the trajectory generator can control one PUMA robot quite com-fortably at a 30 msec. sample rate. The trajectory computation itself, involving closed form inversekinematics, several transform multiples, the application of a blend function, and precomputation ofthe next motion request, typically requires no more than 10 msec. An additional 5 msec. or so maybe required for the extra computations during the first two cycles of a motion.

On a Sun4 Sparc system, one robot can be controlled easily at 5 msec., with the trajectory com-putations taking up about 1.5 msec. of this time. Newer systems such as Silicon graphics work-stations running the MIPS R3000 CPU can do all of the trajectory computations in as little as .5msec.

To help achieve these speeds, most computations are done using single precision, and the trigono-metric and square root functions are computed using linearly interpolated lookup tables with a worstcase error of about 5�7.

9. Conclusion

The robot programming system RCCL has been demonstrated over the last several years to be anuseful platform for developing a wide variety of robot control applications. The trajectory gener-ation technique described here, which uses first order velocity extrapolation combined with pathblending, has been shown to be effective in handling various situations where the robot’s path is

RCCL/RCI Release 4.2, February 4,1996

Page 20: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

18 9. CONCLUSION

subject to on-line modification from a wide range of stimuli. Examples of these stimuli includeoperator control inputs from joysticks or hand-controllers, readings from force/torque sensors usedto implement impedance control, or various types of visual and range-finding information used toimplement tracking.

RCCL/RCI Release 4.2, February 4,1996

Page 21: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

19

Bibliography

[1] Peter K. Allen, Billibon Yoshimi, and Aleksander Timcenko, “Real-time visual servoing”.IEEE International Conference on Robotics and Automation, Sacramento, California, April 9-11, 1991, pp. 851 – 856.

[2] J. E. Bobrow, S. Dubowsky and J. S. Gibson, “Time Optimal Control of Robotic Manipulatorsalong a Specified Path”. International Journal of Robotics Research, Fall 1985, pp. 3 – 17. (Vol.4, No. 3)

[3] Samad Hayati, Tom Lee, Ed Kahn, and John Lloyd, “The JPL Telerobot Manipulator Controland Mechanization Sub-system”. NASA Conference on Space Telerobotics, Pasadena, Ca., Jan-uary 31 - February 2, 1989.

[4] Samad Hayati, Tom Lee, Kam Tso, Paul Backes, and John Lloyd, “A Testbed for a Uni-fied Teleoperated-Autonomous Dual-Arm Robotic System”. IEEE International Conference onRobotics and Automation, Cincinnati, Ohio, May 13-18, 1990.

[5] Vincent Hayward and Richard Paul, “Robot Manipulator Control Under UNIX: RCCL, a RobotControl C Library”. International Journal of Robotics Research, Winter 1986, pp. 94 – 111. (Vol.5, No. 4)

[6] Vincent Hayward, Laeeque Daneshmend, Ajit Nilakantan, “Model Based Trajectory PlanningUsing Preview”. Report TR-CIM-88-9, Research Center for Intelligent Machines, McGill Uni-versity, Montreal, March 1988.

[7] A. Castano A. and S. A. Hutchinson, “Hybrid Vision/Position Servo Control of a Robotic Ma-nipulator”. To be presented at the IEEE International Conference on Robotics and Automation,Nice, France, May 1992.

[8] Andrew H. Fagg, M. Anthony Lewis, Thea Iberall, and George A. Bekey, “R2AD: RapidRobotics Application Development Environment”. IEEE International Conference on Roboticsand Automation, Sacramento, California, April 9-11, 1991, pp. 1420 – 1426.

[9] Edwin P. Kan, Jin Lee, and Michel Junod, “An integrated FRHC-PUMA-EE TeleautonomousSystem”. 3rd International Symposium on Robotics and Manufacturing, Vancouver, B.C.,Canada, July 18-20, 1990, pp. 397 – 404.

[10] Jin S. Lee, Samad Hayati, Vincent Hayward, and John Lloyd, “Implementation of RCCL, aRobot Control C Library, on a microVAX II”. Advances in Intelligent Robotics Systems, SPIE’sCambridge Symposium on Optical and Optoelectronic Engineering, Cambridge, Mass., 26-31October, 1986.

[11] John Lloyd, Mike Parker, and Gaylord Holder, “Real Time Control Under UNIX for RCCL”.3rd International Symposium on Robotics and Manufacturing, Vancouver, B.C., Canada, July18-20, 1990, pp. 237 – 242.

RCCL/RCI Release 4.2, February 4,1996

Page 22: Real-Time Trajectory Generation in Multi-RCCLlloyd/papers/RCCLtraject.pdf · real-time performance from conventional UNIX workstations [11]. Principal RCCL sites include the Jet Propulsion

20 BIBLIOGRAPHY

[12] John Lloyd and Vincent Hayward, “Multi-RCCL User’s Guide”. Research Center for Intelli-gent Machines, McGill University, Montreal, November 1989.

[13] John Lloyd, Mike Parker, and Rick McClain, “Extending the RCCL Programming Envi-ronment to Multiple Robots and Processors”. IEEE Conference on Robotics and Automation,Philadelphia, Pa., April 24-29, 1988, pp. 465 – 469.

[14] Richard P. Paul, Robot Manipulators: Mathematics, Programming, and Control. MIT Press,Cambridge, Mass., 1981

[15] Kang G. Shin and Neil D. Mckay, “A Dynamic Programming Approach to Trajectory Plan-ning of Robotic Manipulators”. IEEE Transactions on Automatic Control, June 1986, pp. 491 –500. (Vol. AC-31, No. 6)

[16] Ken Shoemake, “Animating Rotation with Quaternion Curves”. Computer Graphics (SIG-GRAPH ’85 Conference Proceedings), San Fransisco, California, July 22 – 26, 1985, pp. 245 –254. (Vol. 19, No. 3)

[17] R.H. Taylor, “Planning and Execution of Straight Line Manipulator Trajectories”. IBM Jour-nal of Research and Development, July 1979, pp. 253 – 264. (Vol. 23, No. 4)

[18] Whaite, P. and Ferrie, F.P., “From Uncertainty to Visual Exploration”. IEEE Transactions onPattern Recognition and Machine Intelligence, October, 1991, pp. 1038 – 1050. (Vol. PAMI-13,No. 10)

RCCL/RCI Release 4.2, February 4,1996