quaternion kinematic formulation in attitude dynamics block does not seem to be complete.

57 views (last 30 days)
In the attitude dynamics block help files the kinematic equation for quaternion is given as
Infact there should be a (-1/2) coefficient as a multiplier. This I believe is a typo in the help file, because the actual block seems to be calculating using this factor. Do you have any comments ?
  3 Comments
James Tursa
James Tursa on 30 Oct 2024 at 1:22
Edited: James Tursa on 30 Oct 2024 at 1:23
@Gökhan This is definitely a typo. The -1/2 (or +1/2 in other quaternion conventions) needs to be there. Good catch. You should submit a bug report with the documentation error.
Gökhan
Gökhan on 30 Oct 2024 at 8:31
Many thanks for your responses @William Rose , @James Tursa and @Umar. I did some tests to find out if MATLAB is internally using this equation or is it just a typo in the help file itself. It seems, internally it is using a (-1/2) factor to implement the equation. I manually generated a MATLAB functon block to code the same equation and compare the output quaternion with the output of the block. When I used (-1/2) factor, there is a very small discrepancy (in the order of 1e-5 to 1e-7) which tells me that MATLAB indeed is implementing with the (-1/2) factor. However what also bothers me, I am using the same integration methods and etc but still where does this discrepancy come from I wonder. Because in the long run it seems to be accumulating more and more. Now thinking may be I am doing something wrong, I decided to do another test. I compare MATLAB with MATLAB itself, i.e. I compared the output quaternion of built in "Attitude Dynamics" and built in "Spacecraft Dynamics" outputs as seen below.
So you see I am not doing anything extra. I just make sure that the same initial conditions and same orbital parameters are used in both settings. Then I plotted the difference between the quaternions generated. The output is as follows.
the difference order is small (1e-7) however this is due to the initial w=[0,0.1,0] deg/s. If I give lareger w or more complex initial conditions like non-zero components for [wx,wy,wz], the delta increases.
My understanding is that "Space Dynamics" block is just the combination of "Orbit Propagator" block and "Attitude Dynamics" block. As such, one would expect the same output hence a delta of zero (as is the case for comparing output w for which the delta is zero). What is with quaternion integration I do not understand? Any ideas ?

Sign in to comment.

Accepted Answer

William Rose
William Rose on 29 Oct 2024 at 21:19
I think you are correct. A factor of (-1/2) should multiply the right hand side matrices in the equation here for the time derivative of the quaternion.
See Phillips et al 2001, “Review of attitude representation used for aircraft kinematics”, Journal of Aircraft 38 (4): 718-737, equation 110.
Also see Suh YS 2010, “Orientation estimation using a quaternion-based indirect Kalman filter”, IEEE Trans Instrum Measure 59(12): 3296-3305, equation 18.
  1 Comment
William Rose
William Rose on 29 Oct 2024 at 21:29
I used the quaternion update equation when analyzing head acceleration during soccer heading. I made animations using the quaternion update equation (with the factor of -1/2 above) and the angular velocities measured with an accelerometer. The animations were consistent with motion capture data. Therefore I have confidence in the equation.

Sign in to comment.

More Answers (0)

Products


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!