Most of this info from A tutorial on SE(3) transformation parameterizations.
The set of all invertible matrices forms the general linear group GL(3,R). Amongst these we have the subgroup of orthogonal matrices O(3). Within these we have the subgroup of matrices that only have determinant 1, (not -1) called SO(3). SO(3) x R3 is called SE(3). Elements of SE(3) are called poses, they represent a rotation, and a translation defined wrt to the new coordinate angles. The fact that we rotate first, and translate after that is just convention.
Quaternions are numbers of the form \(q = a + b \rm{i} + c\rm{j} + d \rm{k}\) and they multiply in this form \(\displaystyle \rm{i}\rm{i} = \rm{j}\rm{j} = \rm{k}\rm{k} = -1 \text{ and } ij \to k, jk \to i, ki \to j, ji \to -k , kj \to -i, ik \to -j\). If q is a pure quaternion then \(q^2 = -(b^2 + c^2 + d^2)\) otherwise \(q^2 = a^2 -(b^2 + c^2 + d^2) + ab\ {\rm i} + ac\ {\rm j} + ad\ {\rm k} \). The inverse of a quaternion is \(q^{-1} = \frac{1}{a^2 + b ^2 + c^2 + d^2} a - b\ {\rm i} - c\ {\rm j} - d\ {\rm k}\) which means that we can get the absolute value of a quaternion by multipying it with \(\text{adj}(q) = a - bi -cj - dk\). Quaternion q can be used to represent a rotation in 3d space using a special representation and an associated special operation. Before we go into how quaternions representation rotations let's first setup different ways of representing rotations.
Euler angles : Three rotations are sufficient to reach any target frame (in 3d). The rotations may be extrinsic (about a motionless frame), or intrinsic (sequential rotations about a coordinate system that moves together with the body!) Intrinsic directions are easy for an agent to act upon. Extrinsic vs intrinsic is the difference b/w north-south-east-west and left-right in a 2d plane.
If I tell you to go west for 1 km, and then north for 1km, then I am giving extrinsic directions,
but I tell you to take a left for 1km, and then take a right, I am giving you intrinsic directions!
For defining intrinsic rotations in 3D, there exist 12 possible sequences of rotation axes, divided into two groups
Axis-Angle / RPY representation
The RPY representation (Roll : x0, Pitch: y0, Yaw: z0) is conventionally defined with extrinsic rotations, when we do this we are using angles to define a point on the sphere, and then a roll about that line. This is closely related to the angle-axis representation which is closely aligned to the quaternions. In Axis-Angle we use 3 coordinates that represent a point on the unit-sphere instead of angles, and another number that represent a roll around that axis. One can also multiply the angle with the direction vector to get back only three parameters (called the exponential coordinate parameterization). Note that Axis-Angle is completely different from Cardan angles, and Euler Angles, but it's closely related to the RPY representation.
Finally we come back to the quaternions
Consider the RPY representation, which is most close to the axis-angle. The quaternion is constructed as \(\Big(\cos(\text{roll}/2) , \sin(\text{roll}/2) \big(\cos(\text{yaw})\cos(\text{pitch}), \sin(\text{yaw})\cos(\text{pitch}), \sin(\text{pitch})\big)\Big)\). The usefulness of the quaternion representation is that
The conversion between Euler angles and Quaternions is best explained on this page along with lots of converters. Now that we know how to easily compose rotations, now we can think about how to chain poses. For example, if we compose joint-lever assemblies as follows then we can get the world-pose of the final object by composing the corresponding poses for each lever.
Basic algebraic terminology before we move on any further | ||||||
The Lie Group and the Lie Algebra are two sides of a coin. The Lie-Algebra associated to a lie-group M is the tangent space at the identity element. You go from the a point on the manifold/lie-group to the algebra/velocity-space using the logarithm map, and you go from the algebra to the manifold using the exponential map.
The hat and the wedge operator. The hat/wedge operator maps a vector to its corresponding skew-symmetric matrix. The vee operator is the inverse of the hat map, but the generalized vee operator removes all symmetric contributions to a matrix \(\displaystyle \omega^{\wedge} = \begin{pmatrix} 0& -z& y\\ z& 0& -x\\ -y& x& 0 \end{pmatrix} \text{ where } \omega = \begin{bmatrix}x \\ y \\ z \end{bmatrix} \text{ , } f^\vee = \frac{1}{2} \begin{bmatrix} f_{32} - f_{23}\\ f_{13} - f_{31} \\ f_{21} - f_{12}\end{bmatrix} \text { where } f \text { is a matrix}\)
|
SE(3) as a Lie Group and \(\displaystyle \mathfrak{se}(3)\) as a Lie Algebra
There are a few things we want to do when we define a parameterization and a calculus over that parameterization, we want to keep track of how the parameterized entities compose with each other, and we want to know how the parameterized entities can act on the real-world. In the case of poses in SE(3) that means that we need to know how to compose a pose with a point and its inverse and we need to compose poses themselves, and how to invert poses. See chapters 3-7 for these details for SE(3).
The group \(\mathbf{SO}(3)\) and its algebra \(\mathfrak{so}(3)\) - Since SE(3) has a manifold structure of SO(3) x R3 therefore it makes sense to first study the relation between the group \(\mathbf{SO}(3)\) and its algebra \(\mathfrak{so}(3)\).
\(\mathfrak{so}(3)\) is a vector-space with the following three basis "elements". I am calling them basis-elements instead of vectors because they are actually matrices. An arbitrary element of the tangest space is as follows.
\(\alpha \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & -1 \\ 0 & 1 & 0 \\ \end{pmatrix} + \beta \begin{pmatrix} 0 & 0 & 1 \\ 0 & 0 & 0 \\ -1 & 0 & 0 \\ \end{pmatrix} + \gamma \begin{pmatrix} 0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 0 \\ \end{pmatrix}\)
so any element of \(\mathfrak{so}(3)\) will be written as a weighted sum of these 3 matrices. Each basis-element represents infinitesimal rotation about the corresponding axis. Now recall that the original elements in the manifolds themselves represented rotations around axis. Those rotations represented in the matrix form are the following.
\(\begin{pmatrix} \cos(\text{angle-Z}) & -\sin(\text{angle-Z}) & 0 \\ \sin(\text{angle-Z}) & \cos(\text{angle-Z}) & 0 \\ 0 & 0 & 1 \\ \end{pmatrix} \text{ and } \begin{pmatrix} \cos(\text{angle-Y}) & 0 & \sin(\text{angle-Y}) \\ 0 & 1 & 0 \\ -\sin(\text{angle-Y}) & 0 & \cos(\text{angle-Y}) \\ \end{pmatrix} \text{ and } \begin{pmatrix} 1 & 0 & 0 \\ 0 & \cos(\text{angle-X}) & -\sin(\text{angle-X}) \\ 0 & \sin(\text{angle-X}) & \cos(\text{angle-X}) \\ \end{pmatrix} \)
The logarithm map will e.g. take us from the manifold (angle-X, angle-Y, angle-Z) to the tangent space \((\alpha, \beta, \gamma)\) . and the exponential map takes us from the tangent space to the manifold. According to Rodrigues (1840) the exponential map for R3 going from \((\alpha, \beta, \gamma)\) to the rotation matrix is as follows
\(\exp(\omega) \equiv \text{matexp}(\omega^\wedge) = I_3 + \frac{\sin(|\omega|)}{|\omega|} \omega^\wedge + \frac{1 - \cos(|\omega|)}{|\omega|} (\omega^\wedge)^2\)
This can be verified/tested using the following code, so rodrigues gives us a crazy identity that seems kind of unbelievable ! And it turns out that the formula for the exponential map is even more simple if we are mapping to a quaternion.
\(\displaystyle \exp(\omega) \equiv \begin{cases}(1,0,0,0)^T &\text{ if } \omega = (0,0,0)\\ \big( \cos(|\omega|/2), \sin(|\omega|/2) \,\omega / |\omega|\big) \end{cases}\)
import scipy
import scipy.linalg
import numpy as np
w = [1, 2, 3]
x,y,z = w
w_wedge = [[0, -z, y], [z, 0, -x], [-y,
w_wedge = np.array(w_wedge)
theta = np.linalg.norm(w)
# lhs requires 1.86e-4s to compute
lhs = scipy.linalg.expm(w_wedge)
# rhs requires 1.61e-5s to compute!
rhs = (np.eye(3)
+ np.sin(theta) / theta * w_wedge
+ (1 - np.cos(theta)) / theta / theta * w_wedge @ w_wedge)
np.testing.assert_allclose(lhs, rhs)
print(lhs)
#[[-0.69492056, 0.71352099, 0.08929286],
# -0.19200697, -0.30378504, 0.93319235],
# 0.69297817, 0.6313497 , 0.34810748]]
The group SE(3) and its algebra \(\mathfrak{se}(3)\)
Now we can also compute the exponential \((\mathfrak{se}(3) \to \mathbf{SE}(3))\) and logarithm map \((\mathbf{SE}(3) \to \mathfrak{se}(3))\). Let
\(v = \begin{pmatrix} t \\ \omega \end{pmatrix}\) then the matrix exponential is \(\exp(v) \equiv \exp(\begin{pmatrix} \omega^\wedge & t \\ 0& 0\end{pmatrix}) = \begin{pmatrix} \exp(\omega^\wedge) & V \times t \\ 0 & 1\end{pmatrix} \) where
\(V = I_3 + \frac{1 - \cos(\theta) }{\theta^2} \omega^\wedge + \frac{\theta - \sin(\theta)}{\theta^3} (\omega^\wedge)^2\).
Bonus material : Optimization on SE(3)
The basic idea is simply that the derivatives live in the tangent space. Therefore before applying them to a point in the manifold, we must bring them back to the manifold using the exponential map, and then apply them to the current point as a group action. Se chapter 10 and Appendices of the following tutorial.
https://ingmec.ual.es/~jlblanco/papers/jlblanco2010geometry3D_techrep.pdf