Kindr
Kinematics and Dynamics for Robotics
kindr::Quaternion< PrimType_ > Class Template Reference

Implementation of a Quaternion based on Eigen::Quaternion. More...

#include <Quaternion.hpp>

Inheritance diagram for kindr::Quaternion< PrimType_ >:
Inheritance graph

Public Types

typedef Base Implementation
 the implementation type, i.e., Eigen::Quaternion<> More...
 
typedef PrimType_ Scalar
 the scalar type, i.e., the type of the coefficients More...
 
typedef Eigen::Matrix< PrimType_, 3, 1 > Imaginary
 the imaginary type, i.e., Eigen::Quaternion<> More...
 
typedef Eigen::Matrix< PrimType_, 4, 1 > Vector4
 quaternion as 4x1 matrix: [w; x; y; z] More...
 

Public Member Functions

 Quaternion ()
 Default constructor creates a quaternion with all coefficients equal to zero. More...
 
 Quaternion (Scalar w, Scalar x, Scalar y, Scalar z)
 Constructor using four scalars. More...
 
 Quaternion (Scalar real, const Imaginary &imag)
 Constructor using real and imaginary part. More...
 
 Quaternion (const Vector4 &vector4)
 Constructor using Eigen::Matrix<PrimType_,4,1>. More...
 
 Quaternion (const Base &other)
 
Quaternion inverted () const
 
Quaternioninvert ()
 
Quaternion conjugated () const
 
Quaternionconjugate ()
 
Quaternionoperator= (const Quaternion< PrimType_ > &other)
 
Quaternionoperator= (const UnitQuaternion< PrimType_ > &other)
 
template<typename PrimTypeIn_ >
Quaternionoperator() (const Quaternion< PrimTypeIn_ > &other)
 
template<typename PrimTypeIn_ >
Quaternionoperator() (const UnitQuaternion< PrimTypeIn_ > &other)
 
ImplementationtoImplementation ()
 
const ImplementationtoImplementation () const
 
Scalar w () const
 
Scalar x () const
 
Scalar y () const
 
Scalar z () const
 
Scalarw ()
 
Scalarx ()
 
Scalary ()
 
Scalarz ()
 
Scalar real () const
 
Imaginary imaginary () const
 
Vector4 vector () const
 
Scalar norm () const
 
Quaternion normalized () const
 
Quaternionnormalize ()
 
QuaternionsetZero ()
 
UnitQuaternion< PrimType_ > toUnitQuaternion () const
 
Eigen::Matrix< PrimType_, 4, 4 > getQuaternionMatrix ()
 Returns the quaternion matrix Qleft: q*p = Qleft(q)*p This function can be used to get the derivative of the concatenation with respect to the right quaternion. More...
 
Eigen::Matrix< PrimType_, 4, 4 > getConjugateQuaternionMatrix ()
 Returns the quaternion matrix Qright: q*p = Qright(p)*q This function can be used to get the derivative of the concatenation with respect to the left quaternion. More...
 
- Public Member Functions inherited from kindr::QuaternionBase< Quaternion< PrimType_ > >
Quaternion< PrimType_ > & invert ()
 inverts the quaternion More...
 
Quaternion< PrimType_ > inverted () const
 gets the inverse of the quaternion More...
 
Quaternion< PrimType_ > & conjugate ()
 conjugates the quaternion More...
 
Quaternion< PrimType_ > conjugated () const
 gets the conjugate of the quaternion More...
 
 operator Quaternion< PrimType_ > & ()
 gets the derived quaternion (only for advanced users) More...
 
 operator const Quaternion< PrimType_ > & () const
 gets the derived quaternion (only for advanced users) More...
 
Quaternion< PrimType_ > & derived ()
 gets the derived quaternion (only for advanced users) More...
 
const Quaternion< PrimType_ > & derived () const
 gets the derived quaternion (only for advanced users) More...
 
Quaternion< PrimType_ > operator* (const QuaternionBase< OtherDerived_ > &other) const
 multiplies the quaternion with another quaternion More...
 
bool operator== (const QuaternionBase< OtherDerived_ > &other) const
 compares the quaternion with another quaternion More...
 

Private Types

typedef Eigen::Quaternion< PrimType_ > Base
 

Detailed Description

template<typename PrimType_>
class kindr::Quaternion< PrimType_ >

Implementation of a Quaternion based on Eigen::Quaternion.

The Hamiltonian convention is used, where Q = w + x*i + y*j + z*k and i*i=j*j=k*k=ijk=-1.

The following two typedefs are provided for convenience:

  • QuaternionF for float
  • QuaternionD for double
See also
rm::UnitQuaternion for an implementation of a unit quaternion
rm::rotations::RotationQuaternion for Quaternions that represent a rotation

