# Online Exclusive: Move Your Axes

### Discover techniques for performing coordinated, point-to-point motion using trapezoidal profiles.

It seems simple enough. You want to make a move from point A through point B to point C. But how do you do it smoothly, without having to stop at each end point? There is a variety of applications (e.g., plotters, computer numerical control (CNC) machines, and semiconductor robotics) that requires this type of multiaxis, point-to-point motion. This article describes both the elementary and the more advanced techniques for performing two-dimensional (2-D) coordinated motion on single-axis or on multiaxis motion processors. These techniques can easily be expanded for moves in xyz space.

## Simple Point-to-Point Motion

Let's first consider the simple point-to-point motion in the xy plane using a trapezoidal profile (Figure 1). Any 2-D system controlled by motion processors has physical constraints on each axis. Denote the velocity and acceleration constraints on each axis as vx, ax, vy, ay. Consider vector v1,2, defined by two points p1(x1,y1) and p2(x2,y2) in the plane, and let

(1)

(2)

(3)

Then the velocity and acceleration constraints on the vector v1,2 are vmax and amax, given by

(4)

(5)

On the other hand, if the vector constraints vmax and amax are given, we can calculate the axis constraints using the ratio of lengths method:

(6)

(7)

(8)

(9)

Once we've determined the vector constraints vmax and amax, we can use them to calculate the trapezoidal profile v1,2(t) associated with the vector v1,2. Figure 1 shows a typical trapezoidal profile. The vector v1,2(t) starts at p1, ends at p2, is defined over the trajectory time interval [0,T], and satisfies:

(10)

where

(11)

To determine the appropriate trapezoidal profile, we must first determine the maximum achievable velocity for each axis. (In this simple case, v0 = vT = 0, but we'll go through the derivation of the full result, where v0 and vT may be nonzero, because this general result applies to the more sophisticated move we'll analyze later.) Given the start velocity v0, the end velocity vT, the vector constraints vmax and amax on v1,2, and the length, l, of v1,2, we proceed as follows:

Note that v0 < vmax, and vT < vmax. Define a = amax and ta and td as the respective acceleration and deceleration times of v1,2(t). We now test the achievable maximum velocity v along v1,2 for a trapezoidal profile:

(12)

(13)

Now there are two cases to consider:

(14)

or

(15)

The first case is simple; the achievable maximum velocity v is vmax. In the second case, however, we must calculate v as follows.

Set:

(16)

This can be rewritten as:

(17)

Now,

(18)

(19)

Substituting for ta and td into Equation 17, rearranging, and solving for v gives us:

(20)

This value of v is then mapped onto each axis:

(21)

Finally, the relationships among position, velocity, and acceleration for a trapezoidal move are:

(22)

(23)

(24)

(25)

These equations (22-25) control the device's position and velocity as it moves along vector v1,2 from p1 to p2. Note that ax(t) and ay(t) are constants in the case of a trapezoidal profile. These equations can be implemented in a motion control processor, using the servo cycle time as the time unit,1 with the following equations:

(26)

(27)

This technique for controlling point-to-point motion has many applications. For example, given a sequence of points, early plotters used individual point-to-point segments (trapezoidal start/stop profiles) to plot linear or nonlinear paths. In this simple case, each profile's start and stop velocities, v0 and vT, are always zero. (We'll examine a more complicated move with nonzero start and stop velocities next.) Further, because most motion processors treat position, velocity, and acceleration as fixed point quantities, you should take into account the fixed point resolution and use an appropriate scale in your application to properly maintain the I/O precision.

 1For example, the functions in PMD's C-Motion library convert time values into servo cycles without significant loss of precision.

## Smooth Point-to-Point Motion

Oftentimes, frequent start/stop motion is undesirable if you're trying to achieve a smooth trajectory. What follows is a technique to handle this more sophisticated type of motion.

Consider, for example, a sequence of four points in the xy plane (Figure 2a). The motion starts at p1, turns near p2 and p3 at a nonzero velocity, and stops at p4. The resultant trace then becomes a smooth curve.

To realize this smooth point-to-point motion, we use a small arc that's tangent to the two vectors at each turning point. The radius of the arc and the two tangent positions are functions of the vector lengths and the angle formed by the two vectors. We determine these parameters adaptively. Consider arc2 in Figure 2a, for example. Let l1 be the distance and k1 be the slope from p1(x1,y1) to p2(x2,y2), and let l2 be the distance and k2 be the slope from p2(x2,y2) to p3(x3,y3), respectively, and define the distance d from p2(x2,y2) to the two tangent positions as:

(28)

