3 #if HAL_CPU_CLASS >= HAL_CPU_CLASS_150 83 rngPred = deltaPosNED.
length();
93 memset(H_BCN, 0,
sizeof(H_BCN));
101 float t9 = 1.0f/sqrtf(t8);
114 float t10 =
P[9][9]*t2*
t9;
115 float t11 =
P[8][9]*t3*
t9;
116 float t12 =
P[7][9]*t4*
t9;
119 float t15 =
P[9][8]*t2*
t9;
120 float t16 =
P[8][8]*t3*
t9;
121 float t17 =
P[7][8]*t4*
t9;
124 float t20 =
P[9][7]*t2*
t9;
125 float t21 =
P[8][7]*t3*
t9;
126 float t22 =
P[7][7]*t4*
t9;
142 Kfusion[0] = -t26*(
P[0][7]*t4*t9+
P[0][8]*t3*t9+
P[0][9]*t2*
t9);
143 Kfusion[1] = -t26*(
P[1][7]*t4*t9+
P[1][8]*t3*t9+
P[1][9]*t2*
t9);
144 Kfusion[2] = -t26*(
P[2][7]*t4*t9+
P[2][8]*t3*t9+
P[2][9]*t2*
t9);
145 Kfusion[3] = -t26*(
P[3][7]*t4*t9+
P[3][8]*t3*t9+
P[3][9]*t2*
t9);
146 Kfusion[4] = -t26*(
P[4][7]*t4*t9+
P[4][8]*t3*t9+
P[4][9]*t2*
t9);
147 Kfusion[5] = -t26*(
P[5][7]*t4*t9+
P[5][8]*t3*t9+
P[5][9]*t2*
t9);
148 Kfusion[7] = -t26*(t22+
P[7][8]*t3*t9+
P[7][9]*t2*
t9);
149 Kfusion[8] = -t26*(t16+
P[8][7]*t4*t9+
P[8][9]*t2*
t9);
152 Kfusion[10] = -t26*(
P[10][7]*t4*t9+
P[10][8]*t3*t9+
P[10][9]*t2*
t9);
153 Kfusion[11] = -t26*(
P[11][7]*t4*t9+
P[11][8]*t3*t9+
P[11][9]*t2*
t9);
154 Kfusion[12] = -t26*(
P[12][7]*t4*t9+
P[12][8]*t3*t9+
P[12][9]*t2*
t9);
157 memset(&Kfusion[10], 0, 12);
161 Kfusion[13] = -t26*(
P[13][7]*t4*t9+
P[13][8]*t3*t9+
P[13][9]*t2*
t9);
162 Kfusion[14] = -t26*(
P[14][7]*t4*t9+
P[14][8]*t3*t9+
P[14][9]*t2*
t9);
163 Kfusion[15] = -t26*(
P[15][7]*t4*t9+
P[15][8]*t3*t9+
P[15][9]*t2*
t9);
166 memset(&Kfusion[13], 0, 12);
171 Kfusion[6] = -t26*(
P[6][7]*t4*t9+
P[6][8]*t3*t9+
P[6][9]*t2*
t9);
172 Kfusion[9] = -t26*(t10+
P[9][7]*t4*t9+
P[9][8]*t3*
t9);
179 Kfusion[16] = -t26*(
P[16][7]*t4*t9+
P[16][8]*t3*t9+
P[16][9]*t2*
t9);
180 Kfusion[17] = -t26*(
P[17][7]*t4*t9+
P[17][8]*t3*t9+
P[17][9]*t2*
t9);
181 Kfusion[18] = -t26*(
P[18][7]*t4*t9+
P[18][8]*t3*t9+
P[18][9]*t2*
t9);
182 Kfusion[19] = -t26*(
P[19][7]*t4*t9+
P[19][8]*t3*t9+
P[19][9]*t2*
t9);
183 Kfusion[20] = -t26*(
P[20][7]*t4*t9+
P[20][8]*t3*t9+
P[20][9]*t2*
t9);
184 Kfusion[21] = -t26*(
P[21][7]*t4*t9+
P[21][8]*t3*t9+
P[21][9]*t2*
t9);
187 memset(&Kfusion[16], 0, 24);
191 Kfusion[22] = -t26*(
P[22][7]*t4*t9+
P[22][8]*t3*t9+
P[22][9]*t2*
t9);
192 Kfusion[23] = -t26*(
P[23][7]*t4*t9+
P[23][8]*t3*t9+
P[23][9]*t2*
t9);
195 memset(&Kfusion[22], 0, 8);
218 for (
unsigned j = 0; j<=6; j++) {
221 for (
unsigned j = 7; j<=9; j++) {
222 KH[i][j] = Kfusion[i] * H_BCN[j];
224 for (
unsigned j = 10; j<=23; j++) {
231 res +=
KH[i][7] *
P[7][j];
232 res +=
KH[i][8] * P[8][j];
233 res +=
KH[i][9] * P[9][j];
238 bool healthyFusion =
true;
240 if (
KHP[i][i] >
P[i][i]) {
241 healthyFusion =
false;
248 P[i][j] =
P[i][j] -
KHP[i][j];
366 float receverPosDownMax;
367 float receverPosDownMin;
385 for (uint8_t i= 0; i<=2; i++) {
401 float t9 = 1.0f/sqrtf(t8);
412 H_RNG[0] = -t9*t11*0.5f;
413 H_RNG[1] = -t9*t13*0.5f;
414 H_RNG[2] = -t9*t17*0.5f;
422 float t24 = t9*t13*t23*0.5f;
427 float t29 = t9*t17*t28*0.5f;
431 float t33 = t9*t11*t32*0.5f;
459 for (
unsigned i = 0; i<=2; i++) {
460 for (
unsigned j = 0; j<=2; j++) {
461 KH[i][j] = K_RNG[i] * H_RNG[j];
464 for (
unsigned j = 0; j<=2; j++) {
465 for (
unsigned i = 0; i<=2; i++) {
468 res +=
KH[i][1] * receiverPosCov[1][j];
469 res +=
KH[i][2] * receiverPosCov[2][j];
475 for (uint8_t i= 0; i<=2; i++) {
485 for (uint8_t i= 0; i<=2; i++) {
486 for (uint8_t j= 0; j<=2; j++) {
492 for (uint8_t i=1; i<=2; i++) {
493 for (uint8_t j=0; j<=i-1; j++) {
533 const float stateNoiseVar = 0.1f;
534 const float filtAlpha = 0.1f;
535 const float innovGateWidth = 5.0f;
560 innovVar =
MAX(innovVar, obsVar);
566 float stateChange = innov * gain;
570 if ((
sq(innov) <
sq(innovGateWidth) *
innovVar) || aligning) {
577 bcnPosOffsetMaxVar =
MAX(bcnPosOffsetMaxVar, 0.0
f);
599 innovVar =
MAX(innovVar, obsVar);
605 float stateChange = innov * gain;
609 if ((
sq(innov) <
sq(innovGateWidth) *
innovVar) || aligning) {
616 bcnPosOffsetMinVar =
MAX(bcnPosOffsetMinVar, 0.0
f);
644 #endif // HAL_CPU_CLASS
void CalcRangeBeaconPosDownOffset(float obsVar, Vector3f &vehiclePosNED, bool aligning)
float maxOffsetStateChangeFilt
Interface definition for the various Ground Control System.
AP_Int16 _rngBcnInnovGate
bool rngBcnAlignmentStarted
struct NavEKF3_core::@153 faultStatus
uint32_t lastRngBcnPassTime_ms
static auto MAX(const A &one, const B &two) -> decltype(one > two ? one :two)
struct NavEKF3_core::state_elements & stateStruct
bool inhibitDelAngBiasStates
float bcnPosDownOffsetMax
float minOffsetStateChangeFilt
float receiverPosCov[3][3]
struct NavEKF3_core::@152 rngBcnFusionReport[10]
bool inhibitDelVelBiasStates
struct nav_filter_status::@138 flags
bool rngBcnAlignmentCompleted
void ConstrainVariances()
nav_filter_status filterStatus
const AP_HAL::HAL & hal
-*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
rng_bcn_elements rngBcnDataDelayed
uint32_t imuSampleTime_ms
void SelectRngBcnFusion()
float bcnPosDownOffsetMin