Definition at line 55 of file Quaternion.hpp.

Member Typedef Documentation

◆ Base

template<typename PrimType_>
typedef Eigen::Quaternion<PrimType_> kindr::Quaternion< PrimType_ >::Base
private

Definition at line 57 of file Quaternion.hpp.

◆ Imaginary

template<typename PrimType_>
typedef Eigen::Matrix<PrimType_,3,1> kindr::Quaternion< PrimType_ >::Imaginary

the imaginary type, i.e., Eigen::Quaternion<>

Definition at line 64 of file Quaternion.hpp.

◆ Implementation

template<typename PrimType_>
typedef Base kindr::Quaternion< PrimType_ >::Implementation

the implementation type, i.e., Eigen::Quaternion<>

Definition at line 60 of file Quaternion.hpp.

◆ Scalar

template<typename PrimType_>
typedef PrimType_ kindr::Quaternion< PrimType_ >::Scalar

the scalar type, i.e., the type of the coefficients

Definition at line 62 of file Quaternion.hpp.

◆ Vector4

template<typename PrimType_>
typedef Eigen::Matrix<PrimType_,4,1> kindr::Quaternion< PrimType_ >::Vector4

quaternion as 4x1 matrix: [w; x; y; z]

Definition at line 66 of file Quaternion.hpp.

Constructor & Destructor Documentation

◆ Quaternion() [1/5]

template<typename PrimType_>
kindr::Quaternion< PrimType_ >::Quaternion ( )
inline

Default constructor creates a quaternion with all coefficients equal to zero.

Definition at line 69 of file Quaternion.hpp.

◆ Quaternion() [2/5]

template<typename PrimType_>
kindr::Quaternion< PrimType_ >::Quaternion ( Scalar  w,
Scalar  x,
Scalar  y,
Scalar  z 
)
inline

Constructor using four scalars.

Parameters
wfirst entry of the quaternion
xsecond entry of the quaternion
ythird entry of the quaternion
zfourth entry of the quaternion

Definition at line 79 of file Quaternion.hpp.

◆ Quaternion() [3/5]

template<typename PrimType_>
kindr::Quaternion< PrimType_ >::Quaternion ( Scalar  real,
const Imaginary imag 
)
inline

Constructor using real and imaginary part.

Parameters
realreal part (PrimType_)
imagimaginary part (Eigen::Matrix<PrimType_,3,1>)

Definition at line 87 of file Quaternion.hpp.

◆ Quaternion() [4/5]

template<typename PrimType_>
kindr::Quaternion< PrimType_ >::Quaternion ( const Vector4 vector4)
inline

Constructor using Eigen::Matrix<PrimType_,4,1>.

Parameters
otherEigen::Matrix<PrimType_,4,1>

Definition at line 94 of file Quaternion.hpp.

◆ Quaternion() [5/5]

template<typename PrimType_>
kindr::Quaternion< PrimType_ >::Quaternion ( const Base other)
inlineexplicit

Definition at line 99 of file Quaternion.hpp.

Member Function Documentation

◆ conjugate()

template<typename PrimType_>
Quaternion& kindr::Quaternion< PrimType_ >::conjugate ( )
inline

the quaternion

Definition at line 124 of file Quaternion.hpp.

◆ conjugated()

template<typename PrimType_>
Quaternion kindr::Quaternion< PrimType_ >::conjugated ( ) const
inline
Returns
the conjugate of the quaternion

Definition at line 118 of file Quaternion.hpp.

◆ getConjugateQuaternionMatrix()

template<typename PrimType_>
Eigen::Matrix<PrimType_,4,4> kindr::Quaternion< PrimType_ >::getConjugateQuaternionMatrix ( )
inline

Returns the quaternion matrix Qright: q*p = Qright(p)*q This function can be used to get the derivative of the concatenation with respect to the left quaternion.

Returns
the quaternion matrix Qright

Definition at line 264 of file Quaternion.hpp.

◆ getQuaternionMatrix()

template<typename PrimType_>
Eigen::Matrix<PrimType_,4,4> kindr::Quaternion< PrimType_ >::getQuaternionMatrix ( )
inline

Returns the quaternion matrix Qleft: q*p = Qleft(q)*p This function can be used to get the derivative of the concatenation with respect to the right quaternion.

Returns
the quaternion matrix Qleft

Definition at line 251 of file Quaternion.hpp.

◆ imaginary()

template<typename PrimType_>
Imaginary kindr::Quaternion< PrimType_ >::imaginary ( ) const
inline

Definition at line 212 of file Quaternion.hpp.

◆ invert()

template<typename PrimType_>
Quaternion& kindr::Quaternion< PrimType_ >::invert ( )
inline

