Unit dual quaternion

class UnitDualQuaternion(real=None, dual=None)[source]

Bases: spatialmath.DualQuaternion.DualQuaternion

[summary]

Parameters

DualQuaternion ([type]) – [description]

Warning

Unlike the other spatial math classes, this class does not (yet) support multiple values per object.

Seealso

UnitDualQuaternion()

classmethod Pure(x)
Return type

Self

SE3()[source]

Convert unit dual quaternion to SE(3) matrix

Returns

SE(3) matrix

Return type

SE3

Example:

  File "<input>", line 1, in <module>
NameError: name 'd' is not defined
Traceback (most recent call last):
  File "<input>", line 1, in <module>
NameError: name 'd' is not defined
__add__(right)

Sum of two dual quaternions

Returns

Product

Return type

DualQuaternion

Example:

>>> from spatialmath import DualQuaternion, Quaternion
>>> d = DualQuaternion(Quaternion([1,2,3,4]), Quaternion([5,6,7,8]))
>>> d + d
 2.0000 <  4.0000,  6.0000,  8.0000 > + ε  10.0000 <  12.0000,  14.0000,  16.0000 >
__init__(real=None, dual=None)[source]

Create new unit dual quaternion

Parameters
  • UnitDualQuaternion(real, dual) is a new unit dual quaternion with real and dual parts as specified.

  • UnitDualQuaternion(T) is a new unit dual quaternion equivalent to the rigid-body motion described by the SE3 value T.

Example:

>>> from spatialmath import UnitDualQuaternion, SE3
>>> T = SE3.Rand()
>>> print(T)
  -0.4364    0.5227   -0.7323    0.8466    
   0.131    -0.7684   -0.6265    0.2578    
  -0.8901   -0.3693    0.2669    0.2008    
   0         0         0         1         

>>> d = UnitDualQuaternion(T)
>>> print(d)
-0.1246 << -0.5160, -0.3167,  0.7861 >> + ε  0.1803 <  0.0804, -0.4006, -0.0801 >
>>> type(d)
<class 'spatialmath.DualQuaternion.UnitDualQuaternion'>

The dual number is stored internally as two quaternion, respectively called real and dual. For a unit dual quaternion they are respectively:

\[ \begin{align}\begin{aligned}\q_r &\sim \mat{R}\\q_d &= \frac{1}{2} q_t \q_r\end{aligned}\end{align} \]

where \(\mat{R}\) is the rotational part of the rigid-body motion and \(q_t\) is a pure quaternion formed from the translational part \(t\).

__mul__(right)

Product of dual quaternion

  • dq1 * dq2 is a dual quaternion representing the product of dq1 and dq2. If both are unit dual quaternions, the product will be a unit dual quaternion.

  • dq * p transforms the point p (3) by the unit dual quaternion dq.

Example:

>>> from spatialmath import DualQuaternion, Quaternion
>>> d = DualQuaternion(Quaternion([1,2,3,4]), Quaternion([5,6,7,8]))
>>> d * d
-28.0000 <  4.0000,  6.0000,  8.0000 > + ε -120.0000 <  32.0000,  44.0000,  56.0000 >
Return type

Self

__sub__(right)

Difference of two dual quaternions

Returns

Product

Return type

DualQuaternion

Example:

>>> from spatialmath import DualQuaternion, Quaternion
>>> d = DualQuaternion(Quaternion([1,2,3,4]), Quaternion([5,6,7,8]))
>>> d - d
 0.0000 <  0.0000,  0.0000,  0.0000 > + ε  0.0000 <  0.0000,  0.0000,  0.0000 >
conj()

Conjugate of dual quaternion

Returns

Conjugate

Return type

DualQuaternion

There are several conjugates defined for a dual quaternion. This one mirrors conjugation for a regular quaternion. For the dual quaternion \((p, q)\) it returns \((p^*, q^*)\).

Example:

>>> from spatialmath import DualQuaternion, Quaternion
>>> d = DualQuaternion(Quaternion([1,2,3,4]), Quaternion([5,6,7,8]))
>>> d.conj()
 1.0000 < -2.0000, -3.0000, -4.0000 > + ε  5.0000 < -6.0000, -7.0000, -8.0000 >
matrix()

Dual quaternion as a matrix

Returns

Matrix represensation

Return type

ndarray(8,8)

Dual quaternion multiplication can also be written as a matrix-vector product.

Example:

>>> from spatialmath import DualQuaternion, Quaternion
>>> d = DualQuaternion(Quaternion([1,2,3,4]), Quaternion([5,6,7,8]))
>>> d.matrix()
array([[ 1., -2., -3., -4.,  0.,  0.,  0.,  0.],
       [ 2.,  1., -4.,  3.,  0.,  0.,  0.,  0.],
       [ 3.,  4.,  1., -2.,  0.,  0.,  0.,  0.],
       [ 4., -3.,  2.,  1.,  0.,  0.,  0.,  0.],
       [ 5., -6., -7., -8.,  1., -2., -3., -4.],
       [ 6.,  5., -8.,  7.,  2.,  1., -4.,  3.],
       [ 7.,  8.,  5., -6.,  3.,  4.,  1., -2.],
       [ 8., -7.,  6.,  5.,  4., -3.,  2.,  1.]])
>>> d.matrix() @ d.vec
array([ -28.,    4.,    6.,    8., -120.,   32.,   44.,   56.])
>>> d * d
-28.0000 <  4.0000,  6.0000,  8.0000 > + ε -120.0000 <  32.0000,  44.0000,  56.0000 >
norm()

Norm of a dual quaternion

Returns

Norm as a dual number

Return type

2-tuple

The norm of a UnitDualQuaternion is unity, represented by the dual number (1,0).

Example:

>>> from spatialmath import DualQuaternion, Quaternion
>>> d = DualQuaternion(Quaternion([1,2,3,4]), Quaternion([5,6,7,8]))
>>> d.norm()  # norm is a dual number
(5.477225575051661, 11.832159566199232)
property vec: numpy.ndarray[Any, numpy.dtype[numpy.floating]]

Dual quaternion as a vector

Returns

Vector represensation

Return type

ndarray(8)

Example:

>>> from spatialmath import DualQuaternion, Quaternion
>>> d = DualQuaternion(Quaternion([1,2,3,4]), Quaternion([5,6,7,8]))
>>> d.vec
array([1, 2, 3, 4, 5, 6, 7, 8])