Gearing with an Encoder and a Servo Making Real-Time Position Adjustments

Updated Mar 22, 2018

Reported In


  • cRIO-9030
  • NI-9401
  • Kollmorgen Drive and Motor Cable


  • LabVIEW
  • LabVIEW SoftMotion Module
  • LabVIEW Real-Time Module

Issue Details

How can I perform gearing with an encoder input used to make real-time position adjustments to a servo driven by an AKD in Softmotion? I need to change the phase angle on the fly.


When real time position adjustments are required, the gearing VIs will not be an option because they rely on a static axis. Instead, send individual position setpoints from SoftMotion to the AKD. 

The basic flow will look something like this:
Encoder Output > Digital Module > Position Setpoint Math on RT > Position Setpoints to AKD

Encoder Output/Digital Module
Check out the LabVIEW example "Quad Encoder.lvproj" for an example of converting encoder pulses to position setpoints

Position Setpoint Math on RT
This VI should run on the real time target and should take position setpoints, mathematically manipulate them to account for the change in phase angle, and send them to the AKD. How exactly the encoder setpoints are converted to account for the phase angle change should be determined by the developer who has the most extensive knowledge of the motion system's behavior.

Position Setpoints to AKD
We have a document called Set Position, Velocity, and Torque Setpoints to an EtherCAT Drive Using NI SoftMotion that covers how to send setpoints to an AKD from SoftMotion. The AKD must be in position mode for this to work properly. In position mode, the AKD will attempt to spline between setpoints as they are received. Be careful not to send setpoints faster than the motor can move between them to avoid unexpected behavior. 


Not Helpful