the quaternion

Definition at line 111 of file Quaternion.hpp.

◆ inverted()

template<typename PrimType_>
Quaternion kindr::Quaternion< PrimType_ >::inverted ( ) const
inline
Returns
the inverse of the quaternion

Definition at line 105 of file Quaternion.hpp.

◆ norm()

template<typename PrimType_>
Scalar kindr::Quaternion< PrimType_ >::norm ( ) const
inline

Definition at line 222 of file Quaternion.hpp.

◆ normalize()

template<typename PrimType_>
Quaternion& kindr::Quaternion< PrimType_ >::normalize ( )
inline

Definition at line 230 of file Quaternion.hpp.

◆ normalized()

template<typename PrimType_>
Quaternion kindr::Quaternion< PrimType_ >::normalized ( ) const
inline

Definition at line 226 of file Quaternion.hpp.

◆ operator()() [1/2]

template<typename PrimType_>
template<typename PrimTypeIn_ >
Quaternion& kindr::Quaternion< PrimType_ >::operator() ( const Quaternion< PrimTypeIn_ > &  other)
inline

Definition at line 147 of file Quaternion.hpp.

◆ operator()() [2/2]

template<typename PrimType_>
template<typename PrimTypeIn_ >
Quaternion& kindr::Quaternion< PrimType_ >::operator() ( const UnitQuaternion< PrimTypeIn_ > &  other)
inline

Definition at line 157 of file Quaternion.hpp.

◆ operator=() [1/2]

template<typename PrimType_>
Quaternion& kindr::Quaternion< PrimType_ >::operator= ( const Quaternion< PrimType_ > &  other)
inline

Definition at line 129 of file Quaternion.hpp.

◆ operator=() [2/2]

template<typename PrimType_>
Quaternion& kindr::Quaternion< PrimType_ >::operator= ( const UnitQuaternion< PrimType_ > &  other)
inline

Definition at line 137 of file Quaternion.hpp.

◆ real()

template<typename PrimType_>
Scalar kindr::Quaternion< PrimType_ >::real ( ) const
inline

Definition at line 208 of file Quaternion.hpp.

◆ setZero()

template<typename PrimType_>
Quaternion& kindr::Quaternion< PrimType_ >::setZero ( )
inline

Definition at line 235 of file Quaternion.hpp.

◆ toImplementation() [1/2]

template<typename PrimType_>
Implementation& kindr::Quaternion< PrimType_ >::toImplementation ( )
inline

Definition at line 166 of file Quaternion.hpp.

◆ toImplementation() [2/2]

template<typename PrimType_>
const Implementation& kindr::Quaternion< PrimType_ >::toImplementation ( ) const
inline

Definition at line 169 of file Quaternion.hpp.

◆ toUnitQuaternion()

template<typename PrimType_>
UnitQuaternion<PrimType_> kindr::Quaternion< PrimType_ >::toUnitQuaternion ( ) const
inline

Definition at line 243 of file Quaternion.hpp.

◆ vector()

template<typename PrimType_>
Vector4 kindr::Quaternion< PrimType_ >::vector ( ) const
inline

Definition at line 216 of file Quaternion.hpp.

◆ w() [1/2]

template<typename PrimType_>
Scalar kindr::Quaternion< PrimType_ >::w ( ) const
inline

Definition at line 176 of file Quaternion.hpp.

◆ w() [2/2]

template<typename PrimType_>
Scalar& kindr::Quaternion< PrimType_ >::w ( )
inline

Definition at line 192 of file Quaternion.hpp.

◆ x() [1/2]

template<typename PrimType_>
Scalar kindr::Quaternion< PrimType_ >::x ( ) const
inline

Definition at line 180 of file Quaternion.hpp.

◆ x() [2/2]

template<typename PrimType_>
Scalar& kindr::Quaternion< PrimType_ >::x ( )
inline

Definition at line 196 of file Quaternion.hpp.

◆ y() [1/2]

template<typename PrimType_>
Scalar kindr::Quaternion< PrimType_ >::y ( ) const
inline

Definition at line 184 of file Quaternion.hpp.

◆ y() [2/2]

template<typename PrimType_>
Scalar& kindr::Quaternion< PrimType_ >::y ( )
inline

Definition at line 200 of file Quaternion.hpp.

◆ z() [1/2]

template<typename PrimType_>
Scalar kindr::Quaternion< PrimType_ >::z ( ) const
inline

Definition at line 188 of file Quaternion.hpp.

◆ z() [2/2]

template<typename PrimType_>
Scalar& kindr::Quaternion< PrimType_ >::z ( )
inline

Definition at line 204 of file Quaternion.hpp.


The documentation for this class was generated from the following file: