06-20-2011 01:28 PM
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!
06-20-2011 02:10 PM
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.
06-21-2011 01:17 PM
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.
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.
06-21-2011 02:57 PM
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!
06-21-2011 03:29 PM
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.