I'm working on an attitude control system in terms of quaternions, and i'm basing my approach on the book Space Vehicle Dynamics and Control (2nd ed.). If we consider a proportionate controller, i.e.

$$\mathbf{u} = -\mathbf{K}_p \mathbf{q}_e $$

it would seem logical to me to define the error quaternions to be the first three elements of

$$\begin{bmatrix} q_{1e} \\ q_{2e} \\ q_{3e} \\ q_{4e} \\ \end{bmatrix} = \begin{bmatrix} q_{1} \\ q_{2} \\ q_{3} \\ q_{4} \\ \end{bmatrix} - \begin{bmatrix} q_{1c} \\ q_{2c} \\ q_{3c} \\ q_{4c} \\ \end{bmatrix}$$

Where $q_i$ are the actual quaternions and $q_c$ are the desired (commanded) quaternions. Yet in the book, they instead define

$$\begin{bmatrix} q_{1e} \\ q_{2e} \\ q_{3e} \\ q_{4e} \\ \end{bmatrix} = \begin{bmatrix} q_{4c} & q_{3c} & -q_{2c} & -q_{1c} \\ -q_{3c} & q_{4c} & q_{1c} & -q_{2c} \\ q_{2c} & -q_{1c} & q_{4c} & -q_{3c} \\ q_{1c} & q_{2c} & q_{3c} & q_{4c}\\ \end{bmatrix}\begin{bmatrix} q_{1} \\ q_{2} \\ q_{3} \\ q_{4} \\ \end{bmatrix}$$

To me it seems like we do this because there are multiple possible quaternions that correspond to the same orientation, but I have not yet found a clear explanation for this. Can anyone enlighten me?

  • $\begingroup$ Page back in the book a bit to check the math, or do some cyphering. As used in navigation, quaternions define rotations, and rotation is carried out by multiplying them together. So I would expect that $q_e$ would be the solution to either $q_i q_e$ = $q_c$, or $q_e q_i$ = $q_c$. If so, the matrix math is just how the actual numerical solution is calculated. $\endgroup$
    – TimWescott
    Commented Apr 5, 2021 at 15:45
  • $\begingroup$ One reason : With Quaternions you can never get in gimbal lock. $\endgroup$
    – Ben
    Commented Apr 9, 2021 at 14:18

1 Answer 1


A possible explanation is that a set of 4 quaternions is not independent, so by converting them to error quaternions, we get 3 independent values that we can use to calculate 3 independent control actions (one for each axis).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.