Off-the-shelf motion controllers are a convenient and economical solution for most automation needs. But when applications demand more than the average off-the-shelf (OTS) controller can provide — faster servo update rates, better adaptability to changeovers, intelligent fault handling, and advanced feedback techniques — it may be necessary to design a specialized controller. To do so, one must recognize the need for it, understand how a motion controller works, and then design it.

Why design a motion controller?

Until the sound barrier was broken, airplanes and their various components were designed for a top speed of 330 m/sec. Then along came new engine technology, requiring a redesign of almost every aerospace part.

Similarly, until piezo actuators were invented, motion PID control loops were designed to run at about 1 kHz. Today, however, piezo actuators are common in semiconductor and biomedical applications, requiring controllers with PID update rates approaching 50 kHz.

Speed isn't the only challenge facing today's motion systems. Most machines adapt to frequent changeovers, and accordingly, motion controllers should be able to adapt to different loads. Otherwise, designers would have to retune PID parameters each time, for instance, a machine handled a box of different weight. This too calls for new (custom) control functions such as adaptive algorithms that can handle highly non-linear dynamics.

Responsiveness is another area where OTS controllers fall short. Consider a laser guidance system where the actual trajectory must be modified within microseconds of issuing a new command. Or an automated coordinate-measuring machine that must activate an emergency shutdown sequence within microseconds of detecting a fault. In either case, the challenge is the same: transmitting a command from software to the actuator within microseconds, which ultimately requires a custom controller.

Interface issues also beg for customization. It's not uncommon, for example, to encounter feedback sources with non-standard interfaces. This may include serial peripheral lines for a custom image sensor and a proprietary serial interface to an encoder — neither of which are well served by OTS controllers. Customized motion controllers may also be better at coordinating multiple feedback sources, such as force and position, in the same control loop. And, OEMs building machines may prefer creating their own controller for a broader choice in vendors.

The inner workings

The need for customization is now clear. Understanding how a motion controller works, as well as the components interacting with it, is the next critical step toward designing one. This requires a look at each component's job.

Application software sends commands such as target positions and motion control profiles to the controller.

The motion controller, the center of a typical motion system, oversees trajectory generation, control loops, and supervisory control. It converts high-level user commands (from software) into signals for drives. Additionally, it monitors the entire system for error conditions, faults, asynchronous events that can cause unplanned starts/stops, and speed and direction changes.

Amplifiers, also called drives, receive commands from the controller and generate them into current that drives the motor.

Motors convert electrical energy into mechanical energy and produce torque that moves mechanical elements to their target position.

These mechanical elements can include linear slides, robotic arms, and special actuators.

Feedback devices are not required when controlling stepmotors, but are vital to servomotors. Quadrature encoders are used most often to sense and report motor position to the controller, closing the loop.

The design

Motion control involves precisely controlling the position, velocity, and torque of a rotary or linear electromechanical device. A motion controller handles these tasks by generating different commands. The trajectory generator, for one, generates a series of set points for the control loop to act on. It is responsible for producing a velocity profile and coordinating multiple axes.

To produce the former, a trajectory generator uses commanded position, acceleration, and velocity to determine how much time it spends in the acceleration, constant velocity, and deceleration move segments. On a typical trapezoidal profile, motion begins from a stopped or previous position and accelerates to a target velocity. Motion continues at this velocity for a set period until the controller determines when to decelerate and stop at the target position.

For short moves where deceleration begins before acceleration completes, the velocity profile appears triangular instead of trapezoidal, and the actual velocity may fall short of the target. S-curves — trapezoidal trajectory enhancements — modify acceleration and deceleration ramps into nonlinear, curved profiles. This fine control tailors motion trajectory based on the inertial, frictional forces, motor dynamics, and other mechanical motion limitations.

