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

Implementation of an angle axis rotation based on Eigen::AngleAxis. More...

#include <AngleAxis.hpp>

Inheritance diagram for kindr::AngleAxis< 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 Eigen::Matrix< PrimType_, 3, 1 > Vector3
 The axis type is a 3D vector. More...
 
typedef Eigen::Matrix< PrimType_, 4, 1 > Vector4
 All four parameters stored in a vector [angle; axis]. More...
 

Public Member Functions

 AngleAxis ()
 Default constructor using identity rotation. More...
 
 AngleAxis (Scalar angle, Scalar v1, Scalar v2, Scalar v3)
 Constructor using four scalars. In debug mode, an assertion is thrown if the rotation vector has not unit length. More...
 
 AngleAxis (Scalar angle, const Vector3 &axis)
 Constructor using angle and axis. In debug mode, an assertion is thrown if the rotation vector has not unit length. More...
 
 AngleAxis (const Vector4 &vector)
 Constructor using a 4x1matrix. In debug mode, an assertion is thrown if the rotation vector has not unit length. More...
 
 AngleAxis (const Base &other)
 Constructor using Eigen::AngleAxis. In debug mode, an assertion is thrown if the rotation vector has not unit length. More...
 
template<typename OtherDerived_ >
 AngleAxis (const RotationBase< OtherDerived_ > &other)
 Constructor using another rotation. More...
 
template<typename OtherDerived_ >
AngleAxisoperator= (const RotationBase< OtherDerived_ > &other)
 Assignment operator using another rotation. More...
 
template<typename OtherDerived_ >
AngleAxisoperator() (const RotationBase< OtherDerived_ > &other)
 Parenthesis operator to convert from another rotation. More...
 
AngleAxis inverted () const
 Returns the inverse of the rotation. More...
 
AngleAxisinvert ()
 Inverts the rotation. More...
 
ImplementationtoImplementation ()
 Cast to the implementation type. More...
 
const ImplementationtoImplementation () const
 Cast to the implementation type. More...
 
Scalar angle () const
 Returns the rotation angle. More...
 
void setAngle (Scalar angle)
 Sets the rotation angle. More...
 
const Vector3axis () const
 Returns the rotation axis. More...
 
void setAxis (const Vector3 &axis)
 Sets the rotation axis. More...
 
void setAxis (Scalar v1, Scalar v2, Scalar v3)
 Sets the rotation axis. More...
 
void setVector (const Vector4 &vector)
 Sets angle-axis from a 4x1-matrix. More...
 
Vector4 vector () const
 
AngleAxissetIdentity ()
 Sets the rotation to identity. More...
 
AngleAxis getUnique () const
 Returns a unique angle axis rotation with angle in [0,pi]. This function is used to compare different rotations. More...
 
AngleAxissetUnique ()
 Modifies the angle axis rotation such that the lies angle in [0,pi). More...
 
- Public Member Functions inherited from kindr::RotationBase< AngleAxis< PrimType_ > >
 RotationBase ()=default
 Standard constructor. Creates an empty generic rotation object. More...
 
 RotationBase (const AngleAxis< 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 AngleAxis< PrimType_ > & ()
 Gets the derived rotation. (only for advanced users) More...
 
 operator const AngleAxis< PrimType_ > & () const
 Gets the derived rotation. (only for advanced users) More...
 
AngleAxis< PrimType_ > & derived ()
 Gets the derived rotation. (only for advanced users) More...
 
const AngleAxis< PrimType_ > & derived () const
 Gets the derived rotation. (only for advanced users) More...
 
AngleAxis< PrimType_ > & setIdentity ()
 Sets the rotation to the identity rotation. More...
 
AngleAxis< PrimType_ > & setRandom ()
 Sets the rotation to a random one. More...
 
AngleAxis< PrimType_ > getRandom () const
 Returns a random rotation. More...
 
AngleAxis< PrimType_ > getUnique () const
 Returns the rotation in a unique form This function is used to compare different rotations. More...
 
AngleAxis< PrimType_ > & setUnique ()
 Modifies the rotation such that it is in its unique form. More...
 
AngleAxis< 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< AngleAxis< 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< AngleAxis< PrimType_ > >::Scalar tol) const
 Compares two rotations with a tolerance. More...
 
