mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 03:03:34 +08:00
EKF: Add function enabling yaw variance to be increased
This commit is contained in:
committed by
Daniel Agar
parent
bf1f3a224e
commit
bce1b96d17
@@ -1,21 +1,21 @@
|
||||
/*
|
||||
C code fragment for function that enables the yaw uncertainty to be increased following a yaw reset.
|
||||
The variables q0 -> q3 are the attitude quaternions
|
||||
The variables _state.quat_nominal(0) -> _state.quat_nominal(3) are the attitude quaternions
|
||||
The variable daYawVar is the variance of the yaw angle uncertainty in rad**2
|
||||
See DeriveYawResetEquations.m for the derivation
|
||||
*/
|
||||
|
||||
// Intermediate variables
|
||||
float SG[3];
|
||||
SG[0] = sq(q0) - sq(q1) - sq(q2) + sq(q3);
|
||||
SG[1] = 2*q0*q2 - 2*q1*q3;
|
||||
SG[2] = 2*q0*q1 + 2*q2*q3;
|
||||
SG[0] = sq(_state.quat_nominal(0)) - sq(_state.quat_nominal(1)) - sq(_state.quat_nominal(2)) + sq(_state.quat_nominal(3));
|
||||
SG[1] = 2*_state.quat_nominal(0)*_state.quat_nominal(2) - 2*_state.quat_nominal(1)*_state.quat_nominal(3);
|
||||
SG[2] = 2*_state.quat_nominal(0)*_state.quat_nominal(1) + 2*_state.quat_nominal(2)*_state.quat_nominal(3);
|
||||
|
||||
float SQ[4];
|
||||
SQ[0] = 0.5f * ((q1*SG[0]) - (q0*SG[2]) + (q3*SG[1]));
|
||||
SQ[1] = 0.5f * ((q0*SG[1]) - (q2*SG[0]) + (q3*SG[2]));
|
||||
SQ[2] = 0.5f * ((q3*SG[0]) - (q1*SG[1]) + (q2*SG[2]));
|
||||
SQ[3] = 0.5f * ((q0*SG[0]) + (q1*SG[2]) + (q2*SG[1]));
|
||||
SQ[0] = 0.5f * ((_state.quat_nominal(1)*SG[0]) - (_state.quat_nominal(0)*SG[2]) + (_state.quat_nominal(3)*SG[1]));
|
||||
SQ[1] = 0.5f * ((_state.quat_nominal(0)*SG[1]) - (_state.quat_nominal(2)*SG[0]) + (_state.quat_nominal(3)*SG[2]));
|
||||
SQ[2] = 0.5f * ((_state.quat_nominal(3)*SG[0]) - (_state.quat_nominal(1)*SG[1]) + (_state.quat_nominal(2)*SG[2]));
|
||||
SQ[3] = 0.5f * ((_state.quat_nominal(0)*SG[0]) + (_state.quat_nominal(1)*SG[2]) + (_state.quat_nominal(2)*SG[1]));
|
||||
|
||||
// Variance of yaw angle uncertainty (rad**2)
|
||||
const float daYawVar = TBD;
|
||||
|
||||
Reference in New Issue
Block a user