where 0 < kp < 0.5 is the position coefficient. The two tangent points of arc2—i.e., ps(xs,ys) and pe(xe,ye)—can be determined by:

(29)

(30)

(31)

(32)

The center c(xc,yc) and the radius r of arc2 are given by:

(33)

(34)

(35)

Furthermore, let the center angle and the length of arc2 be and la, and denote the achievable maximum velocities along paths p1p2 as vp and vq, respectively. We have:

(36)

The transition velocity vt and the transition time Tt are given by:

(37)

(38)

where 0 < kv < 0.75 is the velocity coefficient, and kr is the radius coefficient. (Be aware that the transition velocity has a constant magnitude but a variable direction along the arc. In addition, the coefficients kp, kv, and kr are determined empirically based on the physical characteristics of the actual motion system.)

Having determined the transition velocity, vt, we use it as the end velocity of the current profile segment and the start velocity of the next profile segment. We've shown in the previous section how to determine the trapezoidal profile segment v1,2(t) associated with the vector v1,2 using the start and end velocities of a given segment. We'll apply that same procedure to each segment of this more complicated move: Use the transition velocities, vt, of the two arcs tangent to a given vector as the start and end velocities in the calculation of each segment's maximum achievable velocity.

Applying this procedure repeatedly, we can solve all tangent arcs and profile segments associated with consecutive vectors. The magnitude of the resultant profile v(t) as a whole is shown in Figure 2b). In this motion calculation, an arc is further divided evenly into many segments. Each profile segment, including each segment along an arc, is mapped onto each axis according to its direction, as was previously demonstrated in the simple case. The decomposed velocities on each axis are then programmed into the motion processor. The resultant trace becomes a smooth curve.

The above techniques use the "look ahead" concept, in the sense that the calculation of a current segment is correlated to the next segment. Figure 3 shows this method's flow chart, and the sidebar shows the pseudo C++ code using our own Navigator multiaxis motion processor.

We've presented both the elementary and the more advanced techniques for performing coordinated motion on single-axis or multiaxis motion processors using trapezoidal profiles. Given a sequence of points, the simple point-to-point motion goes through all points exactly, with a zero velocity at each one, and the motion's trace is a sequence of line segments. On the other hand, the smooth point-to-point motion starts at the first point, approaches each internal point along an arc at a nonzero velocity, and stops at the final point. The resultant trace is a smooth curve. In real implementations, the user can set motion flags at different points so the trajectory can switch between the simple point-to-point motion and the smooth point-to-point motion at specified positions.

We've also considered dynamic I/O buffering, so the system can use a small memory size to handle a large amount of data (see the while loop in the sidebar). Although our examples are two dimensional, we can extrapolate these ideas to three dimensions, provided the axes are orthogonal to each other. These techniques cover a wide range of motion applications, including CNC machines, arc welding robots, and other factory automation equipment. MC

#### Make Contact!

Xiaolin Li earned his Ph.D. in computer science from the University of Birmingham, U.K., in December 1994. From 1995 to 1997, he was a research associate at different universities. From 1998 to 2000, he worked with CADlink as a mathematician. Currently, he's a consultant working for Performance Motion Devices, Inc. (PMD).

Jeff Johnson received his B.S. in computer science from the University of Western Australia. He's been involved in the motion control industry for the past 12 years and is currently the engineering manager at PMD.

Jim Hyland has a B.A. from the University of Notre Dame and an M.S. in computer engineering from Boston University. He's worked in technical sales and marketing for more than 15 years and is currently PMD's vice president of sales and marketing. Contact Jim at 12 Waltham Street, Lexington, MA 02421; tel: (781) 674-9860; fax: (781) 674-9861; www.pmdcorp.com.

 Pseudo C++ Code Using PMD's Contouring Software Package and Navigator Motion Processor This smooth, point-to-point motion technique can be implemented on PMD's Navigator motion processor, using the Contouring Software Package, as follows:   #include "PMDTrapezoidalSystem.h"   main()   {           PMDpoint point;           PMDFlag flag;           PMDProfile profile;           PMDTrapezoidalSystem pmd;           bool x=true, y=true;           double v_x=15.0, a_x=1.0, v_y=13.5, a_y=0.85;           int heap_size=32768;           pmd.SetAxes(x,v_x, a_x, y, v_y, a_y);           pmd.SetMaximumHeapUsage(heap_size);           pmd.SetIOBuffers();           while(pmd.IsInputStatus())           {                      point=GetInputPoint();                      flag=GetInputFlag();                      pmd.AddPoint(point,flag);                      pmd.GenerateProfile();                      SendOutputProfile(profile);                      pmd.FlushAccessedInput();                      pmd.FlushAccessedOutput();           }   }