internal::get_matrix3X< AngleAxis< PrimType_ > >::template Matrix3X< Cols > rotate (const typename internal::get_matrix3X< AngleAxis< 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< AngleAxis< PrimType_ > >::template Matrix3X< Cols > inverseRotate (const typename internal::get_matrix3X< AngleAxis< 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...
 
AngleAxis< PrimType_ > exponentialMap (const typename internal::get_matrix3X< AngleAxis< PrimType_ > >::template Matrix3X< 1 > &vector)
 Sets the rotation using an exponential map. More...
 
internal::get_matrix3X< AngleAxis< PrimType_ > >::template Matrix3X< 1 > logarithmicMap () const
 Gets the logarithmic map from the rotation. More...
 
internal::get_matrix3X< AngleAxis< PrimType_ > >::template Matrix3X< 1 > boxMinus (const RotationBase< OtherDerived_ > &other) const
 Applies the box minus operation. More...
 
AngleAxis< PrimType_ > boxPlus (const typename internal::get_matrix3X< AngleAxis< PrimType_ > >::template Matrix3X< 1 > &vector) const
 Applies the box plus operation. More...
 
AngleAxis< 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::AngleAxis< PrimType_ > Base
 The base type. More...
 

Private Attributes

Base angleAxis_
 

Friends

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

Detailed Description

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

Implementation of an angle axis rotation based on Eigen::AngleAxis.

The following two typedefs are provided for convenience:

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

Definition at line 54 of file AngleAxis.hpp.

Member Typedef Documentation

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

The base type.

Definition at line 58 of file AngleAxis.hpp.

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

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

Definition at line 68 of file AngleAxis.hpp.

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

The primitive type. Float/Double.

Definition at line 72 of file AngleAxis.hpp.

template<typename PrimType_>
typedef Eigen::Matrix<PrimType_, 3, 1> kindr::AngleAxis< PrimType_ >::Vector3

The axis type is a 3D vector.

Definition at line 75 of file AngleAxis.hpp.

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

All four parameters stored in a vector [angle; axis].

Definition at line 79 of file AngleAxis.hpp.

Constructor & Destructor Documentation

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

Default constructor using identity rotation.

Definition at line 83 of file AngleAxis.hpp.

template<typename PrimType_>
kindr::AngleAxis< PrimType_ >::AngleAxis ( Scalar  angle,
Scalar  v1,
Scalar  v2,
Scalar  v3 
)
inline

Constructor using four scalars. In debug mode, an assertion is thrown if the rotation vector has not unit length.

Parameters
anglerotation angle
v1first entry of the rotation axis vector
v2second entry of the rotation axis vector
v3third entry of the rotation axis vector

Definition at line 94 of file AngleAxis.hpp.

template<typename PrimType_>
kindr::AngleAxis< PrimType_ >::AngleAxis ( Scalar  angle,
const Vector3 axis 
)
inline

Constructor using angle and axis. In debug mode, an assertion is thrown if the rotation vector has not unit length.

Parameters
anglerotation angle
axisrotation vector with unit length (Eigen vector)

Definition at line 104 of file AngleAxis.hpp.

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

Constructor using a 4x1matrix. In debug mode, an assertion is thrown if the rotation vector has not unit length.

Parameters
vector4x1-matrix with [angle; axis]

Definition at line 114 of file AngleAxis.hpp.

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

Constructor using Eigen::AngleAxis. In debug mode, an assertion is thrown if the rotation vector has not unit length.

Parameters
otherEigen::AngleAxis<PrimType_>

Definition at line 123 of file AngleAxis.hpp.

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

Constructor using another rotation.

Parameters
otherother rotation

Definition at line 132 of file AngleAxis.hpp.

Member Function Documentation

template<typename PrimType_>
Scalar kindr::AngleAxis< PrimType_ >::angle ( ) const
inline

Returns the rotation angle.

Returns
rotation angle (scalar)

Definition at line 191 of file AngleAxis.hpp.

template<typename PrimType_>
const Vector3& kindr::AngleAxis< PrimType_ >::axis ( ) const
inline

Returns the rotation axis.

Returns
rotation axis (vector)

Definition at line 204 of file AngleAxis.hpp.

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

Returns a unique angle axis rotation with angle in [0,pi]. This function is used to compare different rotations.

Returns
copy of the angle axis rotation which is unique

Definition at line 252 of file AngleAxis.hpp.

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

Inverts the rotation.

Returns
reference

Definition at line 169 of file AngleAxis.hpp.

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

Returns the inverse of the rotation.

Returns
the inverse of the rotation

Definition at line 159 of file AngleAxis.hpp.

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

Parenthesis operator to convert from another rotation.

Parameters
otherother rotation
Returns
reference

Definition at line 151 of file AngleAxis.hpp.

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

Assignment operator using another rotation.

Parameters
otherother rotation
Returns
reference

Definition at line 141 of file AngleAxis.hpp.

template<typename PrimType_>
void kindr::AngleAxis< PrimType_ >::setAngle ( Scalar  angle)
inline

Sets the rotation angle.

Definition at line 197 of file AngleAxis.hpp.

template<typename PrimType_>
void kindr::AngleAxis< PrimType_ >::setAxis ( const Vector3 axis)
inline

Sets the rotation axis.

Definition at line 210 of file AngleAxis.hpp.

template<typename PrimType_>
void kindr::AngleAxis< PrimType_ >::setAxis ( Scalar  v1,
Scalar  v2,
Scalar  v3 
)
inline

Sets the rotation axis.

Definition at line 217 of file AngleAxis.hpp.

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

Sets the rotation to identity.

Returns
reference

Definition at line 242 of file AngleAxis.hpp.

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

Modifies the angle axis rotation such that the lies angle in [0,pi).

Returns
reference

Definition at line 297 of file AngleAxis.hpp.

template<typename PrimType_>
void kindr::AngleAxis< PrimType_ >::setVector ( const Vector4 vector)
inline

Sets angle-axis from a 4x1-matrix.

Definition at line 224 of file AngleAxis.hpp.

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

Cast to the implementation type.

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

Definition at line 177 of file AngleAxis.hpp.

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

Cast to the implementation type.

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

Definition at line 184 of file AngleAxis.hpp.

template<typename PrimType_>
Vector4 kindr::AngleAxis< PrimType_ >::vector ( ) const
inline
Returns
the angle and axis in a 4x1 vector [angle; axis].

Definition at line 231 of file AngleAxis.hpp.

Friends And Related Function Documentation

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

Used for printing the object with std::cout.

Returns
std::stream object

Definition at line 311 of file AngleAxis.hpp.

Member Data Documentation

template<typename PrimType_>
Base kindr::AngleAxis< PrimType_ >::angleAxis_
private

Data container

Definition at line 62 of file AngleAxis.hpp.


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