#include <Quaternion.h>
Public Member Functions | |
Quaternion (float w_, float x_, float y_, float z_) | |
Quaternion | operator* (Quaternion qt) |
Quaternion | operator*= (Quaternion qt) |
Quaternion | normalize () |
Quaternion | conjugate () |
Vector3 | rotate_vector (Vector3 vt) |
Quaternion | from_axis_angle (float theta, Vector3 vt) |
Vector3 | quaternion_to_euler () |
Quaternion | euler_to_quaternion (Vector3 vt) |
Quaternion | update_with_rates (float dt, Vector3 rates) |
Quaternion | update_with_accel (Vector3 at, Vector3 target_vector, float gain) |
Quaternion | update_with_mag (Vector3 mt, Vector3 at, Vector3 target_vector, Quaternion declination_compensation, float gain) |
Public Attributes | |
float | w |
float | x |
float | y |
float | z |
Class to perform quaternion math
w - x - y - z components
Input for euler angle and other orientation math: X Roll Y Pitch Z Yaw Euler rotation order: Z - Y - X
Quaternion Quaternion::conjugate | ( | ) |
Calculates conjugate of quaternion (backwards rotation)
Quaternion Quaternion::euler_to_quaternion | ( | Vector3 | vt | ) |
Converts XYZ Euler angles to a quaternion representation (Z-Y-X Yaw-Pitch-Roll order)
vt | Euler angles vector (Roll - Pitch - Yaw) |
Quaternion Quaternion::from_axis_angle | ( | float | theta, |
Vector3 | vt ) |
Sets quaternion from axis-angle representation
theta | Angle component |
vt | Vector component |
Quaternion Quaternion::normalize | ( | ) |
Returns normalized quaternion (sets length to 1) if its magnitude is not zero
Quaternion Quaternion::operator* | ( | Quaternion | qt | ) |
Quaternion product operator
qt | Other quaternion to do the product with |
Quaternion Quaternion::operator*= | ( | Quaternion | qt | ) |
Quaternion product operator, updates the current quaternion
qt | Other quaternion to do the product with |
Vector3 Quaternion::quaternion_to_euler | ( | ) |
Calculates euler representation of quaternion rotation (Z-Y-X Yaw-Pitch-Roll)
Quaternion Quaternion::update_with_accel | ( | Vector3 | at, |
Vector3 | target_vector, | ||
float | gain ) |
Updates quaternion from inertial-frame accelerometer readings, (x = +1g | +9.8m/s^2). Algorithm works on the idea that the x axis (upwards) should have all the acceleration while y and z should be zero
vt | Dimensionless inertial accelerometer measurements |
target_vector | Vector to which the accelerometers should "point at" |
gain | How much to rotate quaternion by (0 - 1.0f) |
Quaternion Quaternion::update_with_mag | ( | Vector3 | mt, |
Vector3 | at, | ||
Vector3 | target_vector, | ||
Quaternion | declination_compensation, | ||
float | gain ) |
Updates quaternion from body-frame magnetometer readings in the same manner the accelerometer update does
mt | Dimensionless body magnetometer measurements |
at | Dimensionless body accelerometer measurements |
target_vector | Vector to which EAST should "point at" |
gain | How much to rotate quaternion by (0 - 1.0f) |
Quaternion Quaternion::update_with_rates | ( | float | dt, |
Vector3 | rates ) |
Updates quaternion from body-axis angular rates
rates | Radian angular rates |
dt | Delta time |