package
LieGroups.SO3.Quat
SO(3) quaternion parameterization — q = {w, x, y, z}
Rotation convention
A unit quaternion is {w,x,y,z}, with Hamilton multiplication. A body-to-world quaternion rotates body vectors into world coordinates with rotate. Keep quaternion sign ambiguity separate from the represented rotation.
Example
For Real q[4] and Real v[3], this algorithm fragment
rotates the x axis by 90 degrees about positive z:
q := LieGroups.SO3.Quat.exp_map({0,0,1.5707963267948966});
v := LieGroups.SO3.Quat.rotate(q, {1,0,0});
The result is approximately {0,1,0}. exp_map accepts a rotation vector in radians; log_map returns the local rotation vector. Group operations expect valid rotations; use normalize where a caller must explicitly restore quaternion norm.
Members
| Name | Kind | Description |
|---|---|---|
| normalize | function | Normalize quaternion to unit length |
| product | function | Hamilton quaternion product q * p |
| inverse | function | Quaternion inverse (conjugate for unit quaternions) |
| exp_map | function | Exponential map: so(3) rotation vector -> unit quaternion |
| log_map | function | Logarithmic map: unit quaternion -> so(3) rotation vector |
| to_DCM | function | Convert unit quaternion to 3x3 rotation matrix (DCM) |
| from_DCM | function | Convert 3x3 rotation matrix to unit quaternion (Shepperd's method) |
| rotate | function | Rotate a 3-vector by a quaternion: v' = q @ v |
| kinematics | function | Quaternion kinematics: q_dot = 0.5 * q * [0, omega] |
| adjoint | function | Adjoint Ad_X: for SO(3), Ad_q = R (the rotation matrix) |
| small_adjoint | function | Small adjoint ad_xi: the 3x3 skew-symmetric matrix [v]x |
| wedge | function | Wedge map: so(3) vector -> 3x3 skew-symmetric matrix (xi^wedge) |
| vee | function | Vee map: 3x3 skew-symmetric matrix -> so(3) vector (S^vee) |
| left_jacobian | function | Left Jacobian J_l(v) of SO(3) |
| left_jacobian_inv | function | Inverse left Jacobian J_l^{-1}(v) of SO(3) |
| right_jacobian | function | Right Jacobian J_r(v) of SO(3) |
| right_jacobian_inv | function | Inverse right Jacobian J_r^{-1}(v) of SO(3) |
| left_jacobian_exact | function | Left Jacobian J_l(v) of SO(3), closed form down to the exp_map branch radius |
| left_jacobian_inv_exact | function | Inverse left Jacobian J_l^-1(v) of SO(3), closed form down to 1e-4 rad |
| right_jacobian_exact | function | Right Jacobian J_r(v) of SO(3), closed form down to the exp_map branch radius |
| right_jacobian_inv_exact | function | Inverse right Jacobian J_r^-1(v) of SO(3), closed form down to 1e-4 rad |
| exp_map_jacobian | function | Right-trivialized derivative of exp_map with respect to its rotation vector |
| log_map_jacobian | function | Right-trivialized derivative of log_map with respect to its quaternion |
| product_left_factor_jacobian | function | Right-trivialized derivative of product with respect to its left factor |
| product_right_factor_jacobian | function | Right-trivialized derivative of product with respect to its right factor |
| inverse_jacobian | function | Right-trivialized derivative of inverse with respect to its quaternion |
| rotate_rotation_jacobian | function | Right-trivialized derivative of rotate with respect to its quaternion |
| rotate_vector_jacobian | function | Derivative of rotate with respect to the vector being rotated |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
package Quat "SO(3) quaternion parameterization — q = {w, x, y, z}"
annotation(Documentation(info = "<html>
<h4>Rotation convention</h4>
<p>A unit quaternion is {w,x,y,z}, with Hamilton multiplication. A body-to-world
quaternion rotates body vectors into world coordinates with
<a href=\"modelica://LieGroups.SO3.Quat.rotate\">rotate</a>. Keep quaternion
sign ambiguity separate from the represented rotation.</p>
<h4>Example</h4>
<p>For <code>Real q[4]</code> and <code>Real v[3]</code>, this algorithm fragment
rotates the x axis by 90 degrees about positive z:</p>
<pre>q := LieGroups.SO3.Quat.exp_map({0,0,1.5707963267948966});
v := LieGroups.SO3.Quat.rotate(q, {1,0,0});</pre>
<p>The result is approximately {0,1,0}.
<a href=\"modelica://LieGroups.SO3.Quat.exp_map\">exp_map</a> accepts a rotation
vector in radians; <a href=\"modelica://LieGroups.SO3.Quat.log_map\">log_map</a>
returns the local rotation vector. Group operations expect valid rotations;
use <a href=\"modelica://LieGroups.SO3.Quat.normalize\">normalize</a> where a
caller must explicitly restore quaternion norm.</p>
</html>"));
end Quat;