Quaternions for Rotations in Native LabVIEW

Suppose you find yourself needing to rotate a point in three-dimensional space about an arbitrary axis. This problem comes up frequently in robotic kinematics, for example. You can use Euler angles and rotation matrices. However, this approach, while computationally efficient, has a few drawbacks. One is that it is not particularly easy to invert. Another is gimbal lock. Quaternion rotations do not suffer from either of these drawbacks. While quaternions are not quite as computationally efficient as rotation matrices, modern computer hardware makes this drawback less important for most applications.

I will not here explain quaternions and their usefulness in computing rotations, as the Wikipedia articles cover that adequately.[1] Instead, I would like to point out that, while National Instruments implements quaternions, they are hidden inside the Robotics Module, which is not included with LabVIEW. With the exception of the Generate Random Quaternion function, I have written a similar library in the downloadable .lvlib file below. It includes the standard basic four arithmetic functions, the spherical linear interpolation function (SLERP), and rotation about an arbitrary axis. It is written in LabVIEW 2015 SP1. I hope it will prove useful to you!

Download Library

[1] See https://en.wikipedia.org/wiki/Quaternion and https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation.

Adrian C. Keister Posted byAdrian C. Keister on February 28, 2017

tag list Topics: LabVIEW

White Paper: Increase Your Test Equipment Efficiency

Learn about Wineman Technology’s TestTracker test system management software, where multiple pieces of test software can be combined into a single platform.

Download White Paper

Search the Blog