NI SoftMotion: Create Your Custom Motion Controller on Any Platform with LabVIEW
Table of Contents
Overview
Motion control involves precisely controlling the position, velocity, and torque of a rotational or linear electromechanical device. Motion controllers have evolved from being part of stand-alone systems targeted towards specific applications to becoming DSP-based and available for a variety of applications on different bus types. NI SoftMotion technology presents the next generation of motion control with which you can define a custom motion controller on your choice of processor and I/O, based on your price-performance requirements. With NI SoftMotion Development Module for LabVIEW, you can now create a custom motion controller using an M Series DAQ device or Compact FieldPoint with servo updates of up to 1 kHz. You can also create high-precision, extremely flexible motion controllers using R Series reconfigurable I/O modules or CompactRIO with servo updates up to 200 kHz per axis of motion.

Figure 1. Motion Control System Architecture
NI SoftMotion: The Next Generation for Motion Control
Traditionally, motion control components were integrated into a single system. The total cycle time for each motion controller move included intervals for beginning and ending a move, intervals for performing other operations, and additional intervals for software latency. Cycle times could not assume consistency because there was no way to account for timing errors (such as backlash and changing conditions) caused by nonlinear hardware. Decreasing the time required for acceleration and deceleration decreased the total cycle time, but also created higher force requirements, thereby increasing costs. Also, a stand-alone motion controller does not adapt to changing application requirements or deliver fast update rates required by high-precision motion applications. Currently popular DSP-based motion controllers enable fast servo update rates of up to 30 kHz for high-precision applications. With the open architecture, you can program your system to share signals and data across the PCI, PXI or IEEE 1394 bus. National Instruments PCI and PXI motion controllers also include a high-speed dedicated trigger bus called the Real-Time System Integration (RTSI) bus that allows digital signal sharing between multiple devices. When the motion controller reaches a certain position, it can trigger other operations without having to stop the motors, reducing excess acceleration and deceleration time and software latency. Thus, DSP-based motion controllers not only improve total cycle time, but also lower overall motion system cost, while providing flexibility and precision for a variety of applications.
While current motion controllers with DSPs are suitable for many applications, when it comes to high-precision motion control with servo update rates as fast as 200 kHz, machine builders turn to designing their own motion controllers on a custom PCB. Not only is the development expensive in terms of time and cost, but the fixed personality of the motion controller makes the system inflexible for future redesigns or for accommodating variations in the motion control algorithms at run-time. Some applications that need such a high level of precision and flexibility include wafer processing machines in the semiconductor industry, or in-line vehicle sequencing (ILVS) reconfigurable-at-run-time assembly line for the automotive industry. National Instruments reconfigurable I/O (RIO) technology coupled with NI SoftMotion technology provides the right tools for machine builders who want high-precision customized motion control with the complete flexibility of an FPGA. In addition to high-precision applications, machine builders and OEMs also can use the NI SoftMotion Development Module to implement multiaxis coordinated motion control using NI LabVIEW on a variety of platforms – from NI plug-in M Series DAQ devices for industrial PCs and PXI to rugged systems using NI CompactRIO and NI Compact FieldPoint programmable automation controllers (PACs).
What is the NI SoftMotion Development Module for LabVIEW?
The NI SoftMotion Development Module for LabVIEW provides VIs and functions to help you build custom motion controllers that run using LabVIEW in combination with National Instruments hardware such as NI RIO devices, DAQ devices, and Compact FieldPoint.
The NI SoftMotion Development Module works in conjunction with the NI LabVIEW Real-Time Module, LabVIEW FPGA Module, and the LabVIEW Control Design and Simulation Bundle. The NI SoftMotion Development Module provides all of the functions that typically reside on a motion controller DSP. With it, you can handle path planning, trajectory generation, and position and velocity loop control in the NI LabVIEW environment and then deploy the code on LabVIEW Real-Time or LabVIEW FPGA based target hardware.

Figure 2. NI SoftMotion Development Module for LabVIEW Enables Custom Motion Control on Any Platform
The NI SoftMotion Development Module includes functions for trajectory generator and spline engine and examples with complete source code for supervisory control, position, and velocity control loop using the PID algorithm. Supervisory control and the trajectory generator run on a LabVIEW Real-Time target and run at millisecond loop rates. The spline engine and the control loop can run either on a LabVIEW Real-Time target at millisecond loop rates, or on a LabVIEW FPGA target at microsecond loop rates.
Architecting Your Custom Motion Controller Using NI SoftMotion Development Module for LabVIEW
A motion controller is at the center of a typical motion system which consists of supervisory control, trajectory generation, and a control loop. The controller converts high-level user commands into command signals that drives use to move actuators. The motion controller also monitors the system for error conditions, faults, and asynchronous events that can cause the system to change speed, direction, or start/stop the actuators. The following illustration shows the parts and processes of a typical motion motion controller.

[+] Enlarge Image
Figure 3. Motion Controller Architecture
Supervisory Control
The supervisory control is the main loop of the motion control system. This loop intercepts commands from the user and signals the trajectory generator to start/stop moves. The supervisory control loop also monitors all I/O needed to perform initialization tasks, such as finding the reference or origin. This loop also monitors the system for faults and aids in synchronizing moves relative to changes in external conditions. Code for supervisory control executes in the LabVIEW Real-Time environment at millisecond loop rates. The NI SoftMotion Development Module contains multiple examples for supervisory control.
Trajectory Generator
The trajectory generator is a path planner that creates set points for the control loop. It is a multiaxis, preemptive, 64-bit floating-point engine that supports coordinated motion with linear and circular interpolation. The trajectory generator creates new set points every loop period, based on move constraints provided by the user. These move constraints include the maximum velocity, maximum acceleration/deceleration, and maximum jerk that the mechanical system can tolerate. You can perform 2-D, 3-D (roll, yaw, pitch), and helical circular interpolation with contouring and registration moves. The trajectory generator also includes support for cubic splining and provides coefficients for spline interpolation.

Figure 4. Trajectory Generator Implementation with the NI SoftMotion Development Module for LabVIEW
Spline Engine
The spline engine function uses a cubic spline algorithm and four set points to calculate interpolated positions between two positions from the trajectory generator. Using the spline engine function results in smooth motion and means you can run the trajectory generator loop slower than the control loop.
Control Loop
The control loop creates the command signal based on the set point provided by the trajectory generator. In most cases, the control loop includes both a position and a velocity loop, but in some cases the control loop may include only a position loop. The position is typically read from encoders, but also may be read from analog inputs (ADCs). The velocity is calculated from the position values, and may be read directly from a velocity sensor, such as a tachometer. Because feedback is not required for stepper motors, the control loop concerts the set point generated by the trajectory generator into stepper signals (step/direction).
The NI SoftMotion Development Module contains examples for control loop implementation with PID. The example features an enhanced PID algorithm that supports dual feedback, both position and velocity loops, velocity feedforward, and acceleration feedforward parameters. The control loop can be programmed through LabVIEW Real-Time as well as LabVIEW FPGA. The complete source code for the PID control loop is provided as part of the NI SoftMotion Development Module.
I/O
Analog and digital I/O are required to send the command signals and receive feedback from the actuators. Most I/O requirements for motion controllers are digital. In most cases, position feedback is obtained from digital encoders. However, some servo motor drives require analog I/O, and the feedback is obtained from an analog source (ADC).
The NI SoftMotion Development Module includes examples for I/O implementation using M Series DAQ devices, CompactRIO I/O modules, R Series reconfigurable I/O modules, and Compact FieldPoint I/O modules. With the encoder implementation code, you can implement custom encoders using LabVIEW FPGA to calculate velocity and direction at speeds as fast as 20 MHz.
Choosing the Right Hardware Platform based on Price-Performance Requirements
Compact RIO and R Series hardware offer the highest degree of customization and performance with the NI SoftMotion Development Module, with control loop rates as low as 5 µs. You can use plug-in DAQ devices offering analog output lines and direct input from quadrature encoders for applications (such as packaging and material handling) requiring loop rates of 1 ms. Compact FieldPoint offers lower loop rates of 5 ms and is suited for simple motion control applications like servo hydraulics, conveyors, or systems with high inertia. Table 1 compares the performance of all platforms with a traditional plug-in motion controller.

[+] Enlarge Image
Table 1. Motion Controller Performance across Different Platforms
Reader Comments | Submit a comment »
On SoftMotion module, you really need to
discuss whether it can actually create
unique or modified PID loops. For example,
does it allow the gain scheduler PID VI that
is in a LabVIEW add-on, and is this
nullified by LABVIEW FPGA or LabVIEW Real-
time limitations?
- James Smith, InDyne. james.smith3.ctr@eglin.af.mil - Mar 8, 2007
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
