From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How does LabVIEW calculate Euler Angles from Direction Cosine Matrix?

Solved!
Go to solution

Darin,

 

I was looking at that... and your solution does indeed work. I would think the atan2 function as you suggersted would be a more comprehensive solution. But I'm just learning this Euler stuff...

 

I'll need to run more data through the transformation to determine if one or the other is better.

 

Thanks!

0 Kudos
Message 11 of 15
(1,133 Views)

I would run a direction cosine matrix with DCM(3,1)=DCM(3,2) >0 (tweak the other values to get a determinant of +/-1 if you want) and see if it matches the LV calculation.

 

0 Kudos
Message 12 of 15
(1,124 Views)
Solution
Accepted by topic author BenMedeiros

BenMedeiros wrote: 

 

I'll need to run more data through the transformation to determine if one or the other is better.

 


Just in case I was being too subtle before, phi is defined from -pi to pi, atan is restricted from -pi/2 to pi/2 and atan2 returns values from -pi to pi.  If always getting the correct answer is important, then atan2 is better.  Smiley Wink

 

In general, your confusion (and others') as to the proper formula stems from the fact that NI implements the function using a CLFN which obfuscates the code, and they provide no details (reference) on the algorithm.

 

Going off the LV definition for the direction cosine matrix, it is easy to implement the inverse operation in G.  This allows you to see the details of the algorithm, with the added bonus that after inlining this subVI it is 5-7x FASTER than the CLFN version.  Speed and transparency in one.

 

DCMtoEuler.png

 

Message 13 of 15
(1,106 Views)

Darin,

 

Bravo!.. I was wondering why the error never gets set using the labview function - even when I deliberately violated the bounds of the inputs.

 

This info helps alot.

 

Thanks for the help!

0 Kudos
Message 14 of 15
(1,101 Views)

I finally found one error that the LV version will throw : -20008 if the input is not a 3x3 array.  Other than that, it is willing to accept garbage in = garbage out, which is usually fine by me.

0 Kudos
Message 15 of 15
(1,093 Views)