Quaternion Component Order (wxyz vs. xyzw)
四元数分量顺序约定(wxyz / xyzw)CommonWhether a quaternion's real part w is stored first or last — a convention that differs across software libraries.
A unit quaternion represents rotation with four numbers: a real part w and imaginary parts x, y, z. The component order convention is whether w is stored first (wxyz, “scalar-first”) or last (xyzw, “scalar-last”) — and software isn't consistent about it: ROS messages and SciPy default to xyzw, while MuJoCo and Isaac Sim Core use wxyz; Isaac Lab 2.x used wxyz, but 3.0 switched to xyzw to align with Warp, PhysX, and Newton. A deeper-level split is the Hamilton versus JPL convention: according to Joan Solà's survey, Hamilton's convention defines ij=k (right-handed), while JPL's defines ji=k (left-handed), so the exact same four numbers represent opposite rotations under the two conventions; robotics mostly uses Hamilton, while aerospace often uses JPL. Getting the order wrong when combining data from different sources is a classic beginner mistake — the code runs fine, but every orientation comes out wrong.
Example“No rotation” is written (1, 0, 0, 0) in wxyz, but (0, 0, 0, 1) in xyzw. Read a ROS-recorded (0, 0, 0, 1) into MuJoCo as if it were wxyz, and it gets interpreted as a 180° rotation about z — the robot starts out facing backward.
- Also called
- Scalar-First / Scalar-Last, wxyz, xyzw, Hamilton Convention, JPL Convention
- Related
- Quaternion · Quaternion Double Cover · Right-Handed Frame & Axis Conventions · Coordinate Transformation · MuJoCo (Multi-Joint dynamics with Contact) · NVIDIA Isaac Lab
- Sources
- Joan Solà, Quaternion kinematics for the error-state Kalman filter (arXiv:1711.02508)
Isaac Lab: Migrating to Isaac Lab 3.0 (Quaternion Format)
SciPy: Rotation.from_quat - As of
- 2026-09