|
Biorbd Release_1.13.0
|
#include <Quaternion.h>
Public Member Functions | |
| Quaternion (const Scalar &kStabilizer=1) | |
| Construct Quaternion. | |
| Quaternion (const Quaternion &other) | |
| Construct Quaternion from another quaternion. | |
| Quaternion (const RigidBodyDynamics::Math::Vector4d &vec4, const Scalar &kStabilizer=1) | |
| Construct Quaternion. | |
| Quaternion (const Scalar &w, const Scalar &x, const Scalar &y, const Scalar &z, const Scalar &kStabilizer=1) | |
| Construct Quaternion. | |
| Quaternion (const Scalar &w, const Vector3d &vec3, const Scalar &kStabilizer=1) | |
| Construct Quaternion. | |
| Scalar | w () const |
| Return the real part (w) the Quaternion. | |
| Scalar | x () const |
| Return the X-Component of the imaginary part of the Quaternion. | |
| Scalar | y () const |
| Return the Y-Component of the imaginary part of the Quaternion. | |
| Scalar | z () const |
| Return the Z-Component of the imaginary part of the Quaternion. | |
| void | setKStab (const Scalar &newKStab) |
| Set the k stabilizer. | |
| Scalar | kStab () const |
| Return the k stabilizer. | |
| Quaternion | operator* (const Quaternion &other) const |
| Quaternion multiplication. | |
| Quaternion | operator* (const Scalar &scalar) const |
| Multiply the quaternion with a scalar. | |
| Quaternion | operator* (float scalar) const |
| Multiply the quaternion with a scalar. | |
| Quaternion | operator+ (const Quaternion &other) const |
| Add the quaternion to another. | |
| Quaternion | operator- (const Quaternion &other) const |
| Subtract the quaternion to another. | |
| Rotation | toMatrix (bool skipAsserts=false) const |
| Convert the quaternion to a RotoTrans. | |
| Quaternion | slerp (double alpha, const Quaternion &quat) const |
| Interpolation of the quaternion between to position. | |
| Quaternion | conjugate () const |
| Return the conjugate of the quaternion. | |
| Quaternion | timeStep (const Vector3d &omega, const Scalar &dt) |
| Integrate the quaternion from its velocity. | |
| Vector3d | rotate (const Vector3d &vec) const |
| Return a rotated vector from the quaternion. | |
| Quaternion | omegaToQuatDot (const Vector3d &omega) const |
| Converts a 3d angular velocity vector into a 4d derivative of the components of the quaternion. | |
| Matrix3d | velocityMatrix (const Vector3d &euler, const String &seq) |
| Generate the velocity matrix which allows to go from/to euler angles to/from omega(body velocity). | |
| Vector3d | eulerDotToOmega (const Vector3d &eulerDot, const Vector3d &euler, const String &seq) |
| Converts a 3d angular velocity vector. | |
| Vector3d | omegaToEulerDot (const Vector3d &euler, const Vector3d &w, const String &seq) |
| converts a 3d vector of the body angular velocity (omega) into a 3d vector of the euler angles rate. | |
| void | derivate (const Vector &w) |
| Return the time derivative of the quaterion. | |
| void | normalize () |
| Force the normalization of the quaternion. | |
Static Public Member Functions | |
| static Quaternion | fromGLRotate (const Scalar &angle, const Scalar &x, const Scalar &y, const Scalar &z, const Scalar &kStab=1) |
| Construct Quaternion from a GL. | |
| static Quaternion | fromAxisAngle (const Scalar &angle, const Vector3d &axis, const Scalar &kStab=1) |
| Construct Quaternion from an axis angle. | |
| static Quaternion | fromMatrix (const RotoTrans &rt, const Scalar &kStab=1) |
| Construct Quaternion from a RotoTrans matrix. | |
| static Quaternion | fromMatrix (const Rotation &mat, const Scalar &kStab=1) |
| Construct Quaternion from a Rotation matrix. | |
| static Quaternion | fromZYXAngles (const Vector3d &zyx_angles, const Scalar &kStab=1) |
| Construct Quaternion from Euler angles (sequece ZYX). | |
| static Quaternion | fromYXZAngles (const Vector3d &yxz_angles, const Scalar &kStab=1) |
| Construct Quaternion from Euler angles (sequece YXZ). | |
| static Quaternion | fromXYZAngles (const Vector3d &xyz_angles, const Scalar &kStab=1) |
| Construct Quaternion from Euler angles (sequece XYZ). | |
Protected Attributes | |
| utils::Scalar | m_Kstab |
| Stabilization factor for the derivation. | |
Description of a quaternion in the format (w, x, y, z)
The definition for conversions are taken from https://www.euclideanspace.com/maths/geometry/rotations/conversions/index.htm
Definition at line 25 of file Quaternion.h.
| utils::Quaternion::Quaternion | ( | const Scalar & | kStabilizer = 1 | ) |
Construct Quaternion.
| kStabilizer | The value of the kstabilizer |
Definition at line 17 of file Quaternion.cpp.
| utils::Quaternion::Quaternion | ( | const Quaternion & | other | ) |
Construct Quaternion from another quaternion.
| other | Other quaternion |
Definition at line 20 of file Quaternion.cpp.
| utils::Quaternion::Quaternion | ( | const RigidBodyDynamics::Math::Vector4d & | vec4, |
| const Scalar & | kStabilizer = 1 ) |
Construct Quaternion.
| vec4 | The vector describing the quaternion |
| kStabilizer | The value of the kstabilizer |
Definition at line 23 of file Quaternion.cpp.
| utils::Quaternion::Quaternion | ( | const Scalar & | w, |
| const Scalar & | x, | ||
| const Scalar & | y, | ||
| const Scalar & | z, | ||
| const Scalar & | kStabilizer = 1 ) |
Construct Quaternion.
| w | The W-Component of quaternion |
| x | The X-Component of quaternion |
| y | The Y-Component of quaternion |
| z | The Z-Component of quaternion |
| kStabilizer | The value of the kstabilizer |
Definition at line 28 of file Quaternion.cpp.
| utils::Quaternion::Quaternion | ( | const Scalar & | w, |
| const Vector3d & | vec3, | ||
| const Scalar & | kStabilizer = 1 ) |
Construct Quaternion.
| w | The W-Component of quaternion |
| vec3 | The vector describing the imaginary part |
| kStabilizer | The value of the kstabilizer |
Definition at line 36 of file Quaternion.cpp.
| utils::Quaternion utils::Quaternion::conjugate | ( | ) | const |
Return the conjugate of the quaternion.
Definition at line 242 of file Quaternion.cpp.
| void utils::Quaternion::derivate | ( | const Vector & | w | ) |
Return the time derivative of the quaterion.
| w | The vector of time derivative (output) |
Definition at line 319 of file Quaternion.cpp.
| utils::Vector3d utils::Quaternion::eulerDotToOmega | ( | const Vector3d & | eulerDot, |
| const Vector3d & | euler, | ||
| const String & | seq ) |
Converts a 3d angular velocity vector.
| eulerDot | the Euler angle rates |
| euler | the Euler angles |
| seq | the Euler angles sequence |
Definition at line 300 of file Quaternion.cpp.
|
static |
Construct Quaternion from an axis angle.
| angle | The angle in radians |
| axis | The 3d vector of the axis |
| kStab | The value of the kstabilizer |
Definition at line 116 of file Quaternion.cpp.
|
static |
Construct Quaternion from a GL.
| angle | The angle in radians |
| x | The X-Component of quaternion |
| y | The Y-Component of quaternion |
| z | The Z-Component of quaternion |
| kStab | The value of the kstabilizer |
Definition at line 104 of file Quaternion.cpp.
|
static |
Construct Quaternion from a Rotation matrix.
| mat | The rotation matrix |
| kStab | The value of the kstabilizer |
Definition at line 137 of file Quaternion.cpp.
|
static |
Construct Quaternion from a RotoTrans matrix.
| rt | RotoTrans matrix |
| kStab | The value of the kstabilizer |
Definition at line 131 of file Quaternion.cpp.
|
static |
Construct Quaternion from Euler angles (sequece XYZ).
| xyz_angles | The Euler angles in a sequence where the first element is the X-component |
| kStab | The value of the kstabilizer |
Definition at line 165 of file Quaternion.cpp.
|
static |
Construct Quaternion from Euler angles (sequece YXZ).
| yxz_angles | The Euler angles in a sequence where the first element is the Y-component |
| kStab | The value of the kstabilizer |
Definition at line 157 of file Quaternion.cpp.
|
static |
Construct Quaternion from Euler angles (sequece ZYX).
| zyx_angles | The Euler angles in a sequence where the first element is the Z-component |
| kStab | The value of the kstabilizer |
Definition at line 149 of file Quaternion.cpp.
| utils::Scalar utils::Quaternion::kStab | ( | ) | const |
Return the k stabilizer.
The k statilizer value is used during several operation to make the quaternion tending toward a norm of \(1\)
Definition at line 52 of file Quaternion.cpp.
| void utils::Quaternion::normalize | ( | ) |
Force the normalization of the quaternion.
Definition at line 350 of file Quaternion.cpp.
| utils::Vector3d utils::Quaternion::omegaToEulerDot | ( | const Vector3d & | euler, |
| const Vector3d & | w, | ||
| const String & | seq ) |
converts a 3d vector of the body angular velocity (omega) into a 3d vector of the euler angles rate.
| euler | the Euler angles |
| w | the body velocity (omega) |
| seq | the Euler angles sequence |
Definition at line 310 of file Quaternion.cpp.
| utils::Quaternion utils::Quaternion::omegaToQuatDot | ( | const Vector3d & | omega | ) | const |
Converts a 3d angular velocity vector into a 4d derivative of the components of the quaternion.
| omega | the angular velocity |
Definition at line 265 of file Quaternion.cpp.
| utils::Quaternion utils::Quaternion::operator* | ( | const Quaternion & | other | ) | const |
Quaternion multiplication.
| other | The other quaternion |
Definition at line 54 of file Quaternion.cpp.
| utils::Quaternion utils::Quaternion::operator* | ( | const Scalar & | scalar | ) | const |
Multiply the quaternion with a scalar.
| scalar | The scalar to multiply with |
Definition at line 68 of file Quaternion.cpp.
| utils::Quaternion utils::Quaternion::operator* | ( | float | scalar | ) | const |
Multiply the quaternion with a scalar.
| scalar | The scalar to multiply with |
Definition at line 75 of file Quaternion.cpp.
| utils::Quaternion utils::Quaternion::operator+ | ( | const Quaternion & | other | ) | const |
Add the quaternion to another.
| other | The other quaternion to add |
Definition at line 90 of file Quaternion.cpp.
| utils::Quaternion utils::Quaternion::operator- | ( | const Quaternion & | other | ) | const |
Subtract the quaternion to another.
| other | Other quaternion to substract |
Definition at line 97 of file Quaternion.cpp.
| utils::Vector3d utils::Quaternion::rotate | ( | const Vector3d & | vec | ) | const |
Return a rotated vector from the quaternion.
| vec | The vector to rotate |
Definition at line 255 of file Quaternion.cpp.
| void utils::Quaternion::setKStab | ( | const Scalar & | newKStab | ) |
Set the k stabilizer.
| newKStab | The new value |
Definition at line 48 of file Quaternion.cpp.
| utils::Quaternion utils::Quaternion::slerp | ( | double | alpha, |
| const Quaternion & | quat ) const |
Interpolation of the quaternion between to position.
| alpha | The proportion of the rotation |
| quat | The quaternion to targe |
Definition at line 200 of file Quaternion.cpp.
| utils::Quaternion utils::Quaternion::timeStep | ( | const Vector3d & | omega, |
| const Scalar & | dt ) |
Integrate the quaternion from its velocity.
| omega | 3D vector of the angular velocity |
| dt | The time step to intergrate on |
Definition at line 247 of file Quaternion.cpp.
| utils::Rotation utils::Quaternion::toMatrix | ( | bool | skipAsserts = false | ) | const |
Convert the quaternion to a RotoTrans.
| skipAsserts | Check if the norm of the quaternion is approximately 1 |
The function throws a runtime_error if the skipAsserts is false and the norm of the quaternion is not almost one. In order to accelerate the computation of the norm, the norm-squared is evaluated. The threshold is 1e-10 for the norm-squared
Definition at line 173 of file Quaternion.cpp.
| utils::Matrix3d utils::Quaternion::velocityMatrix | ( | const Vector3d & | euler, |
| const String & | seq ) |
Generate the velocity matrix which allows to go from/to euler angles to/from omega(body velocity).
| euler | the Euler angles |
| seq | the Euler angles sequence |
Definition at line 284 of file Quaternion.cpp.
| utils::Scalar utils::Quaternion::w | ( | ) | const |
Return the real part (w) the Quaternion.
Definition at line 43 of file Quaternion.cpp.
| utils::Scalar utils::Quaternion::x | ( | ) | const |
Return the X-Component of the imaginary part of the Quaternion.
Definition at line 44 of file Quaternion.cpp.
| utils::Scalar utils::Quaternion::y | ( | ) | const |
Return the Y-Component of the imaginary part of the Quaternion.
Definition at line 45 of file Quaternion.cpp.
| utils::Scalar utils::Quaternion::z | ( | ) | const |
Return the Z-Component of the imaginary part of the Quaternion.
Definition at line 46 of file Quaternion.cpp.
|
protected |
Stabilization factor for the derivation.
Definition at line 351 of file Quaternion.h.