Closed form integration first-time derivative of a quaternion #493
Replies: 5 comments
-
Thanks @gsilano ! I guess this could be of interest of the members of @robotology/iit-dynamic-interaction-control that works in the simulation of dynamical system that evolve over the 3D rotation group (SO(3)), that is sometimes parametrized by using unit quaternions. |
Beta Was this translation helpful? Give feedback.
-
Hi @gsilano, to be honest I would not consider [1] as a reliable source of information. I believe that the formula presented in the "Integration" section assumes the matrix A to be constant, but this is not the case, as it depends on the quaternion itself. To the best of my knowledge, there is no closed-form integration for the quaternion. In most of the cases, the integration of a quaternion resorts to numerical methods that treat it as a R^4 vector. The "dynamics" of the quaternion is then modified to include some "stabilization" terms to keep the quaternion unitary: see for example https://core.ac.uk/download/pdf/191492036.pdf Related works: |
Beta Was this translation helpful? Give feedback.
-
Another great source for quaternion math is Quaternion kinematics for the error-state Kalman filter, particularly 4.6 Time-integration of rotation rates (thanks @prashanthr05 for the reference). |
Beta Was this translation helpful? Give feedback.
-
Thanks for the support and help. I followed the implementation in A novel Quaternion integration approach for describing the behavior of non-spherical particles, and developed the related MATLAB code. The results I get once again are weird, and they leave me perplexed. I can't isolate the source of the problem, i.e., the implementation or the math (or even worst, both). Perhaps, you can get more than me. Let me explain what the attached files contain. MATLAB_SCRIPTS.zip
Then, I implemented the numerical integration solution provided in A novel Quaternion integration approach for describing the behavior of non-spherical particles, eqs (46-50), and How to Integrate Quaternions taking care to understand what it happens when (i) changing the axes convention (lines 40-42); (ii) changing the MATLAB function to retrieve EULER angles from QUATERNIONS and vice versa (I implemented the function As a result, the following implementation resulted to be reasonable:
The obtained results are wrong.
The obtained results are wrong.
The results are right.
|
Beta Was this translation helpful? Give feedback.
-
Just to summarize, in the end, I fixed the problem by looking at my model from a different point of view. Either way, I think the problem (i.e., how to find in a closed or numerically form the integration of the first time derivative of a quaternion) is still interesting and has raised a lot of questions about the strange behavior observed in MATLAB. It could be due to some implementation issues or even misunderstandings. However, I hope that my questions, your answers, and my solution/implementation proposal can be a starting point for others as well. Thanks again for your help. |
Beta Was this translation helpful? Give feedback.
-
Hi everybody! This conversation follows what discussed here: robotology/whole-body-controllers#110.
Just to summarize, the problem I'm facing concerns the integration of the first-time derivative of a quaternion. From what I've seen, implementing the solution described in [1] there is a strange behavior in single-axis rotations. Roughly speaking, for a single-axis rotation, i.e., only one angular velocity is applied per axis, along
x
,y
, andz
, I get rotation aroundyaw
,-pitch
, and-roll
angles instead ofroll
,pitch
, andyaw
angles.I wonder why this happens. Also, I think that having this solution can help in any scenario, not just the one closely related to the iCub ecosystem.
The MATLAB test code is reported in robotology/whole-body-controllers#110.
[1] https://www.ashwinnarayan.com/post/how-to-integrate-quaternions
Beta Was this translation helpful? Give feedback.
All reactions