| 
    ROBOOP, A Robotics Object Oriented Package in C++
    
   | 
 
Quaternion class. More...
#include "robot.h"Go to the source code of this file.
Classes | |
| class | Quaternion | 
| Quaternion class definition.  More... | |
Macros | |
| #define | BASE_FRAME 0 | 
| #define | BODY_FRAME 1 | 
| #define | EPSILON 0.0000001 | 
Functions | |
| Quaternion | operator* (const Real c, const Quaternion &rhs) | 
| Overload * operator, multiplication by a scalar.  More... | |
| Quaternion | operator* (const Quaternion &lhs, const Real c) | 
| Overload * operator, multiplication by a scalar.  | |
| Quaternion | operator/ (const Real c, const Quaternion &rhs) | 
| Overload / operator, division by a scalar.  More... | |
| Quaternion | operator/ (const Quaternion &lhs, const Real c) | 
| ReturnMatrix | Omega (const Quaternion &q, const Quaternion &q_dot) | 
| Return angular velocity from a quaternion and it's time derivative.  More... | |
| short | Integ_quat (Quaternion &dquat_present, Quaternion &dquat_past, Quaternion &quat, const Real dt) | 
| Trapezoidal quaternion integration.  | |
| Real | Integ_Trap_quat_s (const Quaternion &present, Quaternion &past, const Real dt) | 
| Trapezoidal quaternion scalar part integration.  | |
| ReturnMatrix | Integ_Trap_quat_v (const Quaternion &present, Quaternion &past, const Real dt) | 
| Trapezoidal quaternion vector part integration.  | |
| Quaternion | Slerp (const Quaternion &q0, const Quaternion &q1, const Real t) | 
| Spherical Linear Interpolation.  More... | |
| Quaternion | Slerp_prime (const Quaternion &q0, const Quaternion &q1, const Real t) | 
| Spherical Linear Interpolation derivative.  More... | |
| Quaternion | Squad (const Quaternion &p, const Quaternion &a, const Quaternion &b, const Quaternion &q, const Real t) | 
| Spherical Cubic Interpolation.  More... | |
| Quaternion | Squad_prime (const Quaternion &p, const Quaternion &a, const Quaternion &b, const Quaternion &q, const Real t) | 
| Spherical Cubic Interpolation derivative.  More... | |
Quaternion class.
Definition in file quaternion.h.
| ReturnMatrix Omega | ( | const Quaternion & | q, | 
| const Quaternion & | q_dot | ||
| ) | 
Return angular velocity from a quaternion and it's time derivative.
See Quaternion::dot for explanation.
Definition at line 557 of file quaternion.cpp.
References Quaternion::E(), and Quaternion::v().
Referenced by Stewart::Find_C(), Stewart::jacobian_dot(), Spl_Quaternion::quat_w(), Stewart::set_ddq(), and Stewart::set_dq().
| Quaternion operator* | ( | const Real | c, | 
| const Quaternion & | q | ||
| ) | 
Overload * operator, multiplication by a scalar.
 and let 
. Then ![$rq = qr = [r, 0][s, v] = [rs, rv]$](form_169.png)
The result is not necessarily a unit quaternion even if 
 is a unit quaternions. 
Definition at line 513 of file quaternion.cpp.
References Quaternion::s(), Quaternion::set_s(), Quaternion::set_v(), and Quaternion::v().
Referenced by operator*().
| Quaternion operator/ | ( | const Real | c, | 
| const Quaternion & | q | ||
| ) | 
Overload / operator, division by a scalar.
Same explanation as multiplication by scaler.
Definition at line 539 of file quaternion.cpp.
References Quaternion::s(), Quaternion::set_s(), Quaternion::set_v(), and Quaternion::v().
| Quaternion Slerp | ( | const Quaternion & | q0, | 
| const Quaternion & | q1, | ||
| const Real | t | ||
| ) | 
Spherical Linear Interpolation.
Cite_:Dam
The quaternion 
 interpolate the quaternions 
 and 
 given the parameter 
 along the quaternion sphere. 
 where 
 and 
 are real functions with 
. As 
 varies between 0 and 1. the values 
 varies uniformly along the circular arc from 
 and 
. The angle between 
 and 
 is 
 and the angle between 
 and 
 is 
. Taking the dot product of 
 and 
 yields 
 and taking the dot product of 
 and 
 yields 
 These are two equations with 
 and 
. The solution is 
The interpolation is then
 If 
 and 
 are unit quaternions the 
 is also a unit quaternions. For unit quaternions we have 
For t = 0 and t = 1 we have
It is customary to choose the sign G on q1 so that q0.Gq1 >=0 (the angle between q0 ang Gq1 is acute). This choice avoids extra spinning caused by the interpolated rotations.
Definition at line 628 of file quaternion.cpp.
References Quaternion::dot_prod(), and Quaternion::i().
Referenced by Spl_Quaternion::quat(), Spl_Quaternion::quat_w(), Slerp_prime(), Squad(), and Squad_prime().
| Quaternion Slerp_prime | ( | const Quaternion & | q0, | 
| const Quaternion & | q1, | ||
| const Real | t | ||
| ) | 
Spherical Linear Interpolation derivative.
Cite_: Dam
The derivative of the function 
 where 
 is a constant unit quaternion is 
Using the preceding equation the Slerp derivative is then
It is customary to choose the sign G on q1 so that q0.Gq1 >=0 (the angle between q0 ang Gq1 is acute). This choice avoids extra spinning caused by the interpolated rotations. The result is not necessary a unit quaternion.
Definition at line 689 of file quaternion.cpp.
References Quaternion::dot_prod(), Quaternion::i(), and Slerp().
Referenced by Spl_Quaternion::quat_w().
| Quaternion Squad | ( | const Quaternion & | p, | 
| const Quaternion & | a, | ||
| const Quaternion & | b, | ||
| const Quaternion & | q, | ||
| const Real | t | ||
| ) | 
Spherical Cubic Interpolation.
Cite_: Dam
Let four quaternions be 
 (p), 
 (a), 
 (b) and 
 (q) be the ordered vertices of a quadrilateral. Obtain c from 
 to 
 interpolation. Obtain d from 
 to 
 interpolation. Obtain e, the final result, from c to d interpolation. 
 The intermediate quaternion 
 and 
 are given by 
Definition at line 722 of file quaternion.cpp.
References Slerp().
Referenced by Spl_Quaternion::quat(), and Spl_Quaternion::quat_w().
| Quaternion Squad_prime | ( | const Quaternion & | p, | 
| const Quaternion & | a, | ||
| const Quaternion & | b, | ||
| const Quaternion & | q, | ||
| const Real | t | ||
| ) | 
Spherical Cubic Interpolation derivative.
Cite_: www.magic-software.com
The derivative of the function 
 where 
 is a constant unit quaternion is 
 Recalling that 
 (see Quaternion::Log()). If the power is a function we have 
 If 
 is a function of time and the power is differentiable function of time we have 
 Using these last three equations Squad derivative can be define. Let 
, 
, 
. We then have 
 where 
, 
, 
The result is not necessarily a unit quaternion even if all the input quaternions are unit.
Definition at line 748 of file quaternion.cpp.
References Quaternion::i(), and Slerp().
Referenced by Spl_Quaternion::quat_w().