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

Implementation of Euler angles (Z-Y'-X'' / yaw-pitch-roll) rotation based on Eigen::Matrix<Scalar, 3, 1> More...

#include <EulerAnglesZyx.hpp>

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

Public Types

typedef Base Implementation
 The implementation type. The implementation type is always an Eigen object. More...
 
typedef PrimType_ Scalar
 The primitive type. Float/Double. More...
 
typedef Base Vector
 Euler angles as 3x1-matrix. More...
 

Public Member Functions

 EulerAnglesZyx ()
 Default constructor using identity rotation. More...
 
 EulerAnglesZyx (Scalar yaw, Scalar pitch, Scalar roll)
 Constructor using three scalars. More...
 
 EulerAnglesZyx (const Base &other)
 Constructor using Eigen::Matrix. More...
 
template<typename OtherDerived_ >
 EulerAnglesZyx (const RotationBase< OtherDerived_ > &other)
 Constructor using another rotation. More...
 
template<typename OtherDerived_ >
EulerAnglesZyxoperator= (const RotationBase< OtherDerived_ > &other)
 Assignment operator using another rotation. More...
 
template<typename OtherDerived_ >
EulerAnglesZyxoperator() (const RotationBase< OtherDerived_ > &other)
 Parenthesis operator to convert from another rotation. More...
 
EulerAnglesZyx inverted () const
 Returns the inverse of the rotation. More...
 
EulerAnglesZyxinvert ()
 Inverts the rotation. More...
 
const Vector vector () const
 Returns the Euler angles in a vector. More...
 
BasetoImplementation ()
 Cast to the implementation type. More...
 
const BasetoImplementation () const
 Cast to the implementation type. More...
 
Scalar yaw () const
 Gets yaw (Z) angle. More...
 
Scalar pitch () const
 Gets pitch (Y') angle. More...
 
Scalar roll () const
 Gets roll (X'') angle. More...
 
void setYaw (Scalar yaw)
 Sets yaw (Z) angle. More...
 
void setPitch (Scalar pitch)
 Sets pitch (Y') angle. More...
 
void setRoll (Scalar roll)
 Sets roll (X'') angle. More...
 
Scalar z () const
 Reading access to yaw (Z) angle. More...
 
Scalar y () const
 Reading access to pitch (Y') angle. More...
 
Scalar x () const
 Reading access to roll (X'') angle. More...
 
void setZ (Scalar z)
 Writing access to yaw (Z) angle. More...
 
void setY (Scalar y)
 Writing access to pitch (Y') angle. More...
 
void setX (Scalar x)
 Writing access to roll (X'') angle. More...
 
EulerAnglesZyxsetIdentity ()
 Sets the rotation to identity. More...
 
EulerAnglesZyx getUnique () const
 Returns a unique Euler angles rotation with angles in [-pi,pi),[-pi/2,pi/2),[-pi,pi). This function is used to compare different rotations. More...
 
EulerAnglesZyxsetUnique ()
 Modifies the Euler angles rotation such that the angles lie in [-pi,pi),[-pi/2,pi/2),[-pi,pi). More...
 
Eigen::Matrix< PrimType_, 3, 3 > getMappingFromDiffToLocalAngularVelocity () const
 
Eigen::Matrix< PrimType_, 3, 3 > getMappingFromLocalAngularVelocityToDiff () const
 
- Public Member Functions inherited from kindr::RotationBase< EulerAnglesZyx< PrimType_ > >
 RotationBase ()=default
 Standard constructor. Creates an empty generic rotation object. More...
 
 RotationBase (const EulerAnglesZyx< PrimType_ > &)=delete
 Constructor from derived rotation. This constructor has been deleted because the abstract class does not contain any data. More...
 
RotationBase inverted () const
 Returns the inverse of the rotation. More...
 
RotationBaseinvert ()
 Inverts the rotation. More...
 
 operator EulerAnglesZyx< PrimType_ > & ()
 Gets the derived rotation. (only for advanced users) More...
 
 operator const EulerAnglesZyx< PrimType_ > & () const
 Gets the derived rotation. (only for advanced users) More...
 
EulerAnglesZyx< PrimType_ > & derived ()
 Gets the derived rotation. (only for advanced users) More...
 
const EulerAnglesZyx< PrimType_ > & derived () const
 Gets the derived rotation. (only for advanced users) More...
 
EulerAnglesZyx< PrimType_ > & setIdentity ()
 Sets the rotation to the identity rotation. More...
 
EulerAnglesZyx< PrimType_ > & setRandom ()
 Sets the rotation to a random one. More...
 
EulerAnglesZyx< PrimType_ > getRandom () const
 Returns a random rotation. More...
 
EulerAnglesZyx< PrimType_ > getUnique () const
 Returns the rotation in a unique form This function is used to compare different rotations. More...
 
EulerAnglesZyx< PrimType_ > & setUnique ()
 Modifies the rotation such that it is in its unique form. More...
 
EulerAnglesZyx< PrimType_ > operator* (const RotationBase< OtherDerived_ > &other) const
 Concatenates two rotations. More...
 
bool operator== (const RotationBase< OtherDerived_ > &other) const
 Compares two rotations. More...
 
internal::get_scalar< EulerAnglesZyx< PrimType_ > >::Scalar getDisparityAngle (const RotationBase< OtherDerived_ > &other) const
 Gets the disparity angle between two rotations for comparison. More...
 
bool isNear (const RotationBase< OtherDerived_ > &other, typename internal::get_scalar< EulerAnglesZyx< PrimType_ > >::Scalar tol) const
 Compares two rotations with a tolerance. More...
 
internal::get_matrix3X< EulerAnglesZyx< PrimType_ > >::template Matrix3X< Cols > rotate (const typename internal::get_matrix3X< EulerAnglesZyx< PrimType_ > >::template Matrix3X< Cols > &matrix) const
 Rotates a vector or a matrix column-wise. More...
 
Vector_ rotate (const Vector_ &vector) const
 Rotates a vector. More...
 
internal::get_matrix3X< EulerAnglesZyx< PrimType_ > >::template Matrix3X< Cols > inverseRotate (const typename internal::get_matrix3X< EulerAnglesZyx< PrimType_ > >::template Matrix3X< Cols > &matrix) const
 Rotates a vector or matrix in reverse. More...
 
Vector_ inverseRotate (const Vector_ &vector) const
 Rotates a vector in reverse. More...
 
EulerAnglesZyx< PrimType_ > exponentialMap (const typename internal::get_matrix3X< EulerAnglesZyx< PrimType_ > >::template Matrix3X< 1 > &vector)
 Sets the rotation using an exponential map. More...
 
internal::get_matrix3X< EulerAnglesZyx< PrimType_ > >::template Matrix3X< 1 > logarithmicMap () const
 Gets the logarithmic map from the rotation. More...
 
internal::get_matrix3X< EulerAnglesZyx< PrimType_ > >::template Matrix3X< 1 > boxMinus (const RotationBase< OtherDerived_ > &other) const
 Applies the box minus operation. More...
 
EulerAnglesZyx< PrimType_ > boxPlus (const typename internal::get_matrix3X< EulerAnglesZyx< PrimType_ > >::template Matrix3X< 1 > &vector) const
 Applies the box plus operation. More...
 
EulerAnglesZyx< PrimType_ > & setFromVectors (const Vector_ &B_v, const Vector_ &I_v)
 Sets the rotation C_IB from two vectors such that I_v = C_IB*B_v i.e. I_v = this->rotate(B_v). More...
 
void fix ()
 Fixes the rotation to get rid of numerical errors (e.g. normalize quaternion). More...
 

Private Types

typedef Eigen::Matrix< PrimType_, 3, 1 > Base
 The base type. More...
 

Private Attributes

Base zyx_
 vector of Euler angles [yaw; pitch; roll] More...
 

Friends

std::ostream & operator<< (std::ostream &out, const EulerAnglesZyx &zyx)
 Used for printing the object with std::cout. More...
 

Detailed Description

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

Implementation of Euler angles (Z-Y'-X'' / yaw-pitch-roll) rotation based on Eigen::Matrix<Scalar, 3, 1>

The following typedefs are provided for convenience:

  • EulerAnglesZyxD for active rotation and double primitive type
  • EulerAnglesZyxF for active rotation and float primitive type
  • EulerAnglesYprD = EulerAnglesZyxD
  • EulerAnglesYprF = EulerAnglesZyxF
Template Parameters
PrimType_the primitive type of the data (double or float)

Definition at line 54 of file EulerAnglesZyx.hpp.

Member Typedef Documentation

template<typename PrimType_>
typedef Eigen::Matrix<PrimType_, 3, 1> kindr::EulerAnglesZyx< PrimType_ >::Base
private

The base type.

Definition at line 58 of file EulerAnglesZyx.hpp.

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

The implementation type. The implementation type is always an Eigen object.

Definition at line 67 of file EulerAnglesZyx.hpp.

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

The primitive type. Float/Double.

Definition at line 71 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
typedef Base kindr::EulerAnglesZyx< PrimType_ >::Vector

Euler angles as 3x1-matrix.

Definition at line 75 of file EulerAnglesZyx.hpp.

Constructor & Destructor Documentation

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

Default constructor using identity rotation.

Definition at line 79 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
kindr::EulerAnglesZyx< PrimType_ >::EulerAnglesZyx ( Scalar  yaw,
Scalar  pitch,
Scalar  roll 
)
inline

Constructor using three scalars.

Parameters
yawfirst rotation angle around Z axis
pitchsecond rotation angle around Y' axis
rollthird rotation angle around X'' axis

Definition at line 88 of file EulerAnglesZyx.hpp.

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

Constructor using Eigen::Matrix.

Parameters
otherEigen::Matrix<PrimType_,3,1> [roll; pitch; yaw]

Definition at line 95 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
template<typename OtherDerived_ >
kindr::EulerAnglesZyx< PrimType_ >::EulerAnglesZyx ( const RotationBase< OtherDerived_ > &  other)
inlineexplicit

Constructor using another rotation.

Parameters
otherother rotation

Definition at line 103 of file EulerAnglesZyx.hpp.

Member Function Documentation

template<typename PrimType_>
Eigen::Matrix<PrimType_, 3, 3> kindr::EulerAnglesZyx< PrimType_ >::getMappingFromDiffToLocalAngularVelocity ( ) const
inline

Definition at line 393 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
Eigen::Matrix<PrimType_, 3, 3> kindr::EulerAnglesZyx< PrimType_ >::getMappingFromLocalAngularVelocityToDiff ( ) const
inline

Definition at line 412 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
EulerAnglesZyx kindr::EulerAnglesZyx< PrimType_ >::getUnique ( ) const
inline

Returns a unique Euler angles rotation with angles in [-pi,pi),[-pi/2,pi/2),[-pi,pi). This function is used to compare different rotations.

Returns
copy of the Euler angles rotation which is unique

Returns a unique Euler angles rotation with angles in [-pi,pi),[-pi/2,pi/2),[-pi,pi). This function is used to compare different rotations.

Returns
copy of the Euler angles rotation which is unique

Definition at line 325 of file EulerAnglesZyx.hpp.

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

Inverts the rotation.

Returns
reference

Definition at line 138 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
EulerAnglesZyx kindr::EulerAnglesZyx< PrimType_ >::inverted ( ) const
inline

Returns the inverse of the rotation.

Returns
the inverse of the rotation

Definition at line 131 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
template<typename OtherDerived_ >
EulerAnglesZyx& kindr::EulerAnglesZyx< PrimType_ >::operator() ( const RotationBase< OtherDerived_ > &  other)
inline

Parenthesis operator to convert from another rotation.

Parameters
otherother rotation
Returns
reference

Definition at line 123 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
template<typename OtherDerived_ >
EulerAnglesZyx& kindr::EulerAnglesZyx< PrimType_ >::operator= ( const RotationBase< OtherDerived_ > &  other)
inline

Assignment operator using another rotation.

Parameters
otherother rotation
Returns
referece

Definition at line 112 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
Scalar kindr::EulerAnglesZyx< PrimType_ >::pitch ( ) const
inline

Gets pitch (Y') angle.

Returns
pitch angle (scalar)

Definition at line 174 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
Scalar kindr::EulerAnglesZyx< PrimType_ >::roll ( ) const
inline

Gets roll (X'') angle.

Returns
roll angle (scalar)

Definition at line 181 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
EulerAnglesZyx& kindr::EulerAnglesZyx< PrimType_ >::setIdentity ( )
inline

Sets the rotation to identity.

Returns
reference

Definition at line 248 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
void kindr::EulerAnglesZyx< PrimType_ >::setPitch ( Scalar  pitch)
inline

Sets pitch (Y') angle.

Definition at line 193 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
void kindr::EulerAnglesZyx< PrimType_ >::setRoll ( Scalar  roll)
inline

Sets roll (X'') angle.

Definition at line 199 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
EulerAnglesZyx& kindr::EulerAnglesZyx< PrimType_ >::setUnique ( )
inline

Modifies the Euler angles rotation such that the angles lie in [-pi,pi),[-pi/2,pi/2),[-pi,pi).

Returns
reference

Definition at line 387 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
void kindr::EulerAnglesZyx< PrimType_ >::setX ( Scalar  x)
inline

Writing access to roll (X'') angle.

Returns
roll angle (scalar) with writing access

Definition at line 241 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
void kindr::EulerAnglesZyx< PrimType_ >::setY ( Scalar  y)
inline

Writing access to pitch (Y') angle.

Returns
pitch angle (scalar) with writing access

Definition at line 234 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
void kindr::EulerAnglesZyx< PrimType_ >::setYaw ( Scalar  yaw)
inline

Sets yaw (Z) angle.

Definition at line 187 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
void kindr::EulerAnglesZyx< PrimType_ >::setZ ( Scalar  z)
inline

Writing access to yaw (Z) angle.

Returns
yaw angle (scalar) with writing access

Definition at line 227 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
Base& kindr::EulerAnglesZyx< PrimType_ >::toImplementation ( )
inline

Cast to the implementation type.

Returns
the implementation for direct manipulation (recommended only for advanced users)

Definition at line 153 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
const Base& kindr::EulerAnglesZyx< PrimType_ >::toImplementation ( ) const
inline

Cast to the implementation type.

Returns
the implementation for direct manipulation (recommended only for advanced users)

Definition at line 160 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
const Vector kindr::EulerAnglesZyx< PrimType_ >::vector ( ) const
inline

Returns the Euler angles in a vector.

Returns
vector Eigen::Matrix<Scalar,3, 1>

Definition at line 146 of file EulerAnglesZyx.hpp.

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

Reading access to roll (X'') angle.

Returns
roll angle (scalar) with reading access

Definition at line 220 of file EulerAnglesZyx.hpp.

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

Reading access to pitch (Y') angle.

Returns
pitch angle (scalar) with reading access

Definition at line 213 of file EulerAnglesZyx.hpp.

template<typename PrimType_>
Scalar kindr::EulerAnglesZyx< PrimType_ >::yaw ( ) const
inline

Gets yaw (Z) angle.

Returns
yaw angle (scalar)

Definition at line 167 of file EulerAnglesZyx.hpp.

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

Reading access to yaw (Z) angle.

Returns
yaw angle (scalar) with reading access

Definition at line 206 of file EulerAnglesZyx.hpp.

Friends And Related Function Documentation

template<typename PrimType_>
std::ostream& operator<< ( std::ostream &  out,
const EulerAnglesZyx< PrimType_ > &  zyx 
)
friend

Used for printing the object with std::cout.

Returns
std::stream object

Definition at line 450 of file EulerAnglesZyx.hpp.

Member Data Documentation

template<typename PrimType_>
Base kindr::EulerAnglesZyx< PrimType_ >::zyx_
private

vector of Euler angles [yaw; pitch; roll]

Definition at line 62 of file EulerAnglesZyx.hpp.


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