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

Implementation of a rotation vector based on Eigen::Matrix<Scalar, 3, 1> More...

#include <Rotation.hpp>

Inheritance diagram for kindr::RotationVector< 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

 RotationVector ()
 Default constructor using identity rotation. More...
 
 RotationVector (Scalar x, Scalar y, Scalar z)
 Constructor using three scalars. More...
 
 RotationVector (const Base &other)
 Constructor using Eigen::Matrix<Scalar, 3, 1>. More...
 
template<typename OtherDerived_ >
 RotationVector (const RotationBase< OtherDerived_ > &other)
 Constructor using another rotation. More...
 
template<typename OtherDerived_ >
RotationVectoroperator= (const RotationBase< OtherDerived_ > &other)
 Assignment operator using another rotation. More...
 
template<typename OtherDerived_ >
RotationVectoroperator() (const RotationBase< OtherDerived_ > &other)
 Parenthesis operator to convert from another rotation. More...
 
RotationVector inverted () const
 Returns the inverse of the rotation. More...
 
RotationVectorinvert ()
 Inverts the rotation. More...
 
ImplementationtoImplementation ()
 Cast to the implementation type. More...
 
const ImplementationtoImplementation () const
 Cast to the implementation type. More...
 
RotationVectorsetIdentity ()
 Sets the rotation to identity. More...
 
const Vector vector () const
 Returns the rotation vector. More...
 
void setVector (Scalar x, Scalar y, Scalar z)
 Sets the rotation vector. More...
 
void setVector (const Implementation &vector)
 Sets the rotation vector. More...
 
Scalar x () const
 Returns the first entry of the rotation vector. More...
 
Scalar y () const
 Returns the second entry of the rotation vector. More...
 
Scalar z () const
 Returns the third entry of the rotation vector. More...
 
void setX (Scalar x)
 Sets the first entry of the rotation vector. More...
 
void setY (Scalar y)
 Sets the second entry of the rotation vector. More...
 
void setZ (Scalar z)
 Sets the third entry of the rotation vector. More...
 
RotationVector getUnique () const
 Returns a unique rotation vector with norm in [0,pi). This function is used to compare different rotations. More...
 
RotationVectorsetUnique ()
 
- Public Member Functions inherited from kindr::RotationBase< RotationVector< PrimType_ > >
 RotationBase ()=default
 Standard constructor. Creates an empty generic rotation object. More...
 
 RotationBase (const RotationVector< 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 RotationVector< PrimType_ > & ()
 Gets the derived rotation. (only for advanced users) More...
 
 operator const RotationVector< PrimType_ > & () const
 Gets the derived rotation. (only for advanced users) More...
 
RotationVector< PrimType_ > & derived ()
 Gets the derived rotation. (only for advanced users) More...
 
const RotationVector< PrimType_ > & derived () const
 Gets the derived rotation. (only for advanced users) More...
 
RotationVector< PrimType_ > & setIdentity ()
 Sets the rotation to the identity rotation. More...
 
RotationVector< PrimType_ > & setRandom ()
 Sets the rotation to a random one. More...
 
RotationVector< PrimType_ > getRandom () const
 Returns a random rotation. More...
 
RotationVector< PrimType_ > getUnique () const
 Returns the rotation in a unique form This function is used to compare different rotations. More...
 
RotationVector< PrimType_ > & setUnique ()
 Modifies the rotation such that it is in its unique form. More...
 
RotationVector< 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< RotationVector< 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< RotationVector< PrimType_ > >::Scalar tol) const
 Compares two rotations with a tolerance. More...
 
