JSBSim Flight Dynamics Model
1.0 (02 March 2017)
An Open Source Flight Dynamics and Control Software Library in C++
|
Models the Quaternion representation of rotations. More...
#include <FGQuaternion.h>
Public Member Functions | |
FGQuaternion () | |
Default initializer. More... | |
FGQuaternion (const FGQuaternion &q) | |
Copy constructor. More... | |
FGQuaternion (double phi, double tht, double psi) | |
Initializer by euler angles. More... | |
FGQuaternion (FGColumnVector3 vOrient) | |
Initializer by euler angle vector. More... | |
FGQuaternion (int idx, double angle) | |
Initializer by one euler angle. More... | |
FGQuaternion (double angle, const FGColumnVector3 &axis) | |
Initializer by a rotation axis and an angle. More... | |
FGQuaternion (const FGMatrix33 &m) | |
Initializer by matrix. More... | |
~FGQuaternion () | |
Destructor. | |
FGQuaternion | Conjugate (void) const |
Conjugate of the quaternion. More... | |
std::string | Dump (const std::string &delimiter) const |
double | Entry (unsigned int idx) const |
Read access the entries of the vector. More... | |
double & | Entry (unsigned int idx) |
Write access the entries of the vector. More... | |
double | GetCosEuler (int i) const |
Retrieves cosine of the given euler angle. More... | |
const FGColumnVector3 & | GetEuler (void) const |
Retrieves the Euler angles. More... | |
double | GetEuler (int i) const |
Retrieves the Euler angles. More... | |
double | GetEulerDeg (int i) const |
Retrieves the Euler angles. More... | |
FGColumnVector3 const | GetEulerDeg (void) const |
Retrieves the Euler angle vector. More... | |
FGQuaternion | GetQDot (const FGColumnVector3 &PQR) const |
Quaternion derivative for given angular rates. More... | |
double | GetSinEuler (int i) const |
Retrieves sine of the given euler angle. More... | |
const FGMatrix33 & | GetT (void) const |
Transformation matrix. More... | |
const FGMatrix33 & | GetTInv (void) const |
Backward transformation matrix. More... | |
FGQuaternion | Inverse (void) const |
Inverse of the quaternion. More... | |
double | Magnitude (void) const |
Length of the vector. More... | |
void | Normalize (void) |
Normalize. More... | |
operator FGMatrix33 () const | |
Conversion from Quat to Matrix. | |
bool | operator!= (const FGQuaternion &q) const |
Comparison operator "!=". More... | |
double | operator() (unsigned int idx) const |
Read access the entries of the vector. More... | |
double & | operator() (unsigned int idx) |
Write access the entries of the vector. More... | |
FGQuaternion | operator* (const FGQuaternion &q) const |
Arithmetic operator "*". More... | |
const FGQuaternion & | operator*= (double scalar) |
Arithmetic operator "*=". More... | |
const FGQuaternion & | operator*= (const FGQuaternion &q) |
Arithmetic operator "*=". More... | |
FGQuaternion | operator+ (const FGQuaternion &q) const |
Arithmetic operator "+". More... | |
const FGQuaternion & | operator+= (const FGQuaternion &q) |
FGQuaternion | operator- (const FGQuaternion &q) const |
Arithmetic operator "-". More... | |
const FGQuaternion & | operator-= (const FGQuaternion &q) |
Arithmetic operator "-=". More... | |
const FGQuaternion & | operator/= (double scalar) |
Arithmetic operator "/=". More... | |
const FGQuaternion & | operator= (const FGQuaternion &q) |
Assignment operator "=". More... | |
bool | operator== (const FGQuaternion &q) const |
Comparison operator "==". More... | |
double | SqrMagnitude (void) const |
Square of the length of the vector. More... | |
Public Member Functions inherited from FGJSBBase | |
FGJSBBase () | |
Constructor for FGJSBBase. | |
virtual | ~FGJSBBase () |
Destructor for FGJSBBase. | |
void | disableHighLighting (void) |
Disables highlighting in the console output. | |
std::string | GetVersion (void) |
Returns the version number of JSBSim. More... | |
void | PutMessage (const Message &msg) |
Places a Message structure on the Message queue. More... | |
void | PutMessage (const std::string &text) |
Creates a message with the given text and places it on the queue. More... | |
void | PutMessage (const std::string &text, bool bVal) |
Creates a message with the given text and boolean value and places it on the queue. More... | |
void | PutMessage (const std::string &text, int iVal) |
Creates a message with the given text and integer value and places it on the queue. More... | |
void | PutMessage (const std::string &text, double dVal) |
Creates a message with the given text and double value and places it on the queue. More... | |
int | SomeMessages (void) |
Reads the message on the queue (but does not delete it). More... | |
void | ProcessMessage (void) |
Reads the message on the queue and removes it from the queue. More... | |
Message * | ProcessNextMessage (void) |
Reads the next message on the queue and removes it from the queue. More... | |
Static Public Member Functions | |
static FGQuaternion | zero (void) |
Zero quaternion vector. More... | |
Static Public Member Functions inherited from FGJSBBase | |
static double | CelsiusToFahrenheit (double celsius) |
Converts from degrees Celsius to degrees Fahrenheit. More... | |
static double | CelsiusToKelvin (double celsius) |
Converts from degrees Celsius to degrees Kelvin. More... | |
static double | CelsiusToRankine (double celsius) |
Converts from degrees Celsius to degrees Rankine. More... | |
static double | Constrain (double min, double value, double max) |
Constrain a value between a minimum and a maximum value. | |
static bool | EqualToRoundoff (double a, double b) |
Finite precision comparison. More... | |
static bool | EqualToRoundoff (float a, float b) |
Finite precision comparison. More... | |
static bool | EqualToRoundoff (float a, double b) |
Finite precision comparison. More... | |
static bool | EqualToRoundoff (double a, float b) |
Finite precision comparison. More... | |
static double | FahrenheitToCelsius (double fahrenheit) |
Converts from degrees Fahrenheit to degrees Celsius. More... | |
static double | FeetToMeters (double measure) |
Converts from feet to meters. More... | |
static double | GaussianRandomNumber (void) |
static double | KelvinToCelsius (double kelvin) |
Converts from degrees Kelvin to degrees Celsius. More... | |
static double | KelvinToFahrenheit (double kelvin) |
Converts from degrees Kelvin to degrees Fahrenheit. More... | |
static double | KelvinToRankine (double kelvin) |
Converts from degrees Kelvin to degrees Rankine. More... | |
static double | MachFromVcalibrated (double vcas, double p, double psl, double rhosl) |
Calculate the Mach number from the calibrated airspeed. More... | |
static double | PitotTotalPressure (double mach, double p) |
Compute the total pressure in front of the Pitot tube. More... | |
static double | RankineToCelsius (double rankine) |
Converts from degrees Rankine to degrees Celsius. More... | |
static double | RankineToKelvin (double rankine) |
Converts from degrees Rankine to degrees Kelvin. More... | |
static double | sign (double num) |
static double | VcalibratedFromMach (double mach, double p, double psl, double rhosl) |
Calculate the calibrated airspeed from the Mach number. More... | |
Friends | |
FGQuaternion | operator* (double, const FGQuaternion &) |
Scalar multiplication. More... | |
FGQuaternion | QExp (const FGColumnVector3 &omega) |
Quaternion exponential. More... | |
Additional Inherited Members | |
Public Types inherited from FGJSBBase | |
enum | { eL = 1, eM, eN } |
Moments L, M, N. | |
enum | { eP = 1, eQ, eR } |
Rates P, Q, R. | |
enum | { eU = 1, eV, eW } |
Velocities U, V, W. | |
enum | { eX = 1, eY, eZ } |
Positions X, Y, Z. | |
enum | { ePhi = 1, eTht, ePsi } |
Euler angles Phi, Theta, Psi. | |
enum | { eDrag = 1, eSide, eLift } |
Stability axis forces, Drag, Side force, Lift. | |
enum | { eRoll = 1, ePitch, eYaw } |
Local frame orientation Roll, Pitch, Yaw. | |
enum | { eNorth = 1, eEast, eDown } |
Local frame position North, East, Down. | |
enum | { eLat = 1, eLong, eRad } |
Locations Radius, Latitude, Longitude. | |
enum | { inNone = 0, inDegrees, inRadians, inMeters, inFeet } |
Conversion specifiers. | |
Static Public Attributes inherited from FGJSBBase | |
static short | debug_lvl = 1 |
static char | highint [5] = {27, '[', '1', 'm', '\0' } |
highlights text | |
static char | halfint [5] = {27, '[', '2', 'm', '\0' } |
low intensity text | |
static char | normint [6] = {27, '[', '2', '2', 'm', '\0' } |
normal intensity text | |
static char | reset [5] = {27, '[', '0', 'm', '\0' } |
resets text properties | |
static char | underon [5] = {27, '[', '4', 'm', '\0' } |
underlines text | |
static char | underoff [6] = {27, '[', '2', '4', 'm', '\0' } |
underline off | |
static char | fgblue [6] = {27, '[', '3', '4', 'm', '\0' } |
blue text | |
static char | fgcyan [6] = {27, '[', '3', '6', 'm', '\0' } |
cyan text | |
static char | fgred [6] = {27, '[', '3', '1', 'm', '\0' } |
red text | |
static char | fggreen [6] = {27, '[', '3', '2', 'm', '\0' } |
green text | |
static char | fgdef [6] = {27, '[', '3', '9', 'm', '\0' } |
default text | |
Protected Member Functions inherited from FGJSBBase | |
void | Debug (int) |
Static Protected Member Functions inherited from FGJSBBase | |
static std::string | CreateIndexedPropertyName (const std::string &Property, int index) |
Static Protected Attributes inherited from FGJSBBase | |
static const double | degtorad = 0.017453292519943295769236907684886 |
static const double | fpstokts = 1.0/ktstofps |
static const double | fttom = 0.3048 |
static int | gaussian_random_number_phase = 0 |
static const double | hptoftlbssec = 550.0 |
static const double | in3tom3 = 1.638706E-5 |
static const double | inchtoft = 0.08333333 |
static const double | inhgtopa = 3386.38 |
static const std::string | JSBSim_version = "1.0 " __DATE__ " " __TIME__ |
static const double | kgtolb = 2.20462 |
static const double | kgtoslug = 0.06852168 |
static const double | ktstofps = 1.68781 |
static const double | lbtoslug = 1.0/slugtolb |
static Message | localMsg |
static const double | m3toft3 = 1.0/(fttom*fttom*fttom) |
static double | Mair = 28.9645 |
static unsigned int | messageId = 0 |
static std::queue< Message > | Messages |
static const std::string | needed_cfg_version = "2.0" |
static const double | psftoinhg = 0.014138 |
static const double | psftopa = 47.88 |
static const double | radtodeg = 57.295779513082320876798154814105 |
static double | Reng = 1716.56 |
static double | Rstar = 1545.348 |
static const double | SHRatio = 1.40 |
static const double | slugtolb = 32.174049 |
Models the Quaternion representation of rotations.
FGQuaternion is a representation of an arbitrary rotation through a quaternion. It has vector properties. This class also contains access functions to the euler angle representation of rotations and access to transformation matrices for 3D vectors. Transformations and euler angles are therefore computed once they are requested for the first time. Then they are cached for later usage as long as the class is not accessed trough a nonconst member function.
Note: The order of rotations used in this class corresponds to a 3-2-1 sequence, or Y-P-R, or Z-Y-X, if you prefer.
Definition at line 92 of file FGQuaternion.h.
|
inline |
Default initializer.
Default initializer, initializes the class with the identity rotation.
Definition at line 96 of file FGQuaternion.h.
FGQuaternion | ( | const FGQuaternion & | q | ) |
Copy constructor.
Copy constructor, initializes the quaternion.
q | a constant reference to another FGQuaternion instance |
Definition at line 67 of file FGQuaternion.cpp.
FGQuaternion | ( | double | phi, |
double | tht, | ||
double | psi | ||
) |
Initializer by euler angles.
Initialize the quaternion with the euler angles.
phi | The euler X axis (roll) angle in radians |
tht | The euler Y axis (attitude) angle in radians |
psi | The euler Z axis (heading) angle in radians |
Definition at line 85 of file FGQuaternion.cpp.
FGQuaternion | ( | FGColumnVector3 | vOrient | ) |
Initializer by euler angle vector.
Initialize the quaternion with the euler angle vector.
vOrient | The euler axis angle vector in radians (phi, tht, psi) |
Definition at line 92 of file FGQuaternion.cpp.
|
inline |
Initializer by one euler angle.
Initialize the quaternion with the single euler angle where its index is given in the first argument.
idx | Index of the euler angle to initialize |
angle | The euler angle in radians |
Definition at line 123 of file FGQuaternion.h.
|
inline |
Initializer by a rotation axis and an angle.
Initialize the quaternion to represent the rotation around a given angle and an arbitrary axis.
angle | The angle in radians |
axis | The rotation axis |
Definition at line 158 of file FGQuaternion.h.
FGQuaternion | ( | const FGMatrix33 & | m | ) |
Initializer by matrix.
Initialize the quaternion with the matrix representing a transform from one frame to another using the standard aerospace sequence, Yaw-Pitch-Roll (3-2-1).
m | the rotation matrix |
Definition at line 142 of file FGQuaternion.cpp.
|
inline |
Conjugate of the quaternion.
Compute and return the conjugate of the quaternion. This one is equal to the inverse iff the quaternion is normalized.
Definition at line 456 of file FGQuaternion.h.
|
inline |
Read access the entries of the vector.
idx | the component index. |
Return the value of the matrix entry at the given index. Indices are counted starting with 1.
This function is just a shortcut for the double operator()(unsigned int idx) const
function. It is used internally to access the elements in a more convenient way.
Note that the index given in the argument is unchecked.
Definition at line 291 of file FGQuaternion.h.
|
inline |
Write access the entries of the vector.
idx | the component index. |
Return a reference to the vector entry at the given index. Indices are counted starting with 1.
This function is just a shortcut for the double& operator()(unsigned int idx)
function. It is used internally to access the elements in a more convenient way.
Note that the index given in the argument is unchecked.
Definition at line 306 of file FGQuaternion.h.
|
inline |
Retrieves cosine of the given euler angle.
Definition at line 251 of file FGQuaternion.h.
|
inline |
Retrieves the Euler angles.
Definition at line 205 of file FGQuaternion.h.
|
inline |
Retrieves the Euler angles.
i | the Euler angle index. units radians. |
Definition at line 216 of file FGQuaternion.h.
|
inline |
Retrieves the Euler angles.
i | the Euler angle index. |
Definition at line 226 of file FGQuaternion.h.
|
inline |
Retrieves the Euler angle vector.
Definition at line 235 of file FGQuaternion.h.
FGQuaternion GetQDot | ( | const FGColumnVector3 & | PQR | ) | const |
Quaternion derivative for given angular rates.
Returns the derivative of the quaternion corresponding to the angular velocities PQR.
Computes the quaternion derivative which results from the given angular velocities
PQR | a constant reference to a rotation rate vector |
See Stevens and Lewis, "Aircraft Control and Simulation", Second Edition, Equation 1.3-36. Also see Jack Kuipers, "Quaternions and Rotation Sequences", Equation 11.12.
Definition at line 161 of file FGQuaternion.cpp.
|
inline |
Retrieves sine of the given euler angle.
Definition at line 243 of file FGQuaternion.h.
|
inline |
Transformation matrix.
Definition at line 194 of file FGQuaternion.h.
|
inline |
Backward transformation matrix.
Definition at line 199 of file FGQuaternion.h.
|
inline |
Inverse of the quaternion.
Compute and return the inverse of the quaternion so that the orientation represented with *this multiplied with the returned value is equal to the identity orientation.
Definition at line 442 of file FGQuaternion.h.
|
inline |
Length of the vector.
Compute and return the euclidean norm of this vector.
Definition at line 466 of file FGQuaternion.h.
void Normalize | ( | void | ) |
Normalize.
Normalize the vector to have the Magnitude() == 1.0. If the vector is equal to zero it is left untouched.
Definition at line 173 of file FGQuaternion.cpp.
|
inline |
Comparison operator "!=".
q | a quaternion reference |
Definition at line 349 of file FGQuaternion.h.
|
inline |
Read access the entries of the vector.
idx | the component index. |
Return the value of the matrix entry at the given index. Indices are counted starting with 1.
Note that the index given in the argument is unchecked.
Definition at line 265 of file FGQuaternion.h.
|
inline |
Write access the entries of the vector.
idx | the component index. |
Return a reference to the vector entry at the given index. Indices are counted starting with 1.
Note that the index given in the argument is unchecked.
Definition at line 276 of file FGQuaternion.h.
|
inline |
Arithmetic operator "*".
Multiplication of two quaternions is like performing successive rotations.
q | a quaternion to be multiplied. |
Definition at line 412 of file FGQuaternion.h.
|
inline |
Arithmetic operator "*=".
scalar | a multiplicative value. |
Definition at line 376 of file FGQuaternion.h.
|
inline |
Arithmetic operator "*=".
Multiplication of two quaternions is like performing successive rotations.
q | a quaternion to be multiplied. |
Definition at line 423 of file FGQuaternion.h.
|
inline |
Arithmetic operator "+".
q | a quaternion to be summed. |
Definition at line 395 of file FGQuaternion.h.
|
inline |
Arithmetic operator "-".
q | a quaternion to be subtracted. |
Definition at line 403 of file FGQuaternion.h.
|
inline |
Arithmetic operator "-=".
q | a quaternion reference. |
Definition at line 363 of file FGQuaternion.h.
|
inline |
Arithmetic operator "/=".
scalar | a divisor value. |
Definition at line 388 of file FGQuaternion.h.
|
inline |
Assignment operator "=".
Assign the value of q to the current object. Cached values are conserved.
q | reference to an FGQuaternion instance |
Definition at line 316 of file FGQuaternion.h.
|
inline |
Comparison operator "==".
q | a quaternion reference |
Definition at line 341 of file FGQuaternion.h.
|
inline |
Square of the length of the vector.
Compute and return the square of the euclidean norm of this vector.
Definition at line 472 of file FGQuaternion.h.
|
inlinestatic |
Zero quaternion vector.
Does not represent any orientation. Useful for initialization of increments
Definition at line 486 of file FGQuaternion.h.
|
friend |
Scalar multiplication.
scalar | scalar value to multiply with. |
q | Vector to multiply. |
Multiply the Vector with a scalar value.
Definition at line 545 of file FGQuaternion.h.
|
friend |
Quaternion exponential.
omega | rotation velocity Calculate the unit quaternion which is the result of the exponentiation of the vector 'omega'. |
Definition at line 554 of file FGQuaternion.h.