Dual quaternions are a way of representing rigid body transformations, just like homogeneous transformations do. Instead of using a 4x4 matrix, the transformation is represented as two quaternions. This has several advantages, which are listed under Why use dual quaternions?. The term 'dual' refers to dual number theory, which allows representing numbers (or in this case quaternions) very similar to complex numbers, with the difference being that i or j becomes e (epsilon), and instead of i^2 = -1, we have e^2 = 0. This allows, for example, the multiplication of two dual quaternions to work in the same way as homogeneous matrix multiplication.
This repository attempts to explain the use of dual quaternions in practice while linking the implementation to the various mathematical formulations and definitions.
For more information on dual quaternions, take a look at the References. For conversion from and to common ROS messages, see dual_quaternions_ros.
- dual quaternions have all the advantages of quaternions including unambiguous representation, no gimbal lock, compact representation
- direct and simple relation with screw theory. Simple and fast Screw Linear Interpolation (ScLERP) which is shortest path on the manifold
- we want to use quaternions but they can only handle rotation. Dual quaternions are the correct extension to handle translations as well. In an optimization problem where the decision variable is a transformation, splitting translation and orientation often means slower gradient descent because a separate optimization step for the rotation and for the translation need to be reconciled.
- easy normalization. Homogeneous tranformation matrices are orthogonal and due to floating point errors operations on them often result in matrices that need to be renormalized. This can be done using the Gram-Schmidt method but that is a slow algorithm. Quaternion normalization is very fast.
- storage and multiplication of homogenous transformation matrices is less efficient than dual quaternions:
- store 8 values vs 16 (or 12)
- 88 elementary operations vs 122 for matrix multiplication
pip install dual_quaternionsfrom dual_quaternions import DualQuaternion- K. Daniilidis, E. Bayro-Corrochano, "The dual quaternion approach to hand-eye calibration", IEEE International Conference on Pattern Recognition, 1996
- Kavan, Ladislav & Collins, Steven & Zara, Jiri & O'Sullivan, Carol. (2007). Skinning with dual quaternions. I3D. 39-46. 10.1145/1230100.1230107.
- Kenwright, B. (2012). A Beginners Guide to Dual-Quaternions What They Are, How They Work, and How to Use Them for 3D Character Hierarchies.
- Furrer, Fadri & Fehr, Marius & Novkovic, Tonci & Sommer, Hannes & Gilitschenski, Igor & Siegwart, Roland. (2018). Evaluation of Combined Time-Offset Estimation and Hand-Eye Calibration on Robotic Datasets. 145-159. 10.1007/978-3-319-67361-5_10.
- Yan-Bin Jia. Dual quaternions. Iowa State University: Ames, IA, USA, 2013.
Many libraries focus on efficiency and are written in C++, sometimes with Python bindings. They typically do not include tests or links to mathematical definitions and so it's hard to know whether the functions they implement are correct or what you're looking for. Along with a test suite, this library aims to explain the various functions and why they're implemented that way. As a result it serves as a starting point for those trying to get started with dual quaternions in programming.
- Hasenpfote/dualquat: C++, header-only using Eigen
- neka-nat/dq3d: C++ based, using Eigen, with Python bindings including examples for ScLERP and skinning
- dqrobotics: Matlab, C++11 with Python3 bindings, includes docstrings
The exponential map is a map from the tangent space at some point x on the manifold onto its Lie group. It maps a vector
- exp:
$\mathfrak{se}(3) \rightarrow SE(3)$ - takes elements from the Lie algebra to the manifold
- log:
$SE(3) \rightarrow \mathfrak{se}(3)$ - takes elements from the manifold to the Lie Algebra
In some sources log and exp are derived using the Taylor method first order approximation
where
