Quaternions for Rotations in Native LabVIEW

Tags: LabVIEW, Raleigh

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.

About Genuen

Our goal is to improve time to market without compromising product quality or safety standards. With experience in mission-critical applications and regulatory compliance, Genuen creates custom test systems across the product lifecycle, including hardware-in-the-loop (HIL), fluid power test, and electromechanical test. Headquartered near Kansas City, we have offices across the United States and serve clients in aerospace, transportation, national security, and beyond. The company's Quality Management System (QMS) is certified to ISO 9001.