Loading...
Searching...
No Matches

#include </home/thodoris/src/ompl/demos/multicopter/CommonMath/Rotation.h>

Public Member Functions

 Rotation (double a, double b, double c, double d)
 Constructor given a unit quaternion.
 Rotation (Rotation const &in)
 Copy constructor.
Rotation Inverse (void) const
void Normalise (void)
 This makes sure the quaternion is a unit quaternion.
Rotation & operator= (const Rotation &other)
Rotation operator* (const Rotation &r1) const
 Rotation multiplication: r2*r1, corresponds to a rotation r1 followed by rotation r2.
Vec3 operator* (const Vec3 &vec) const
 Rotate a vector forward.
Vec3 ToRotationVector (void) const
Vec3 ToVectorPartOfQuaternion (void) const
 Returns the vector part of the quaternion representing this rotation.
void ToEulerYPR (double &y, double &p, double &r) const
 Returns the Euler angles yaw, pitch, and roll representing this rotation.
Vec3 ToEulerYPR (void) const
 Returns the Euler angles yaw, pitch, and roll representing this rotation.
void PrintRotationMatrix (void)
 For debugging.
double & operator[] (unsigned const i)
const double & operator[] (unsigned const i) const
void GetRotationMatrix (double R[9]) const

Static Public Member Functions

static Rotation Identity (void)
static Rotation FromRotationVector (const Vec3 rotVec)
static Rotation FromAxisAngle (const Vec3 &unitVector, const double &angle)
static Rotation FromEulerYPR (const double &y, const double &p, const double &r)
 Returns a Rotation object given Euler angles yaw, pitch, and roll.
static Rotation FromVectorPartOfQuaternion (const Vec3 in)
 Returns a Rotation object given the three elements of the vector part of a unit quaternion.

Detailed Description

A way of representing attitudes, based on the Euler-Rodriguez symmetric parameters (ERSP) a.k.a. "quaternion of rotation".

Note that you should call Normalise() every once in a while, so that you're rotations remain orthonormal.

BEWARE: Everyone defines rotations differently, take care when interpreting the internals, or using it. Construct some test cases and make sure the numbers make sense.

Definition at line 37 of file Rotation.h.

Constructor & Destructor Documentation

◆ Rotation() [1/3]

CommonMath::Rotation::Rotation ( void )
inline

Definition at line 43 of file Rotation.h.

◆ Rotation() [2/3]

CommonMath::Rotation::Rotation ( double a,
double b,
double c,
double d )
inline

Constructor given a unit quaternion.

Definition at line 48 of file Rotation.h.

◆ Rotation() [3/3]

CommonMath::Rotation::Rotation ( Rotation const & in)
inline

Copy constructor.

Definition at line 57 of file Rotation.h.

Member Function Documentation

◆ FromAxisAngle()

Rotation CommonMath::Rotation::FromAxisAngle ( const Vec3 & unitVector,
const double & angle )
inlinestatic

Returns a Rotation object given a unit vector and angle. The unit vector is the rotation axis and the angle is the angle of rotation in radians.

Definition at line 104 of file Rotation.h.

◆ FromEulerYPR()

Rotation CommonMath::Rotation::FromEulerYPR ( const double & y,
const double & p,
const double & r )
inlinestatic

Returns a Rotation object given Euler angles yaw, pitch, and roll.

Definition at line 111 of file Rotation.h.

◆ FromRotationVector()

Rotation CommonMath::Rotation::FromRotationVector ( const Vec3 rotVec)
inlinestatic

Returns a Rotation object given a vector, where the direction of the vector is the rotation axis and the magnitude of the vector is the angle of rotation in radians.

Definition at line 93 of file Rotation.h.

◆ FromVectorPartOfQuaternion()

Rotation CommonMath::Rotation::FromVectorPartOfQuaternion ( const Vec3 in)
inlinestatic

Returns a Rotation object given the three elements of the vector part of a unit quaternion.

Definition at line 122 of file Rotation.h.

◆ GetRotationMatrix()

void CommonMath::Rotation::GetRotationMatrix ( double R[9]) const
inline

Returns the rotation matrix corresponding to this rotation where Matrix = [[R[0], R[1], R[2]], [R[3], R[4], R[5]], [R[6], R[7], R[8]]]

Definition at line 235 of file Rotation.h.

◆ Identity()

Rotation CommonMath::Rotation::Identity ( void )
inlinestatic

Definition at line 65 of file Rotation.h.

◆ Inverse()

Rotation CommonMath::Rotation::Inverse ( void ) const
inline

Definition at line 70 of file Rotation.h.

◆ Normalise()

void CommonMath::Rotation::Normalise ( void )
inline

This makes sure the quaternion is a unit quaternion.

Definition at line 76 of file Rotation.h.

◆ operator*() [1/2]

Rotation CommonMath::Rotation::operator* ( const Rotation & r1) const
inline

Rotation multiplication: r2*r1, corresponds to a rotation r1 followed by rotation r2.

Definition at line 144 of file Rotation.h.

◆ operator*() [2/2]

Vec3 CommonMath::Rotation::operator* ( const Vec3 & vec) const
inline

Rotate a vector forward.

Definition at line 155 of file Rotation.h.

◆ operator=()

Rotation & CommonMath::Rotation::operator= ( const Rotation & other)
inline

Definition at line 131 of file Rotation.h.

◆ operator[]() [1/2]

double & CommonMath::Rotation::operator[] ( unsigned const i)
inline

Definition at line 220 of file Rotation.h.

◆ operator[]() [2/2]

const double & CommonMath::Rotation::operator[] ( unsigned const i) const
inline

Definition at line 224 of file Rotation.h.

◆ PrintRotationMatrix()

void CommonMath::Rotation::PrintRotationMatrix ( void )
inline

For debugging.

Definition at line 206 of file Rotation.h.

◆ ToEulerYPR() [1/2]

void CommonMath::Rotation::ToEulerYPR ( double & y,
double & p,
double & r ) const
inline

Returns the Euler angles yaw, pitch, and roll representing this rotation.

Definition at line 188 of file Rotation.h.

◆ ToEulerYPR() [2/2]

Vec3 CommonMath::Rotation::ToEulerYPR ( void ) const
inline

Returns the Euler angles yaw, pitch, and roll representing this rotation.

Definition at line 198 of file Rotation.h.

◆ ToRotationVector()

Vec3 CommonMath::Rotation::ToRotationVector ( void ) const
inline

Returns the rotation vector corresponding to this rotation, where the returned vector is the rotation axis and its magnitude is the rotation angle.

Definition at line 164 of file Rotation.h.

◆ ToVectorPartOfQuaternion()

Vec3 CommonMath::Rotation::ToVectorPartOfQuaternion ( void ) const
inline

Returns the vector part of the quaternion representing this rotation.

Definition at line 178 of file Rotation.h.


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