Class quaternion

Class Documentation

class quaternion

This class implements quaternion error as in the paper: “Operational Space Control: A Theoretical and Empirical Comparison” Authors: Jun Nakanishi, Rick Cory, Michael Mistry, Jan Peters and Stefan Schaal The International Journal of Robotics Research, Vol.

27, No. 6, June 2008, pp. 737–757

REMEMBER: if e is the quaternion error, the orientation error is defined as: o_error = -Ke with K positive definite!

Public Functions

inline quaternion()
inline quaternion(double _x, double _y, double _z, double _w)
inline quaternion operator*(const double a)

operator * product between a quaternion and a scalar

Parameters

a – scalar

Returns

a quaternion

inline KDL::Rotation skew()

skew operator

Returns

the skew matrix of the quaternion

Public Members

double x
double y
double z
double w

Public Static Functions

static inline double dot(const quaternion &a, const quaternion &b)

dot product between two quaternions

Parameters
  • a – first quaternion

  • b – second quaternion

Returns

a scalar

static inline KDL::Vector error(quaternion &q, quaternion &qd)

error compute the error between two quaternion to be usable in orientation control

REMEMBER: if e is the quaternion error, the orientation error is defined as: o_error = -Ke with K positive definite!

Parameters
  • q – actual quaternion

  • qd – desired quaternion

Returns

an error vector [3x1]

static inline Eigen::Vector3d error(const double &qx, const double &qy, const double &qz, const double &qw, const double &qdx, const double &qdy, const double &qdz, const double &qdw)
static inline void normalize(quaternion &q)

normalize a given quaternion: Given q = (x, y, z, w) return q_n = (x/d, y/d, z/d, w/d) with d = sqrt(x**2 + y**2 + z**2 + w**2)

Parameters

q – quaternion to normalize