With velocity profiles, trajectory generators can perform point-to-point, vector, blending, contouring, and gearing moves in multiple axes. Point-to-point moves in the x, y, or z-axis are among the simplest motion commands to carry out as they need a velocity profile for one axis only. For moves through more than one axis, the trajectory generator coordinates multiple axes, called vector moves. Vector moves are often point-to-point in two or three-dimensional space and require final positions on the x, y, and/or z-axes. The motion controller also requires velocity and acceleration vectors.

In addition, the trajectory generator can fuse, or blend, two moves together, causing them to act as one. These moves rely on a blend factor that specifies the blend size. However, this motion prevents a system from passing through all points in the original trajectory. To target all points along the path, designers may opt to employ contouring moves. With user-supplied position buffers, they create a smooth path or spline through each position.

Electronic gearing — another option for multiaxis moves — lets designers simulate and predict motion between two mating gears. It requires users to supply a gear ratio between a slave and master axis, encoder, or analog-to-digital (a/d) converter channel.

The control loop, another feature of the motion controller, corrects for errors and tightly controls the trajectory. It consists of three main parts — proportional, integral, and derivative functions — known as PID parameters. The derivative estimates motor velocity by differentiating the following (position) error signal. This velocity signal adds damping and stability to the loop.

The control loop's job is to generate a command signal based on the set point from the trajectory generator. While a control loop can include a position loop only, it usually includes both a position and velocity loop. Position is read from encoders or a/d converters; velocity is calculated from position values and read directly from a velocity sensor, such as a tachometer. Because feedback is not required for stepmotors, the control loop converts set points from the trajectory generator into stepper signals (step/direction).

Spline interpolators help motion controllers maintain a steady flow of set points from the trajectory generator to the PID control loop by interpolating between points. As the trajectory generator and PID control loop execute at different rates (output/msec vs. µsec, respectively), refining these points is crucial.

Another loop, the supervisory control, is perhaps most important in a motion control system because it takes user commands and signals the trajectory generator when to start/stop moves. The supervisory loop also monitors all I/O for initialization tasks, such as finding reference or origin. Additionally, it keeps track of faults and synchronizes moves relative to changes in external conditions.

Measuring motion

Feedback devices are also integral as they inform the motion controller of a motor's angular or linear position. Quadrature encoders are most common because they specify position relative to the starting point and are designed to work with most motion controllers. Other feedback devices include potentiometers (which communicate analog position feedback), tachometers (which provide velocity feedback), absolute encoders (which measure absolute position), and resolvers (which also measure absolute position).

Other I/O devices important to motion controllers are limit switches, home switches, position triggers, and position capture inputs. Limit switches provide information about an actuator's end of travel to avoid collisions. When a motion system hits this switch, it typically stops moving. Home switches, on the other hand, define a reference point by indicating the system home position — important in pick-and-place applications.

When integrating with other devices, position trigger outputs, also called breakpoints and position compare, let users set up triggers that execute at predetermined positions. These are useful in scanning operations, for example, so a system can take measurements at a series of preset positions. A motion controller with capture inputs immediately captures position and stores it in memory. This is useful for determining an external trigger's position.

Designing a motion controller

New software tools, such as the NI SoftMotion development module for LabView, can save designers time and effort writing code for their motion controller. Such tools facilitate path planning, trajectory generation, and spline interpolation, as well as position and velocity loop tuning.

The trajectory generator employed in SoftMotion is a path planner that produces set points for the control loop. It is a multiaxis, pre-emptive, 64-bit floating-point engine that supports coordinated motion with linear and circular interpolation. It creates new set points every loop period based on move constraints from users. These constraints include the maximum velocity, acceleration/deceleration, and jerk that a mechanical system can tolerate.

The trajectory generator also lets designers perform two and three-dimensional (roll, yaw, and pitch) and helical circular interpolation with contouring and registration moves. And it supports cubic splining and provides coefficients for spline interpolation. (The spline engine uses a cubic spline algorithm and four set points to interpolate position between two points. This results in smooth motion and a trajectory generator loop that runs slower than the control loop.)

For more information, contact National Instruments at (800) 531-5066, visit www.ni.com, or email the editor at ctelling@penton.com.