File Exchange

image thumbnail

Euler angles to Quaternion Conversion (for six basic sequence of rotations)

version 1.2.0.0 (3 KB) by Dr. Murtaza Khan
Allowed rotations sequences: xyz, xzy, yxz, yzx, zxy, zyx

5 Downloads

Updated 17 Jul 2009

View License

Euler Angles To Quaternion Conversion for six basic sequence of rotations around X(Roll),Y(Pitch) and Z(Yaw) axis.

Allowed Sequences: xyz, xzy, yxz, yzx, zxy, zyx.

Comments and Ratings (6)

I checked the program is working fine.

James Tursa

This submission has the following problems:

1) The code only covers six of the twelve possible triple rotation sequences. It leaves out the xyx, xzx, yxy, yzy, zxz, and zyz sequences.

2) Typing 'help eulertoquat' doesn't give you much of anything useful. Only a brief description of the function is given. All of the critical necessary information that should be in the help (quaternion convention (is scalar first or last?, etc), what units are acceptable for the euler angles, what order are the arguments, etc, etc) are not displayed. You have to manually edit the file eulertoquat.m to discover all of this.

3) The supplied testeuler2quat.m file doesn't work at all. First, it clears your command window, closes everything, and clears your workspace (very bad). Then it exits with an error because the function it calls, namely euler2quat, does not match the actual function name in the submission, eulertoquat. After changing the testeuler2quat.m file so that it called eulertoquat, it bombed again. This time because the number of output arguments did not match up. So after fixing that up, it bombed *again*. This time because the quaternion multiply routine func_QuatMult was missing ... it did not match the supplied function quaternionmul.m. So after fixing *that* up the test routine finally ran, but the results are pretty much useless as a test. Other than checking to see that the norm of the result is 1, nothing is supplied to check the correctness of the result.

4) There is no inverse function supplied. For example, a quattoeuler.m function would be appropriate. That would at least allow the user to check the results for consistency.

5) The code is not written as efficiently as it could. e.g., the current code creates several temorary variables, does the multiply into more temorary variables, and then gathers up the temorary variables and concatenates them into a single result to return. But by simply preallocating the quaternion result and then putting the calculation results directly into the return variable I was able to save about 5% off the running time.

6) The code is not vectorized! That is, you cannot input a vector or matrix of inputs and get a vector or matrix of outputs. You would have to call this function in a loop to get the results for a vector or matrix of inputs.

7) I don't usually question other people's ratings, but in this case I must. How can this submission possibly get 4 and 5 stars from others when it doesn't even run out of the box? "... easy to use ..." ??? What is going on here?

I spot checked a couple of cases against other code I have (see below), and I did check the formula used for the quaternion multiply, and it appears to be correct. But if you want to see a *much* better submission for converting between quaternions, direction cosine matrices, and euler angle sequences that *is* vectorized and *does* have a useful help, I highly advise that you download this other submission by John Fuller:

http://www.mathworks.com/matlabcentral/fileexchange/20696

James Tursa

Dave Grymin

Very straight-forward, easy to use.

Avetis Ioannisyan

no source code?

John Da Graca

M Khan

A GUI based sharware can be check at
http://mak2000.sky.prohosting.com/eulerquatpro.html

Updates

1.2.0.0

missing file is added

1.1.0.0

BSD License

1.0.0.0

upgraded

MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
Platform Compatibility
Windows macOS Linux