[Math] Small angular displacements with a quaternion representation

physicsquaternionsrotations

I have the orientation of a 3D spatial object represented by a unit quaternion:

$$
q = a_1 + a_2 i + a_3 j + a_4 k
$$
$$
\|q\| = (a_1^2 + a_2^2 + a_3^2 + a_4^2)^{1/2} = 1
$$

I'd like to perturb this orientation slightly. If this displacment is small, I think I can get away with

$$
q'_2 = q + \Delta (u_1 + u_2 i + u_3 j + u_4 k)
$$

where $\Delta << 1$ and the $u$ are uniform random numbers in the range of $[-1,1]$. $q'_2$ is obviously not a unit quaternion anymore so I would normalize it by

$$
q_2 = \frac{q'_2}{\|q'_2\|}
$$

As $\Delta$ gets larger, I feel that this will become an increasingly worse approximation. Is there a better way to get a random orientational displacement?

Best Answer

You would like to sample a unit quaternion $q'$ from a normal distribution with mean $q$ and some variance $\omega$?

Background:

A rotation matrix $R_{a,b}$ can be seen as transformation which rotates a point $p$ from reference frame $b$ to the reference frame $a$: $p_a = R_{a,b}p_b$. Obviously, the same holds for unit quaterions representing rotations, so we could write $q_{a,b}$ to emphasis that this quaternion represents a rotation from frame $b$ to frame $a$ (as in $p_a = q_{a,b}\cdot p_b \cdot q_{a,b}^{-1}$).

The first question, we have to ask ourselves in which frame we'd like to sample, i.e. perturb $q_{a,b}$: frame $a$ or frame $b$? This really depends on the application. Let us simply assume $a$ for now.

Approach:

A good approach would be to sample in the tangent space at frame $a$. To be more precise, we would sample in the tangent space around the identity $\exp(\omega)$ with $\omega$ been drawn from a 3-dimensional zero-mean Normal distribution. Then, we apply this quaternion $\exp(\omega)$ to $q_{a,b}$. Thus the resulting quaterion is:

$$ q' = \exp(\omega)\cdot q_{a,b} \quad (\text{with} \quad \omega \in \mathbb{R}^3)$$

Here $\cdot$ is the quaternion multiplication, and $\exp$ the unit quaternion exponential: $\exp(\omega) = (\cos(\theta), \frac{1}{\theta}\sin(\theta)\omega )$ with $\theta = ||\omega||$.

(If we'd like to sample in frame $b$, we would do $q' = q_{a,b}\cdot \exp(\omega)$