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

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

#include <EulerAnglesXyz.hpp>

Inheritance diagram for kindr::EulerAnglesXyz< 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
 Rotation Vector as 3x1-matrix. More...
 

Public Member Functions

 EulerAnglesXyz ()
 Default constructor using identity rotation. More...
 
 EulerAnglesXyz (Scalar roll, Scalar pitch, Scalar yaw)
 Constructor using three scalars. More...
 
 EulerAnglesXyz (const Base &other)
 Constructor using Eigen::Matrix. More...
 
template<typename OtherDerived_ >
 EulerAnglesXyz (const RotationBase< OtherDerived_ > &other)
 Constructor using another rotation. More...
 
template<typename OtherDerived_ >
EulerAnglesXyzoperator= (const RotationBase< OtherDerived_ > &other)
 Assignment operator using another rotation. More...
 
template<typename OtherDerived_ >
EulerAnglesXyzoperator() (const RotationBase< OtherDerived_ > &other)
 Parenthesis operator to convert from another rotation. More...
 
EulerAnglesXyz inverted () const
 Returns the inverse of the rotation. More...
 
EulerAnglesXyzinvert ()
 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 roll () const
 Returns roll (X) angle. More...
 
Scalar pitch () const
 Returns pitch (Y') angle. More...
 
Scalar yaw () const
 Returns yaw (Z'') angle. More...
 
void setRoll (Scalar roll)
 Sets roll (X) angle. More...
 
void setPitch (Scalar pitch)
 Sets pitch (Y') angle. More...
 
void setYaw (Scalar yaw)
 Sets yaw (Z'') angle. More...
 
Scalar x () const
 Gets roll (X) angle. More...
 
Scalar y () const
 Gets pitch (Y') angle. More...
 
Scalar z () const
 Gets yaw (Z'') angle. More...
 
void setX (Scalar x)
 Sets roll (X) angle. More...
 
void setY (Scalar y)
 Sets pitch (Y') angle. More...
 
void setZ (Scalar z)
 Sets yaw (Z'') angle. More...
 
EulerAnglesXyzsetIdentity ()
 Sets the rotation to identity. More...
 
EulerAnglesXyz 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...
 
EulerAnglesXyzsetUnique ()
 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
 
Eigen::Matrix< PrimType_, 3, 3 > getMappingFromGlobalAngularVelocityToDiff () const
 
Eigen::Matrix< PrimType_, 3, 3 > getMappingFromDiffToGlobalAngularVelocity () const
 
- Public Member Functions inherited from kindr::RotationBase< EulerAnglesXyz< PrimType_ > >
 RotationBase ()=default
 Standard constructor. Creates an empty generic rotation object. More...
 
 RotationBase (const EulerAnglesXyz< 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 EulerAnglesXyz< PrimType_ > & ()
 Gets the derived rotation. (only for advanced users) More...
 
 operator const EulerAnglesXyz< PrimType_ > & () const
 Gets the derived rotation. (only for advanced users) More...
 
EulerAnglesXyz< PrimType_ > & derived ()
 Gets the derived rotation. (only for advanced users) More...
 
const EulerAnglesXyz< PrimType_ > & derived () const
 Gets the derived rotation. (only for advanced users) More...
 
EulerAnglesXyz< PrimType_ > & setIdentity ()
 Sets the rotation to the identity rotation. More...
 
EulerAnglesXyz< PrimType_ > & setRandom ()
 Sets the rotation to a random one. More...
 
EulerAnglesXyz< PrimType_ > getRandom () const
 Returns a random rotation. More...
 
EulerAnglesXyz< PrimType_ > getUnique () const
 Returns the rotation in a unique form This function is used to compare different rotations. More...
 
EulerAnglesXyz< PrimType_ > & setUnique ()
 Modifies the rotation such that it is in its unique form. More...
 
EulerAnglesXyz< 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< EulerAnglesXyz< 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< EulerAnglesXyz< PrimType_ > >::Scalar tol) const
 Compares two rotations with a tolerance. More...
 
internal::get_matrix3X< EulerAnglesXyz< PrimType_ > >::template Matrix3X< Cols > rotate (const typename internal::get_matrix3X< EulerAnglesXyz< 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< EulerAnglesXyz< PrimType_ > >::template Matrix3X< Cols > inverseRotate (const typename internal::get_matrix3X< EulerAnglesXyz< 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...
 
EulerAnglesXyz< PrimType_ > exponentialMap (const typename internal::get_matrix3X< EulerAnglesXyz< PrimType_ > >::template Matrix3X< 1 > &vector)
 Sets the rotation using an exponential map. More...
 
internal::get_matrix3X< EulerAnglesXyz< PrimType_ > >::template Matrix3X< 1 > logarithmicMap () const
 Gets the logarithmic map from the rotation. More...
 
internal::get_matrix3X< EulerAnglesXyz< PrimType_ > >::template Matrix3X< 1 > boxMinus (const RotationBase< OtherDerived_ > &other) const
 Applies the box minus operation. More...
 
EulerAnglesXyz< PrimType_ > boxPlus (const typename internal::get_matrix3X< EulerAnglesXyz< PrimType_ > >::template Matrix3X< 1 > &vector) const
 Applies the box plus operation. More...
 
EulerAnglesXyz< 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 xyz_
 vector of Euler angles [roll; pitch; yaw] More...
 

Friends

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

Detailed Description

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

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

The following typedefs are provided for convenience:

Template Parameters
PrimType_the primitive type of the data (double or float)

Definition at line 56 of file EulerAnglesXyz.hpp.

Member Typedef Documentation

◆ Base

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

The base type.

Definition at line 60 of file EulerAnglesXyz.hpp.

◆ Implementation

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

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

Definition at line 70 of file EulerAnglesXyz.hpp.

◆ Scalar

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

The primitive type. Float/Double.

Definition at line 74 of file EulerAnglesXyz.hpp.

◆ Vector

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

Rotation Vector as 3x1-matrix.

Definition at line 78 of file EulerAnglesXyz.hpp.

Constructor & Destructor Documentation

◆ EulerAnglesXyz() [1/4]

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

Default constructor using identity rotation.

Definition at line 82 of file EulerAnglesXyz.hpp.

◆ EulerAnglesXyz() [2/4]

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

Constructor using three scalars.

Parameters
rollfirst rotation angle around X axis
pitchsecond rotation angle around Y' axis
yawthird rotation angle around Z'' axis

Definition at line 91 of file EulerAnglesXyz.hpp.

◆ EulerAnglesXyz() [3/4]

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

Constructor using Eigen::Matrix.

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

Definition at line 98 of file EulerAnglesXyz.hpp.

◆ EulerAnglesXyz() [4/4]

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

Constructor using another rotation.

Parameters
otherother rotation

Definition at line 106 of file EulerAnglesXyz.hpp.

Member Function Documentation

◆ getMappingFromDiffToGlobalAngularVelocity()

template<typename PrimType_>
Eigen::Matrix<PrimType_, 3, 3> kindr::EulerAnglesXyz< PrimType_ >::getMappingFromDiffToGlobalAngularVelocity ( ) const
inline

Definition at line 393 of file EulerAnglesXyz.hpp.

◆ getMappingFromDiffToLocalAngularVelocity()

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

Definition at line 323 of file EulerAnglesXyz.hpp.

◆ getMappingFromGlobalAngularVelocityToDiff()

template<typename PrimType_>
Eigen::Matrix<PrimType_, 3, 3> kindr::EulerAnglesXyz< PrimType_ >::getMappingFromGlobalAngularVelocityToDiff ( ) const
inline

Definition at line 369 of file EulerAnglesXyz.hpp.

◆ getMappingFromLocalAngularVelocityToDiff()

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

Definition at line 344 of file EulerAnglesXyz.hpp.

◆ getUnique()

template<typename PrimType_>
EulerAnglesXyz kindr::EulerAnglesXyz< 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

Definition at line 256 of file EulerAnglesXyz.hpp.

◆ invert()

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

Inverts the rotation.

Returns
reference

Definition at line 140 of file EulerAnglesXyz.hpp.

◆ inverted()

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

Returns the inverse of the rotation.

Returns
the inverse of the rotation

Definition at line 133 of file EulerAnglesXyz.hpp.

◆ operator()()

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

Parenthesis operator to convert from another rotation.

Parameters
otherother rotation
Returns
reference

Definition at line 125 of file EulerAnglesXyz.hpp.

◆ operator=()

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

Assignment operator using another rotation.

Parameters
otherother rotation
Returns
referece

Definition at line 115 of file EulerAnglesXyz.hpp.

◆ pitch()

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

Returns pitch (Y') angle.

Returns
pitch angle (scalar)

Definition at line 176 of file EulerAnglesXyz.hpp.

◆ roll()

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

Returns roll (X) angle.

Returns
roll angle (scalar)

Definition at line 169 of file EulerAnglesXyz.hpp.

◆ setIdentity()

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

Sets the rotation to identity.

Returns
reference

Definition at line 247 of file EulerAnglesXyz.hpp.

◆ setPitch()

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

Sets pitch (Y') angle.

Definition at line 195 of file EulerAnglesXyz.hpp.

◆ setRoll()

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

Sets roll (X) angle.

Definition at line 189 of file EulerAnglesXyz.hpp.

◆ setUnique()

template<typename PrimType_>
EulerAnglesXyz& kindr::EulerAnglesXyz< 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 318 of file EulerAnglesXyz.hpp.

◆ setX()

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

Sets roll (X) angle.

Definition at line 228 of file EulerAnglesXyz.hpp.

◆ setY()

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

Sets pitch (Y') angle.

Definition at line 234 of file EulerAnglesXyz.hpp.

◆ setYaw()

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

Sets yaw (Z'') angle.

Definition at line 201 of file EulerAnglesXyz.hpp.

◆ setZ()

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

Sets yaw (Z'') angle.

Definition at line 240 of file EulerAnglesXyz.hpp.

◆ toImplementation() [1/2]

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

Cast to the implementation type.

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

Definition at line 155 of file EulerAnglesXyz.hpp.

◆ toImplementation() [2/2]

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

Cast to the implementation type.

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

Definition at line 162 of file EulerAnglesXyz.hpp.

◆ vector()

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

Returns the Euler angles in a vector.

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

Definition at line 148 of file EulerAnglesXyz.hpp.

◆ x()

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

Gets roll (X) angle.

Returns
roll angle (scalar)

Definition at line 208 of file EulerAnglesXyz.hpp.

◆ y()

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

Gets pitch (Y') angle.

Returns
pitch angle (scalar)

Definition at line 215 of file EulerAnglesXyz.hpp.

◆ yaw()

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

Returns yaw (Z'') angle.

Returns
yaw angle (scalar)

Definition at line 183 of file EulerAnglesXyz.hpp.

◆ z()

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

Gets yaw (Z'') angle.

Returns
yaw angle (scalar)

Definition at line 222 of file EulerAnglesXyz.hpp.

Friends And Related Function Documentation

◆ operator<<

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

Used for printing the object with std::cout.

Returns
std::stream object

Definition at line 428 of file EulerAnglesXyz.hpp.

Member Data Documentation

◆ xyz_

template<typename PrimType_>
Base kindr::EulerAnglesXyz< PrimType_ >::xyz_
private

vector of Euler angles [roll; pitch; yaw]

Definition at line 64 of file EulerAnglesXyz.hpp.


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