├── LICENSE └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 clemense 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Quaternion Order Conventions 2 | 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. 3 | 4 | The following table shows quaternion implementations and their chosen order:
5 | X-Y-Z-W 🟥 (scalar-last format)   vs.   W-X-Y-Z 🟦 6 | 7 | | Library / Framework | Quaternion Format | 8 | | --- | --- | 9 | | [autolab_core](https://berkeleyautomation.github.io/autolab_core/api/dual_quaternion.html#autolab_core.DualQuaternion.qr) | W-X-Y-Z 🟦| 10 | | [Blender.mathutils](https://docs.blender.org/api/blender_python_api_current/mathutils.html?highlight=vector#mathutils.Quaternion) | W-X-Y-Z 🟦| 11 | | [Boost](https://www.boost.org/doc/libs/1_71_0/libs/math/example/HSO3.hpp) | W-X-Y-Z 🟦| 12 | | [Bullet](https://pybullet.org/Bullet/BulletFull/classbtQuaternion.html) / [PyBullet](http://goo.gl/QwJnFX) | X-Y-Z-W 🟥| 13 | | [DART](https://github.com/dartsim/dart/blob/5058255853d5b733476fc031b18fb95bdf7d7f5d/python/dartpy/eigen_geometry_pybind.cpp#L225) (uses Eigen::Quaternion)| W-X-Y-Z 🟦| 14 | | [Drake](https://drake.mit.edu/pydrake/pydrake.common.eigen_geometry.html?highlight=quaternion#pydrake.common.eigen_geometry.Quaternion_[float]) (uses Eigen::Quaternion)| W-X-Y-Z 🟦| 15 | | [differentiable-robot-model](https://github.com/facebookresearch/differentiable-robot-model/blob/7e58c1f286a57d48deaafc78bda0e3dedb8e5c4a/differentiable_robot_model/se3_so3_util.py) | X-Y-Z-W 🟥| 16 | | [dm_robotics.transformations](https://github.com/deepmind/dm_robotics/tree/main/py/transformations)| W-X-Y-Z 🟦| 17 | | [Eigen - API](https://eigen.tuxfamily.org/dox/classEigen_1_1Quaternion.html)| W-X-Y-Z 🟦| 18 | | [Eigen - Internal memory ordering](https://eigen.tuxfamily.org/dox/classEigen_1_1Quaternion.html#a3eba7a582f77a8f30525614821d7056f)| X-Y-Z-W 🟥| 19 | | [FleX](https://developer.nvidia.com/flex) | X-Y-Z-W 🟥| 20 | | [iDynTree](https://robotology.github.io/idyntree/classiDynTree_1_1Rotation.html#adcac444f00ca751417f3095b401de86c) | W-X-Y-Z 🟦 | 21 | | [Isaac Gym](https://developer.nvidia.com/isaac-gym) | X-Y-Z-W 🟥| 22 | | [Isaac Lab](https://isaac-sim.github.io/IsaacLab/main/source/migration/migrating_from_isaacgymenvs.html#quaternion-convention) | W-X-Y-Z 🟦| 23 | | [Isaac Sim](https://docs.omniverse.nvidia.com/isaacsim/latest/reference_conventions.html#quaternions) | W-X-Y-Z 🟦| 24 | | [lietorch](https://github.com/princeton-vl/lietorch) | X-Y-Z-W 🟥| 25 | | [jaxlie](https://brentyi.github.io/jaxlie/api/jaxlie/_se3/?highlight=quaternion#jaxlie._se3.SE3.wxyz_xyz) | W-X-Y-Z 🟦 | 26 | | [Klampt](http://motion.cs.illinois.edu/software/klampt/latest/pyklampt_docs/_modules/klampt/math/so3.html#quaternion) | W-X-Y-Z 🟦| 27 | | [MATLAB](https://www.mathworks.com/help/robotics/ref/quaternion.html) | W-X-Y-Z 🟦| 28 | | [MuJoCo](http://mujoco.org/book/modeling.html#COrientation) | W-X-Y-Z 🟦| 29 | | [Nuklei](http://nuklei.sourceforge.net/doxygen/) | W-X-Y-Z 🟦| 30 | | [numpy-quaternions](https://github.com/moble/quaternion) | W-X-Y-Z 🟦| 31 | | [OpenRAVE 0.9.0](http://openrave.org/docs/latest_stable/coreapihtml/geometry_8h_source.html) | X-Y-Z-W 🟥| 32 | | [Orocos KDL](http://docs.ros.org/jade/api/orocos_kdl/html/classKDL_1_1Rotation.html) | X-Y-Z-W 🟥| 33 | | [PhysX](https://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/apireference/files/classPxQuat.html) | X-Y-Z-W 🟥| 34 | | [PyMesh](https://pymesh.readthedocs.io/en/latest/api_misc.html#quaternion) | W-X-Y-Z 🟦| 35 | | [pyquaternion](https://github.com/KieranWynn/pyquaternion) | W-X-Y-Z 🟦| 36 | | [pyrr](https://pyrr.readthedocs.io/en/latest/_modules/pyrr/quaternion.html) | X-Y-Z-W 🟥| 37 | | [pytorch3d](https://pytorch3d.readthedocs.io/en/latest/_modules/pytorch3d/transforms/rotation_conversions.html#standardize_quaternion) | W-X-Y-Z 🟦| 38 | | [pytransform3d](https://github.com/dfki-ric/pytransform3d/blob/c45e817c4a7960108afe9f5259542c8376c0e89a/pytransform3d/rotations/_quaternion_operations.py#L22) | W-X-Y-Z 🟦| 39 | | [quaternions](https://github.com/mjsobrep/quaternions/blob/master/quaternions/quaternion.py) | W-X-Y-Z 🟦| 40 | | [RoMa](https://naver.github.io/roma/#main-features) | X-Y-Z-W 🟥| 41 | | [ROS](https://docs.ros.org/api/geometry_msgs/html/msg/Quaternion.html) | X-Y-Z-W 🟥| 42 | | [ROS2 (tf2)](https://github.com/ros2/geometry2/blob/rolling/tf2/include/tf2/LinearMath/QuadWord.h) | X-Y-Z-W 🟥| 43 | | [scipy.spatial.transforms](https://docs.scipy.org/doc/scipy/reference/spatial.transform.html#) | X-Y-Z-W 🟥| 44 | | [spatialmath-python](https://bdaiinstitute.github.io/spatialmath-python/func_quat.html#module-spatialmath.base.quaternions) | W-X-Y-Z 🟦| 45 | | [squaternion](https://github.com/MomsFriendlyRobotCompany/squaternion/blob/master/squaternion/squaternion.py) | W-X-Y-Z 🟦| 46 | | [The Library for Uniform Deterministic Sequences and Sets of Samples over 2-sphere and SO(3)](http://lavalle.pl/software/so3/so3.html)| X-Y-Z-W 🟥| 47 | | [Theseus](https://github.com/facebookresearch/theseus/blob/e6dd7937edee59daf5f5c2ffe870f39fa1171e90/theseus/embodied/kinematics/kinematics_model.py#L44)| W-X-Y-Z 🟦| 48 | | [transformations.py (<=2009.04.18)](http://docs.ros.org/jade/api/tf/html/python/transformations.html) | X-Y-Z-W 🟥| 49 | | [transformations.py (>=2010.05.10](https://www.lfd.uci.edu/~gohlke/code/transformations.py.html), includes [trimesh.transformations)](https://github.com/mikedh/trimesh/blob/master/trimesh/transformations.py) | W-X-Y-Z 🟦| 50 | | [Transforms3d](https://matthew-brett.github.io/transforms3d/reference/transforms3d.quaternions.html)| W-X-Y-Z 🟦| 51 | | [tinyquaternion](https://github.com/rezaahmadzadeh/tinyquaternion/blob/master/tinyquaternion/tinyQuaternion.py)| W-X-Y-Z 🟦| 52 | | [USD (Pixar) - API](https://graphics.pixar.com/usd/release/api/class_gf_quatf.html#a781cffeee14aa3ba3f89de7d6df5a035)| W-X-Y-Z 🟦| 53 | | [USD (Pixar) - Internal memory ordering](https://graphics.pixar.com/usd/release/api/quatf_8h_source.html)| X-Y-Z-W 🟥| 54 | | [ViSII - A VIrtual Scene Imaging Interface](https://owl-project.github.io/ViSII/all.html#visii.quat)| W-X-Y-Z 🟦| 55 | | [NVIDIA Warp](https://nvidia.github.io/warp/_build/html/modules/functions.html?highlight=transform#quaternion-math) | X-Y-Z-W 🟥| 56 | | [YARP - API](https://www.yarp.it/latest/classyarp_1_1math_1_1Quaternion.html) | X-Y-Z-W 🟥 | 57 | | [YARP - Internal memory ordering](https://github.com/robotology/yarp/blob/v3.8.0/src/libYARP_math/src/yarp/math/Quaternion.h#L23) | W-X-Y-Z 🟦 | 58 | --------------------------------------------------------------------------------