Example Code

Scalable Multi-Axis SoftMotion Architecture for cRIO

Code and Documents

Attachment

This code is still a work in progress, but it is in a state now where it could potentially be a very useful reference or starting point.  This application is designed to allow a user to develop one motion engine that handles commands for one axis, duplicate that engine across multiple axes on a single cRIO controller, and then copy the cRIO application to multiple controllers.  A host user interface will automatically discover any cRIO running the application, and allow a user to send commands to specifc axes on specific controllers.  Because the processing is localized to each cRIO, this application could theoretically scale to thousands of axes.  Below is a software diagram showing off the major software components of the architecture.

Software Diagram.png

The engine must be designed to handle a specific set of commands.  Those could include things like Drive Enable, Drive Disable, Start Homing, Start Reference Move, etc.  The engine could also be programmed to run very complex motion routines because it can maintain state information.  The following is a screenshot of the motion engine used for each axis and the commands that it supports currently.  Again this can be easily customized to support more complex commands or motion routines.

Motion Engine Screenshot.png

The code was built in LabVIEW 2010 and requires the NI SoftMotion Module as well as LabVIEW Real-Time.  The Simple Messaging Library (STM) is also used as a component.  I hope to find time to create a more professional UI (currently it is extremely basic), clean up some of the code (the RT Main VI in particular), and add additional features like axis synchronization through software 1588. 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors