Say we have an object (e.g., end-effector of a robot) that is defined in a general coordinate system by a Cartesian position and Quaternion.

since the Quaternion is with respect to a general and fixed coordinate system, it is rather not intuitive for me how to calculate this Quaternion if the object is rotated locally.

That is, assuming a local coordinate system on this object, while keeping the position of it also fixed, I want to calculate a new Quaternion vector if the object is rotated by small angles (α, β, γ, or pitch, yaw, and roll) with respect to this local frame/coordinate-system.


1 Answer 1


It is often useful to create a 2D example and use rigid-body transforms (i.e., $T\in\text{SE}(2)$, where ${\small T=\begin{bmatrix}R&t\\0&1\end{bmatrix}}$, $R\in\text{SO}(2),t\in\mathbb{R}^2$). In this way, the position and rotation are compactly encoded in a single element.

When working through these types of problems, it is important to clearly define notation and coordinate frames. For example, here we will write $T^a_b$ to describe the coordinate frame $\mathcal{F}^b$ with respect to $\mathcal{F}^a$. In other words, $T^a_b$ transforms data in $b$ and expresses it in $a$ (e.g., see more here).

In the following diagram, I have drawn the world frame axis $\mathcal{F}^W$ and an object that has a position and orientation with respect to that world frame (i.e., $T^W_b$). This object has its own coordinate frame $\mathcal{F}^b$. Now, a further transformation $T^b_{b'}$ occurs, where it just so happens that there was no translation. This final coordinate body position and orientation can be expressed in terms of the world frame by composition as

$$ T^W_{b'} = T^W_b T^b_{b'}. $$

Now, to answer your question more concretely, we can consider just the unit quaternion encoding the orientation of $\mathcal{F}^{b'}$ w.r.t $\mathcal{F}^W$, that is, for $q\in S^3$,

$$ q^W_{b'} = q^W_b q^b_{b'}. $$

In your setup, it sounds like you have $q^W_b$ and some Euler angles describing the rotation $q^b_{b'}$. Given everything above, your question seems to become "how do I convert Euler angles to a quaternion," for which many answers and software packages exist (Wikipedia). Please take care to know if your Euler angles are expressed as intrinsic or extrinsic and the correct rotation order. I recommend using something like MATLAB's eul2quat or, in Python, transformations.py (embedded in ROS as tf.transformations) to verify.

coordinate transformations from world to body to body'


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.