Quaternions are expressions of the form w + x i + y j + z k, with x i + y j + z k being the vector/imaginary part and w the scalar/real part. Math libraries differ in the way they order the vector and real part of a quaternion. This can lead to bothersome debugging sessions.
The following table shows quaternion implementations and their chosen order:
X-Y-Z-W π₯ (scalar-last format) Β vs. Β W-X-Y-Z π¦
| Library / Framework | Quaternion Format |
|---|---|
| autolab_core | W-X-Y-Z π¦ |
| Blender.mathutils | W-X-Y-Z π¦ |
| Boost | W-X-Y-Z π¦ |
| Bullet / PyBullet | X-Y-Z-W π₯ |
| DART (uses Eigen::Quaternion) | W-X-Y-Z π¦ |
| Drake (uses Eigen::Quaternion) | W-X-Y-Z π¦ |
| differentiable-robot-model | X-Y-Z-W π₯ |
| dm_robotics.transformations | W-X-Y-Z π¦ |
| Eigen - API | W-X-Y-Z π¦ |
| Eigen - Internal memory ordering | X-Y-Z-W π₯ |
| FleX | X-Y-Z-W π₯ |
| iDynTree | W-X-Y-Z π¦ |
| Isaac Gym | X-Y-Z-W π₯ |
| Isaac Lab | W-X-Y-Z π¦ |
| Isaac Sim | W-X-Y-Z π¦ |
| lietorch | X-Y-Z-W π₯ |
| jaxlie | W-X-Y-Z π¦ |
| Klampt | W-X-Y-Z π¦ |
| MATLAB | W-X-Y-Z π¦ |
| MuJoCo | W-X-Y-Z π¦ |
| Nuklei | W-X-Y-Z π¦ |
| numpy-quaternions | W-X-Y-Z π¦ |
| OpenRAVE 0.9.0 | X-Y-Z-W π₯ |
| Orocos KDL | X-Y-Z-W π₯ |
| PhysX | X-Y-Z-W π₯ |
| PyMesh | W-X-Y-Z π¦ |
| pyquaternion | W-X-Y-Z π¦ |
| pyrr | X-Y-Z-W π₯ |
| pytorch3d | W-X-Y-Z π¦ |
| pytransform3d | W-X-Y-Z π¦ |
| quaternions | W-X-Y-Z π¦ |
| RoMa | X-Y-Z-W π₯ |
| ROS | X-Y-Z-W π₯ |
| ROS2 (tf2) | X-Y-Z-W π₯ |
| scipy.spatial.transforms | X-Y-Z-W π₯ |
| spatialmath-python | W-X-Y-Z π¦ |
| squaternion | W-X-Y-Z π¦ |
| The Library for Uniform Deterministic Sequences and Sets of Samples over 2-sphere and SO(3) | X-Y-Z-W π₯ |
| Theseus | W-X-Y-Z π¦ |
| transformations.py (<=2009.04.18) | X-Y-Z-W π₯ |
| transformations.py (>=2010.05.10, includes trimesh.transformations) | W-X-Y-Z π¦ |
| Transforms3d | W-X-Y-Z π¦ |
| tinyquaternion | W-X-Y-Z π¦ |
| USD (Pixar) - API | W-X-Y-Z π¦ |
| USD (Pixar) - Internal memory ordering | X-Y-Z-W π₯ |
| ViSII - A VIrtual Scene Imaging Interface | W-X-Y-Z π¦ |
| NVIDIA Warp | X-Y-Z-W π₯ |
| YARP - API | X-Y-Z-W π₯ |
| YARP - Internal memory ordering | W-X-Y-Z π¦ |