mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 01:53:35 +08:00
Extract general functions into utils
This commit is contained in:
committed by
Mathieu Bresciani
parent
fda30d8cec
commit
ff8b5ec69d
@@ -0,0 +1,20 @@
|
||||
#include <matrix/math.hpp>
|
||||
|
||||
|
||||
// converts Tait-Bryan 312 sequence of rotations from frame 1 to frame 2
|
||||
// to the corresponding rotation matrix that rotates from frame 2 to frame 1
|
||||
// rot312(0) - First rotation is a RH rotation about the Z axis (rad)
|
||||
// rot312(1) - Second rotation is a RH rotation about the X axis (rad)
|
||||
// rot312(2) - Third rotation is a RH rotation about the Y axis (rad)
|
||||
// See http://www.atacolorado.com/eulersequences.doc
|
||||
matrix::Dcmf taitBryan312ToRotMat(const matrix::Vector3f &rot312);
|
||||
|
||||
// Use Kahan summation algorithm to get the sum of "sum_previous" and "input".
|
||||
// This function relies on the caller to be responsible for keeping a copy of
|
||||
// "accumulator" and passing this value at the next iteration.
|
||||
// Ref: https://en.wikipedia.org/wiki/Kahan_summation_algorithm
|
||||
float kahanSummation(float sum_previous, float input, float &accumulator);
|
||||
|
||||
// calculate the inverse rotation matrix from a quaternion rotation
|
||||
// this produces the inverse rotation to that produced by the math library quaternion to Dcmf operator
|
||||
matrix::Dcmf quatToInverseRotMat(const matrix::Quatf &quat);
|
||||
Reference in New Issue
Block a user