internal::get_matrix3X< RotationVector< PrimType_ > >::template Matrix3X< Cols > rotate (const typename internal::get_matrix3X< RotationVector< 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< RotationVector< PrimType_ > >::template Matrix3X< Cols > inverseRotate (const typename internal::get_matrix3X< RotationVector< 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...
 
RotationVector< PrimType_ > exponentialMap (const typename internal::get_matrix3X< RotationVector< PrimType_ > >::template Matrix3X< 1 > &vector)
 Sets the rotation using an exponential map. More...
 
internal::get_matrix3X< RotationVector< PrimType_ > >::template Matrix3X< 1 > logarithmicMap () const
 Gets the logarithmic map from the rotation. More...
 
internal::get_matrix3X< RotationVector< PrimType_ > >::template Matrix3X< 1 > boxMinus (const RotationBase< OtherDerived_ > &other) const
 Applies the box minus operation. More...
 
RotationVector< PrimType_ > boxPlus (const typename internal::get_matrix3X< RotationVector< PrimType_ > >::template Matrix3X< 1 > &vector) const
 Applies the box plus operation. More...
 
RotationVector< 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 vector_
 

Friends

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

Detailed Description

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

Implementation of a rotation vector based on Eigen::Matrix<Scalar, 3, 1>

The rotation vector is a non-normalized three-dimensional vector. The direction of the vector specifies the rotation axis and the length the angle. This representation uses therefore three parameters.

See also
AngleAxis for an angle-axis representation with four parameters.

The following four typedefs are provided for convenience:

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

Definition at line 43 of file Rotation.hpp.

Member Typedef Documentation

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

The base type.

Definition at line 62 of file RotationVector.hpp.

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

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

Definition at line 72 of file RotationVector.hpp.

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

The primitive type. Float/Double.

Definition at line 76 of file RotationVector.hpp.

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

Rotation Vector as 3x1-matrix.

Definition at line 80 of file RotationVector.hpp.

Constructor & Destructor Documentation

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

Default constructor using identity rotation.

Definition at line 84 of file RotationVector.hpp.

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

Constructor using three scalars.

Parameters
xfirst entry of the rotation vector
ysecond entry of the rotation vector
zthird entry of the rotation vector

Definition at line 94 of file RotationVector.hpp.

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

Constructor using Eigen::Matrix<Scalar, 3, 1>.

Parameters
otherEigen::Matrix<Scalar, 3, 1>

Definition at line 103 of file RotationVector.hpp.

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

Constructor using another rotation.

Parameters
otherother rotation

Definition at line 111 of file RotationVector.hpp.

Member Function Documentation

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

Returns a unique rotation vector with norm in [0,pi). This function is used to compare different rotations.

Returns
copy of the rotation vector which is unique

Definition at line 237 of file RotationVector.hpp.

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

Inverts the rotation.

Returns
reference

Definition at line 145 of file RotationVector.hpp.

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

Returns the inverse of the rotation.

Returns
the inverse of the rotation

Definition at line 138 of file RotationVector.hpp.

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

Parenthesis operator to convert from another rotation.

Parameters
otherother rotation
Returns
reference

Definition at line 130 of file RotationVector.hpp.

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

Assignment operator using another rotation.

Parameters
otherother rotation
Returns
reference

Definition at line 120 of file RotationVector.hpp.

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

Sets the rotation to identity.

Returns
reference

Definition at line 167 of file RotationVector.hpp.

template<typename PrimType_>
RotationVector& kindr::RotationVector< PrimType_ >::setUnique ( )
inline
Returns
reference

Definition at line 246 of file RotationVector.hpp.

template<typename PrimType_>
void kindr::RotationVector< PrimType_ >::setVector ( Scalar  x,
Scalar  y,
Scalar  z 
)
inline

Sets the rotation vector.

Parameters
xfirst entry
ysecond entry
zthird entry

Definition at line 184 of file RotationVector.hpp.

template<typename PrimType_>
void kindr::RotationVector< PrimType_ >::setVector ( const Implementation vector)
inline

Sets the rotation vector.

Definition at line 190 of file RotationVector.hpp.

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

Sets the first entry of the rotation vector.

Definition at line 217 of file RotationVector.hpp.

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

Sets the second entry of the rotation vector.

Definition at line 223 of file RotationVector.hpp.

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

Sets the third entry of the rotation vector.

Definition at line 229 of file RotationVector.hpp.

template<typename PrimType_>
Implementation& kindr::RotationVector< 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 RotationVector.hpp.

template<typename PrimType_>
const Implementation& kindr::RotationVector< 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 RotationVector.hpp.

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

Returns the rotation vector.

Returns
the rotation vector (scalar)

Definition at line 175 of file RotationVector.hpp.

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

Returns the first entry of the rotation vector.

Returns
first entry of the rotation vector (scalar)

Definition at line 197 of file RotationVector.hpp.

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

Returns the second entry of the rotation vector.

Returns
second entry of the rotation vector (scalar)

Definition at line 204 of file RotationVector.hpp.

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

Returns the third entry of the rotation vector.

Returns
third entry of the rotation vector (scalar)

Definition at line 211 of file RotationVector.hpp.

Friends And Related Function Documentation

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

Used for printing the object with std::cout.

Returns
std::stream object

Definition at line 260 of file RotationVector.hpp.

Member Data Documentation

template<typename PrimType_>
Base kindr::RotationVector< PrimType_ >::vector_
private

Data container

Definition at line 66 of file RotationVector.hpp.


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