0

I was trying to compare methods of Quaternion differentiation for propagating quaternion values over time for a body undergoing rotation, but am getting some strange results for some of the differentiation schemes.

The problem at hand is: Starting with an initial quaternion orientation, a body undergoes constant angular velocity over a time period deltat. I want to solve for the new orientation after undergoing the rotation during deltat.

I was able to find 2 competing alternatives that I was hoping to pit against each other:

  1. Standard Euler Integration: Quaternion Differentiation

  2. Euler Integration with quaternion composition:How to use the quaternion derivative

I am using the following quaternion for the test:

q=[-0.8628    0.1753    0.2406    0.4085]

under the following conditions:

deltat=0.5
w=1e-3*[0    0.7003   -0.6825   -0.5632] = [wr, wx, wy, wz]

I first calculate the standard euler integration as such:

omega=[0,-wx,-wy,-wz;
            wx 0 wz -wy;
            wy -wz 0 -wx;
            wz wy -wx 0];
standard_integrated=q+1/2*omega*q*deltat

I then calculate the equivalent rotation using:

qdot=exp(1/2*w*deltat)
composition_integrated=quatmultiply(q,qdot)

I then check for disparities between calculations using:

quatdisparity=standard_integrated*composition_integrated

where quatdisparity should be close to -1 or 1 if the end quaternions are similar.


The end results are:

standard_integrated=[-0.8628    0.1751    0.2407    0.4087]
composition_integrated=[-1.6872   -0.8556   -0.3888   -0.5196]
quatdisparity=.9999

The problem seems to entirely be in the quaternion composition. composition_integrated is not a quaternion, and when one normalizes it to be a valid quaternion, quatdisparity drops to approximately 0.5

Is the quaternion composition formula valid? It clearly cannot produce valid quaternions if 1/2*w*deltat has any positive components. I would expect something like the standard formulation, where the new quaternion is very close to the original. In the quaternion composition formulation, qdot is also not a quaternion, and is very close to a 4x1 array of ones. Is this second formulation wrong?

  • The first variant is (1+1/2*w*deltat)*q, accordingly the second variant should be exp(1/2*w*deltat)*q, that is qdot*q, quaternions do not commute. In the disparity, you should take the conjugate in one factor. – Lutz Lehmann Jun 05 '21 at 06:47
  • Your matrix omega has some sign errors. Computing with numpy-quaternion gives very close results in both cases, with the matching digits being [-0.862732, 0.1751131, 0.2406510, 0.4086935]. Are you sure the exponential you used is a quaternion exponential? – Lutz Lehmann Jun 05 '21 at 07:37
  • Thank you Lutz. I think the issue is that I didn't realize there was a quaternion exponential. I had applied element-wise exponentiation, which was causing invalid quaternions. I will get back to you tommorow to see if this was the problem. – stillQuestioning Jun 06 '21 at 20:29
  • 1
    Yes, the quaternion exponential works close to the complex exponential, $e^q=e^{Re(q)}(\cos(|Im(q)|)+\frac{Im(q)}{|Im(q)|}\sin(|Im(q)|))$. – Lutz Lehmann Jun 06 '21 at 22:24
  • I have checked again, and it appears that the above recommendations have worked, and the values are indeed very close. Thank you! – stillQuestioning Jun 07 '21 at 21:12

0 Answers0