59 y = fabsf(x[ix0 - 1]);
61 scale = 1.17549435E-38F;
63 for (k = ix0; k <= kend; k++) {
64 absxk = fabsf(x[k - 1]);
101 for (i = 0; i < 7; i++) {
105 for (i = 0; i < 7; i++) {
109 xnorm =
xnrm2_f(20 - i, A, i_i + 2);
111 xnorm = hypotf(A[i_i], xnorm);
112 if (A[i_i] >= 0.0F) {
116 if (fabsf(xnorm) < 9.86076132
E-32F) {
120 lastv = (i_i - i) + 21;
121 for (lastc = i_i + 1; lastc + 1 <= lastv; lastc++) {
122 A[lastc] *= 1.01412048E+31F;
125 xnorm *= 1.01412048E+31F;
126 b_atmp *= 1.01412048E+31F;
127 }
while (!(fabsf(xnorm) >= 9.86076132
E-32F));
129 xnorm = hypotf(b_atmp,
xnrm2_f(20 - i, A, i_i + 2));
130 if (b_atmp >= 0.0F) {
134 b_c = (xnorm - b_atmp) / xnorm;
135 b_atmp = 1.0F / (b_atmp - xnorm);
136 lastv = (i_i - i) + 21;
137 for (lastc = i_i + 1; lastc + 1 <= lastv; lastc++) {
141 for (lastv = 1; lastv <= knt; lastv++) {
142 xnorm *= 9.86076132E-32F;
147 b_c = (xnorm - A[i_i]) / xnorm;
148 b_atmp = 1.0F / (A[i_i] - xnorm);
149 knt = (i_i - i) + 21;
150 for (lastv = i_i + 1; lastv + 1 <= knt; lastv++) {
163 knt = (i + 1) * 21 + i;
164 if (tau[i] != 0.0F) {
166 lastc = (i_i - i) + 20;
167 while ((lastv > 0) && (A[lastc] == 0.0F)) {
174 while ((!exitg2) && (lastc > 0)) {
175 iy = ((lastc - 1) * 21 + knt) + 1;
179 if (f <= (iy + lastv) - 1) {
180 if (A[f - 1] != 0.0F) {
202 for (iy = 1; iy <= lastc; iy++) {
207 f = ((lastc - 1) * 21 + knt) + 1;
208 for (b_ix = knt + 1; b_ix <= f; b_ix += 21) {
211 g = (b_ix + lastv) - 1;
212 for (b_ia = b_ix; b_ia <= g; b_ia++) {
213 b_c += A[b_ia - 1] * A[ix];
222 if (!(-tau[i] == 0.0F)) {
224 for (f = 1; f <= lastc; f++) {
225 if (work[iy] != 0.0F) {
226 b_c = work[iy] * -tau[i];
229 for (g = knt; g + 1 <= ix; g++) {
230 A[g] += A[b_ix] * b_c;
264 memcpy(&Q[0], &A[0], 147U *
sizeof(
real32_T));
266 for (itau = 0; itau < 7; itau++) {
267 for (c_i = 0; c_i + 1 <= itau + 1; c_i++) {
268 R[c_i + 7 * itau] = Q[21 * itau + c_i];
271 for (c_i = itau + 1; c_i + 1 < 8; c_i++) {
272 R[c_i + 7 * itau] = 0.0F;
279 for (c_i = 6; c_i >= 0; c_i += -1) {
280 iaii = (c_i * 21 + c_i) + 1;
283 if (tau[itau] != 0.0F) {
285 lastc = (iaii - c_i) + 19;
286 while ((lastv > 0) && (Q[lastc] == 0.0F)) {
293 while ((!exitg2) && (lastc > 0)) {
294 iy = (lastc - 1) * 21 + iaii;
298 if (jy + 21 <= (iy + lastv) + 20) {
299 if (Q[jy + 20] != 0.0F) {
321 for (iy = 1; iy <= lastc; iy++) {
326 jy = ((lastc - 1) * 21 + iaii) + 21;
327 for (iac = iaii + 21; iac <= jy; iac += 21) {
330 d = (iac + lastv) - 1;
331 for (b_ia = iac; b_ia <= d; b_ia++) {
332 c += Q[b_ia - 1] * Q[ix - 1];
341 if (!(-tau[itau] == 0.0F)) {
344 for (iac = 1; iac <= lastc; iac++) {
345 if (work[jy] != 0.0F) {
346 c = work[jy] * -tau[itau];
349 for (b_ia = iy; b_ia + 1 <= d; b_ia++) {
350 Q[b_ia] += Q[ix - 1] * c;
362 lastv = (iaii - c_i) + 20;
363 for (lastc = iaii; lastc + 1 <= lastv; lastc++) {
364 Q[lastc] *= -tau[itau];
367 Q[iaii - 1] = 1.0F - tau[itau];
368 for (lastv = 1; lastv <= c_i; lastv++) {
369 Q[(iaii - lastv) - 1] = 0.0F;
388 y = fabsf(x[ix0 - 1]);
390 scale = 1.17549435E-38F;
391 kend = (ix0 + n) - 1;
392 for (k = ix0; k <= kend; k++) {
393 absxk = fabsf(x[k - 1]);
396 y = y * t * t + 1.0F;
404 y = scale * sqrtf(y);
430 for (i = 0; i < 6; i++) {
434 for (i = 0; i < 6; i++) {
438 xnorm =
xnrm2(19 - i, A, i_i + 2);
440 xnorm = hypotf(A[i_i], xnorm);
441 if (A[i_i] >= 0.0F) {
445 if (fabsf(xnorm) < 9.86076132
E-32F) {
449 lastv = (i_i - i) + 20;
450 for (lastc = i_i + 1; lastc + 1 <= lastv; lastc++) {
451 A[lastc] *= 1.01412048E+31F;
454 xnorm *= 1.01412048E+31F;
455 b_atmp *= 1.01412048E+31F;
456 }
while (!(fabsf(xnorm) >= 9.86076132
E-32F));
458 xnorm = hypotf(b_atmp,
xnrm2(19 - i, A, i_i + 2));
459 if (b_atmp >= 0.0F) {
463 b_c = (xnorm - b_atmp) / xnorm;
464 b_atmp = 1.0F / (b_atmp - xnorm);
465 lastv = (i_i - i) + 20;
466 for (lastc = i_i + 1; lastc + 1 <= lastv; lastc++) {
470 for (lastv = 1; lastv <= knt; lastv++) {
471 xnorm *= 9.86076132E-32F;
476 b_c = (xnorm - A[i_i]) / xnorm;
477 b_atmp = 1.0F / (A[i_i] - xnorm);
478 knt = (i_i - i) + 20;
479 for (lastv = i_i + 1; lastv + 1 <= knt; lastv++) {
492 knt = (i + 1) * 20 + i;
493 if (tau[i] != 0.0F) {
495 lastc = (i_i - i) + 19;
496 while ((lastv > 0) && (A[lastc] == 0.0F)) {
503 while ((!exitg2) && (lastc > 0)) {
504 iy = ((lastc - 1) * 20 + knt) + 1;
508 if (f <= (iy + lastv) - 1) {
509 if (A[f - 1] != 0.0F) {
531 for (iy = 1; iy <= lastc; iy++) {
536 f = ((lastc - 1) * 20 + knt) + 1;
537 for (b_ix = knt + 1; b_ix <= f; b_ix += 20) {
540 g = (b_ix + lastv) - 1;
541 for (b_ia = b_ix; b_ia <= g; b_ia++) {
542 b_c += A[b_ia - 1] * A[ix];
551 if (!(-tau[i] == 0.0F)) {
553 for (f = 1; f <= lastc; f++) {
554 if (work[iy] != 0.0F) {
555 b_c = work[iy] * -tau[i];
558 for (g = knt; g + 1 <= ix; g++) {
559 A[g] += A[b_ix] * b_c;
593 memcpy(&Q[0], &A[0], 120U *
sizeof(
real32_T));
595 for (itau = 0; itau < 6; itau++) {
596 for (c_i = 0; c_i + 1 <= itau + 1; c_i++) {
597 R[c_i + 6 * itau] = Q[20 * itau + c_i];
600 for (c_i = itau + 1; c_i + 1 < 7; c_i++) {
601 R[c_i + 6 * itau] = 0.0F;
608 for (c_i = 5; c_i >= 0; c_i += -1) {
609 iaii = (c_i * 20 + c_i) + 1;
612 if (tau[itau] != 0.0F) {
614 lastc = (iaii - c_i) + 18;
615 while ((lastv > 0) && (Q[lastc] == 0.0F)) {
622 while ((!exitg2) && (lastc > 0)) {
623 iy = (lastc - 1) * 20 + iaii;
627 if (jy + 20 <= (iy + lastv) + 19) {
628 if (Q[jy + 19] != 0.0F) {
650 for (iy = 1; iy <= lastc; iy++) {
655 jy = ((lastc - 1) * 20 + iaii) + 20;
656 for (iac = iaii + 20; iac <= jy; iac += 20) {
659 d = (iac + lastv) - 1;
660 for (b_ia = iac; b_ia <= d; b_ia++) {
661 c += Q[b_ia - 1] * Q[ix - 1];
670 if (!(-tau[itau] == 0.0F)) {
673 for (iac = 1; iac <= lastc; iac++) {
674 if (work[jy] != 0.0F) {
675 c = work[jy] * -tau[itau];
678 for (b_ia = iy; b_ia + 1 <= d; b_ia++) {
679 Q[b_ia] += Q[ix - 1] * c;
691 lastv = (iaii - c_i) + 19;
692 for (lastc = iaii; lastc + 1 <= lastv; lastc++) {
693 Q[lastc] *= -tau[itau];
696 Q[iaii - 1] = 1.0F - tau[itau];
697 for (lastv = 1; lastv <= c_i; lastv++) {
698 Q[(iaii - lastv) - 1] = 0.0F;
720 memcpy(&b_A[0], &B_0[0], 36U *
sizeof(
real32_T));
721 for (j = 0; j < 6; j++) {
722 ipiv[j] = (
int8_T)(1 + j);
725 for (j = 0; j < 5; j++) {
729 temp = fabsf(b_A[jp]);
730 for (b_kBcol = 2; b_kBcol <= 6 - j; b_kBcol++) {
734 b_jAcol = b_kBcol - 1;
739 if (b_A[jp + b_jAcol] != 0.0F) {
741 ipiv[j] = (
int8_T)((j + b_jAcol) + 1);
744 for (b_kBcol = 0; b_kBcol < 6; b_kBcol++) {
746 b_A[ix] = b_A[b_jAcol];
753 b_jAcol = (jp - j) + 6;
754 for (ix = jp + 1; ix + 1 <= b_jAcol; ix++) {
761 for (b_kBcol = 1; b_kBcol <= 5 - j; b_kBcol++) {
763 if (b_A[ix] != 0.0F) {
765 d = (b_jAcol - j) + 12;
766 for (ijA = 7 + b_jAcol; ijA + 1 <= d; ijA++) {
767 b_A[ijA] += b_A[c_ix] * -temp;
777 for (j = 0; j < 6; j++) {
780 for (ix = 1; ix <= j; ix++) {
781 b_kBcol = (ix - 1) * 7;
782 if (b_A[(ix + b_jAcol) - 1] != 0.0F) {
783 for (c_ix = 0; c_ix < 7; c_ix++) {
784 A[c_ix + jp] -= b_A[(ix + b_jAcol) - 1] * A[c_ix + b_kBcol];
789 temp = 1.0F / b_A[j + b_jAcol];
790 for (b_jAcol = 0; b_jAcol < 7; b_jAcol++) {
791 A[b_jAcol + jp] *= temp;
795 for (j = 5; j >= 0; j += -1) {
798 for (ix = j + 2; ix < 7; ix++) {
799 b_kBcol = (ix - 1) * 7;
800 if (b_A[ix + b_jAcol] != 0.0F) {
801 for (c_ix = 0; c_ix < 7; c_ix++) {
802 A[c_ix + jp] -= b_A[ix + b_jAcol] * A[c_ix + b_kBcol];
808 for (j = 4; j >= 0; j += -1) {
809 if (j + 1 != ipiv[j]) {
811 for (b_jAcol = 0; b_jAcol < 7; b_jAcol++) {
812 temp = A[7 * j + b_jAcol];
813 A[b_jAcol + 7 * j] = A[7 * jp + b_jAcol];
814 A[b_jAcol + 7 * jp] = temp;
848 scale = 1.17549435E-38F;
850 if (beta > 1.17549435
E-38F) {
854 t = beta / 1.17549435E-38F;
861 Vair = Vair * t * t + 1.0F;
871 Vair = Vair * t * t + 1.0F;
878 Vair = scale * sqrtf(Vair);
883 scale = ((q[0] * q[0] + q[1] * q[1]) + q[2] * q[2]) + q[3] * q[3];
885 qinv_idx_1 = -q[1] /
scale;
886 qinv_idx_2 = -q[2] /
scale;
887 qinv_idx_3 = -q[3] /
scale;
888 qinter_idx_0 = -((q[1] * x[0] + q[2] * x[1]) + q[3] * x[2]);
889 qinter_idx_1 = (q[2] * x[2] - q[3] * x[1]) + x[0] * q[0];
890 qinter_idx_2 = (q[3] * x[0] - q[1] * x[2]) + x[1] * q[0];
891 qinter_idx_3 = (q[1] * x[1] - q[2] * x[0]) + x[2] * q[0];
896 scale = atan2f(x[2], x[0]);
899 beta = asinf(x[1] / Vair);
905 y[0] = (((qinter_idx_2 * qinv_idx_3 - qinter_idx_3 * qinv_idx_2) +
906 qinter_idx_1 * t) + qinv_idx_1 * qinter_idx_0) + x[3];
907 y[1] = (((qinter_idx_3 * qinv_idx_1 - qinter_idx_1 * qinv_idx_3) +
908 qinter_idx_2 * t) + qinv_idx_2 * qinter_idx_0) + x[4];
909 y[2] = (((qinter_idx_1 * qinv_idx_2 - qinter_idx_2 * qinv_idx_1) +
910 qinter_idx_3 * t) + qinv_idx_3 * qinter_idx_0) + x[5];
953 for (i = 0; i < 7; i++) {
959 xi[0] = (u[2] * x[1] + u[3]) - u[1] * x[2];
960 xi[1] = (u[0] * x[2] + u[4]) - u[2] * x[0];
961 xi[2] = (u[1] * x[0] + u[5]) - u[0] * x[1];
989 for (i = 0; i < 7; i++) {
990 b_x[i] = xi[i] / 2.0F * dt + x[i];
996 k2[0] = (u[2] * b_x[1] + u[3]) - u[1] * b_x[2];
997 k2[1] = (u[0] * b_x[2] + u[4]) - u[2] * b_x[0];
998 k2[2] = (u[1] * b_x[0] + u[5]) - u[0] * b_x[1];
1026 for (i = 0; i < 7; i++) {
1027 b_x[i] = k2[i] / 2.0F * dt + x[i];
1033 k3[0] = (u[2] * b_x[1] + u[3]) - u[1] * b_x[2];
1034 k3[1] = (u[0] * b_x[2] + u[4]) - u[2] * b_x[0];
1035 k3[2] = (u[1] * b_x[0] + u[5]) - u[0] * b_x[1];
1063 for (i = 0; i < 7; i++) {
1064 b_x[i] = dt * k3[i] + x[i];
1070 k4[0] = (u[2] * b_x[1] + u[3]) - u[1] * b_x[2];
1071 k4[1] = (u[0] * b_x[2] + u[4]) - u[2] * b_x[0];
1072 k4[2] = (u[1] * b_x[0] + u[5]) - u[0] * b_x[1];
1082 for (i = 0; i < 7; i++) {
1083 xi[i] = (((k2[i] + k3[i]) * 2.0F + xi[i]) + k4[i]) * y + x[i];
1148 memcpy(&SQ[0], &(ukf_init.
P0[0]), 49U *
sizeof(
real32_T));
1153 while ((!exitg1) && (b_j < 8)) {
1154 jj = (colj + b_j) - 1;
1156 if (!(b_j - 1 < 1)) {
1159 for (i = 1; i < b_j; i++) {
1160 lambda += SQ[ix] * SQ[iy];
1166 ajj = SQ[jj] - lambda;
1173 ix = ((6 - b_j) * 7 + colj) + 8;
1174 for (iy = colj + 8; iy <= ix; iy += 7) {
1178 for (ia = iy; ia <= e; ia++) {
1179 lambda += SQ[ia - 1] * SQ[b_ix];
1183 SQ[b_iy] += -lambda;
1188 lambda = 1.0F / ajj;
1189 ix = ((6 - b_j) * 7 + jj) + 8;
1190 for (b_iy = jj + 7; b_iy + 1 <= ix; b_iy += 7) {
1211 for (b_j = 0; b_j + 1 <= jmax; b_j++) {
1212 for (colj = b_j + 1; colj + 1 <= jmax; colj++) {
1213 SQ[colj + 7 * b_j] = 0.0F;
1217 for (jmax = 0; jmax < 7; jmax++) {
1218 for (b_j = 0; b_j < 7; b_j++) {
1219 rtb_P1[b_j + 7 * jmax] = SQ[7 * b_j + jmax];
1232 for (i = 0; i < 7; i++) {
1233 rtb_x1[i] = ukf_init.
x0[i];
1239 for (i = 0; i < 7; i++) {
1256 lambda = ukf_init.
alpha * ukf_init.
alpha * (7.0F + ukf_init.
ki) - 7.0F;
1261 ajj = 0.5F / (7.0F + lambda);
1262 rtb_Wm[0] = lambda / (7.0F + lambda);
1263 for (i = 0; i < 14; i++) {
1264 rtb_Wm[i + 1] = ajj;
1268 for (i = 0; i < 15; i++) {
1269 rtb_Wc[i] = rtb_Wm[i];
1273 rtb_Wc[0] = ((1.0F - ukf_init.
alpha * ukf_init.
alpha) + ukf_init.
beta) +
1279 lambda = sqrtf(7.0F + lambda);
1295 for (jmax = 0; jmax < 49; jmax++) {
1296 SQ[jmax] = lambda * rtb_P1[jmax];
1303 for (jmax = 0; jmax < 7; jmax++) {
1304 for (b_j = 0; b_j < 7; b_j++) {
1305 Y[b_j + 7 * jmax] = rtb_x1[b_j];
1308 rtb_X[jmax] = rtb_x1[jmax];
1311 for (jmax = 0; jmax < 49; jmax++) {
1312 rtb_X[jmax + 7] = Y[jmax] + SQ[jmax];
1313 rtb_X[jmax + 56] = Y[jmax] - SQ[jmax];
1350 for (i = 0; i < 7; i++) {
1355 memset(&rtb_Y[0], 0, 105U *
sizeof(
real32_T));
1358 u[0] = ukf_U.
rates[0];
1359 u[3] = ukf_U.
accel[0];
1360 u[1] = ukf_U.
rates[1];
1361 u[4] = ukf_U.
accel[1];
1362 u[2] = ukf_U.
rates[2];
1363 u[5] = ukf_U.
accel[2];
1366 for (i = 0; i < 15; i++) {
1369 RungeKutta(&rtb_X[7 * i], ukf_params.
dt, u, &rtb_Y[7 * i]);
1373 for (jmax = 0; jmax < 7; jmax++) {
1374 rtb_x1[jmax] += rtb_Y[7 * i + jmax] * rtb_Wm[i];
1383 for (b_iy = 0; b_iy < 49; b_iy++) {
1384 SQ[b_iy] = sqrtf(ukf_params.
Q[b_iy]);
1389 lambda = sqrtf(rtb_Wm[1]);
1394 for (jmax = 0; jmax < 7; jmax++) {
1395 for (b_j = 0; b_j < 14; b_j++) {
1396 lambda_1[b_j + 21 * jmax] = (rtb_Y[(1 + b_j) * 7 + jmax] - rtb_x1[jmax]) *
1401 for (jmax = 0; jmax < 7; jmax++) {
1402 for (b_j = 0; b_j < 7; b_j++) {
1403 lambda_1[(b_j + 21 * jmax) + 14] = SQ[7 * b_j + jmax];
1407 qr_e(lambda_1, unusedU0, SQ);
1410 for (jmax = 0; jmax < 7; jmax++) {
1411 p[jmax] = rtb_Y[jmax] - rtb_x1[jmax];
1414 if (rtb_Wc[0] < 0.0F) {
1417 lambda = powf(-rtb_Wc[0], 0.25F);
1418 ajj = powf(-rtb_Wc[0], 0.25F);
1419 for (jmax = 0; jmax < 7; jmax++) {
1420 for (b_j = 0; b_j < 7; b_j++) {
1421 Y[jmax + 7 * b_j] = 0.0F;
1422 for (colj = 0; colj < 7; colj++) {
1423 Y[jmax + 7 * b_j] += SQ[7 * jmax + colj] * SQ[7 * b_j + colj];
1426 lambda_2[jmax + 7 * b_j] = lambda * p[jmax] * (ajj * p[b_j]);
1430 for (jmax = 0; jmax < 7; jmax++) {
1431 for (b_j = 0; b_j < 7; b_j++) {
1432 rtb_P1[b_j + 7 * jmax] = Y[7 * jmax + b_j] - lambda_2[7 * jmax + b_j];
1440 while ((!exitg1) && (jmax < 8)) {
1441 colj = (i + jmax) - 1;
1443 if (!(jmax - 1 < 1)) {
1446 for (ix = 1; ix < jmax; ix++) {
1447 lambda += rtb_P1[jj] * rtb_P1[b_iy];
1453 lambda = rtb_P1[colj] - lambda;
1454 if (lambda > 0.0F) {
1455 lambda = sqrtf(lambda);
1456 rtb_P1[colj] = lambda;
1458 if (jmax - 1 != 0) {
1460 b_iy = ((6 - jmax) * 7 + i) + 8;
1461 for (ix = i + 8; ix <= b_iy; ix += 7) {
1464 b_ix = (ix + jmax) - 2;
1465 for (e = ix; e <= b_ix; e++) {
1466 ajj += rtb_P1[e - 1] * rtb_P1[iy];
1475 lambda = 1.0F / lambda;
1476 jj = ((6 - jmax) * 7 + colj) + 8;
1477 for (colj += 7; colj + 1 <= jj; colj += 7) {
1478 rtb_P1[colj] *= lambda;
1486 rtb_P1[colj] = lambda;
1498 for (b_j = 0; b_j + 1 <= i; b_j++) {
1499 for (jmax = b_j + 1; jmax + 1 <= i; jmax++) {
1500 rtb_P1[jmax + 7 * b_j] = 0.0F;
1505 lambda = powf(rtb_Wc[0], 0.25F);
1506 ajj = powf(rtb_Wc[0], 0.25F);
1507 for (jmax = 0; jmax < 7; jmax++) {
1508 for (b_j = 0; b_j < 7; b_j++) {
1509 Y[jmax + 7 * b_j] = 0.0F;
1510 for (colj = 0; colj < 7; colj++) {
1511 Y[jmax + 7 * b_j] += SQ[7 * jmax + colj] * SQ[7 * b_j + colj];
1514 lambda_2[jmax + 7 * b_j] = lambda * p[jmax] * (ajj * p[b_j]);
1518 for (jmax = 0; jmax < 7; jmax++) {
1519 for (b_j = 0; b_j < 7; b_j++) {
1520 rtb_P1[b_j + 7 * jmax] = Y[7 * jmax + b_j] + lambda_2[7 * jmax + b_j];
1528 while ((!exitg1) && (b_j < 8)) {
1529 jj = (colj + b_j) - 1;
1531 if (!(b_j - 1 < 1)) {
1534 for (b_iy = 1; b_iy < b_j; b_iy++) {
1535 lambda += rtb_P1[ix] * rtb_P1[iy];
1541 ajj = rtb_P1[jj] - lambda;
1548 ix = ((6 - b_j) * 7 + colj) + 8;
1549 for (iy = colj + 8; iy <= ix; iy += 7) {
1553 for (ia = iy; ia <= e; ia++) {
1554 lambda += rtb_P1[ia - 1] * rtb_P1[b_ix];
1558 rtb_P1[b_iy] += -lambda;
1563 lambda = 1.0F / ajj;
1564 ix = ((6 - b_j) * 7 + jj) + 8;
1565 for (i = jj + 7; i + 1 <= ix; i += 7) {
1566 rtb_P1[i] *= lambda;
1586 for (b_j = 0; b_j + 1 <= jmax; b_j++) {
1587 for (colj = b_j + 1; colj + 1 <= jmax; colj++) {
1588 rtb_P1[colj + 7 * b_j] = 0.0F;
1627 for (i = 0; i < 6; i++) {
1635 for (i = 0; i < 15; i++) {
1639 h(&rtb_Y[7 * i], ukf_U.
q, u);
1640 for (jmax = 0; jmax < 6; jmax++) {
1641 rtb_Z[jmax + 6 * i] = u[jmax];
1646 for (jmax = 0; jmax < 6; jmax++) {
1647 rtb_z[jmax] += rtb_Z[6 * i + jmax] * rtb_Wm[i];
1656 for (b_iy = 0; b_iy < 36; b_iy++) {
1657 SR[b_iy] = sqrtf(ukf_params.
R[b_iy]);
1662 lambda = sqrtf(rtb_Wm[1]);
1669 for (jmax = 0; jmax < 6; jmax++) {
1670 for (b_j = 0; b_j < 14; b_j++) {
1671 lambda_0[b_j + 20 * jmax] = (rtb_Z[(1 + b_j) * 6 + jmax] - rtb_z[jmax]) *
1676 for (jmax = 0; jmax < 6; jmax++) {
1677 for (b_j = 0; b_j < 6; b_j++) {
1678 lambda_0[(b_j + 20 * jmax) + 14] = SR[6 * b_j + jmax];
1682 qr(lambda_0, unusedU0_0, SR);
1686 for (jmax = 0; jmax < 6; jmax++) {
1687 u[jmax] = rtb_Z[jmax] - rtb_z[jmax];
1691 if (rtb_Wc[0] < 0.0F) {
1694 lambda = powf(-rtb_Wc[0], 0.25F);
1695 ajj = powf(-rtb_Wc[0], 0.25F);
1696 for (jmax = 0; jmax < 6; jmax++) {
1697 for (b_j = 0; b_j < 6; b_j++) {
1698 SR_0[jmax + 6 * b_j] = 0.0F;
1699 for (colj = 0; colj < 6; colj++) {
1700 SR_0[jmax + 6 * b_j] += SR[6 * jmax + colj] * SR[6 * b_j + colj];
1703 lambda_3[jmax + 6 * b_j] = lambda * u[jmax] * (ajj * u[b_j]);
1707 for (jmax = 0; jmax < 6; jmax++) {
1708 for (b_j = 0; b_j < 6; b_j++) {
1709 SR[b_j + 6 * jmax] = SR_0[6 * jmax + b_j] - lambda_3[6 * jmax + b_j];
1717 while ((!exitg1) && (jmax < 7)) {
1718 colj = (i + jmax) - 1;
1720 if (!(jmax - 1 < 1)) {
1723 for (ix = 1; ix < jmax; ix++) {
1724 lambda += SR[jj] * SR[b_iy];
1730 lambda = SR[colj] - lambda;
1731 if (lambda > 0.0F) {
1732 lambda = sqrtf(lambda);
1735 if (jmax - 1 != 0) {
1737 b_iy = ((5 - jmax) * 6 + i) + 7;
1738 for (ix = i + 7; ix <= b_iy; ix += 6) {
1741 b_ix = (ix + jmax) - 2;
1742 for (e = ix; e <= b_ix; e++) {
1743 ajj += SR[e - 1] * SR[iy];
1752 lambda = 1.0F / lambda;
1753 jj = ((5 - jmax) * 6 + colj) + 7;
1754 for (colj += 6; colj + 1 <= jj; colj += 6) {
1775 for (b_j = 0; b_j + 1 <= i; b_j++) {
1776 for (jmax = b_j + 1; jmax + 1 <= i; jmax++) {
1777 SR[jmax + 6 * b_j] = 0.0F;
1782 lambda = powf(rtb_Wc[0], 0.25F);
1783 ajj = powf(rtb_Wc[0], 0.25F);
1784 for (jmax = 0; jmax < 6; jmax++) {
1785 for (b_j = 0; b_j < 6; b_j++) {
1786 SR_0[jmax + 6 * b_j] = 0.0F;
1787 for (colj = 0; colj < 6; colj++) {
1788 SR_0[jmax + 6 * b_j] += SR[6 * jmax + colj] * SR[6 * b_j + colj];
1791 lambda_3[jmax + 6 * b_j] = lambda * u[jmax] * (ajj * u[b_j]);
1795 for (jmax = 0; jmax < 6; jmax++) {
1796 for (b_j = 0; b_j < 6; b_j++) {
1797 SR[b_j + 6 * jmax] = SR_0[6 * jmax + b_j] + lambda_3[6 * jmax + b_j];
1805 while ((!exitg1) && (b_j < 7)) {
1806 jj = (colj + b_j) - 1;
1808 if (!(b_j - 1 < 1)) {
1811 for (b_iy = 1; b_iy < b_j; b_iy++) {
1812 lambda += SR[ix] * SR[iy];
1818 ajj = SR[jj] - lambda;
1825 ix = ((5 - b_j) * 6 + colj) + 7;
1826 for (iy = colj + 7; iy <= ix; iy += 6) {
1830 for (ia = iy; ia <= e; ia++) {
1831 lambda += SR[ia - 1] * SR[b_ix];
1835 SR[b_iy] += -lambda;
1840 lambda = 1.0F / ajj;
1841 ix = ((5 - b_j) * 6 + jj) + 7;
1842 for (i = jj + 6; i + 1 <= ix; i += 6) {
1863 for (b_j = 0; b_j + 1 <= jmax; b_j++) {
1864 for (colj = b_j + 1; colj + 1 <= jmax; colj++) {
1865 SR[colj + 6 * b_j] = 0.0F;
1872 for (jmax = 0; jmax < 6; jmax++) {
1873 for (b_j = 0; b_j < 6; b_j++) {
1874 SR_0[b_j + 6 * jmax] = SR[6 * b_j + jmax];
1878 for (jmax = 0; jmax < 6; jmax++) {
1879 for (b_j = 0; b_j < 6; b_j++) {
1880 SR[b_j + 6 * jmax] = SR_0[6 * jmax + b_j];
1892 memcpy(&Y[0], &rtb_P1[0], 49U *
sizeof(
real32_T));
1901 memset(&d[0], 0, 225U *
sizeof(
real32_T));
1906 for (b_j = 0; b_j < 15; b_j++) {
1907 d[b_j + 15 * b_j] = rtb_Wc[b_j];
1908 for (jmax = 0; jmax < 7; jmax++) {
1909 rtb_X[jmax + 7 * b_j] = rtb_Y[7 * b_j + jmax] - rtb_x1[jmax];
1913 for (jmax = 0; jmax < 7; jmax++) {
1914 for (b_j = 0; b_j < 15; b_j++) {
1915 rtb_Y[jmax + 7 * b_j] = 0.0F;
1916 for (colj = 0; colj < 15; colj++) {
1917 rtb_Y[jmax + 7 * b_j] += rtb_X[7 * colj + jmax] * d[15 * b_j + colj];
1922 for (jmax = 0; jmax < 6; jmax++) {
1923 for (b_j = 0; b_j < 15; b_j++) {
1924 rtb_Z_0[b_j + 15 * jmax] = rtb_Z[6 * b_j + jmax] - rtb_z[jmax];
1928 for (jmax = 0; jmax < 7; jmax++) {
1929 for (b_j = 0; b_j < 6; b_j++) {
1930 K[jmax + 7 * b_j] = 0.0F;
1931 for (colj = 0; colj < 15; colj++) {
1932 K[jmax + 7 * b_j] += rtb_Y[7 * colj + jmax] * rtb_Z_0[15 * b_j + colj];
1937 for (jmax = 0; jmax < 6; jmax++) {
1938 for (b_j = 0; b_j < 6; b_j++) {
1939 SR_0[b_j + 6 * jmax] = SR[6 * b_j + jmax];
1952 for (jmax = 0; jmax < 7; jmax++) {
1953 for (b_j = 0; b_j < 6; b_j++) {
1954 U[jmax + 7 * b_j] = 0.0F;
1955 for (colj = 0; colj < 6; colj++) {
1956 U[jmax + 7 * b_j] += K[7 * colj + jmax] * SR[6 * b_j + colj];
1966 tmp[0] = ukf_U.
vk[0];
1967 tmp[1] = ukf_U.
vk[1];
1968 tmp[2] = ukf_U.
vk[2];
1972 for (i = 0; i < 6; i++) {
1975 for (jmax = 0; jmax < 7; jmax++) {
1976 for (b_j = 0; b_j < 7; b_j++) {
1977 rtb_P1[jmax + 7 * b_j] = 0.0F;
1978 for (colj = 0; colj < 7; colj++) {
1979 rtb_P1[jmax + 7 * b_j] += Y[7 * jmax + colj] * Y[7 * b_j + colj];
1982 lambda_2[jmax + 7 * b_j] = U[7 * i + jmax] * U[7 * i + b_j];
1986 for (jmax = 0; jmax < 7; jmax++) {
1987 for (b_j = 0; b_j < 7; b_j++) {
1988 SQ[b_j + 7 * jmax] = rtb_P1[7 * jmax + b_j] - lambda_2[7 * jmax + b_j];
1996 while ((!exitg1) && (b_j < 8)) {
1997 jj = (colj + b_j) - 1;
1999 if (!(b_j - 1 < 1)) {
2002 for (b_iy = 1; b_iy < b_j; b_iy++) {
2003 lambda += SQ[ix] * SQ[iy];
2009 ajj = SQ[jj] - lambda;
2016 ix = ((6 - b_j) * 7 + colj) + 8;
2017 for (iy = colj + 8; iy <= ix; iy += 7) {
2021 for (ia = iy; ia <= e; ia++) {
2022 lambda += SQ[ia - 1] * SQ[b_ix];
2026 SQ[b_iy] += -lambda;
2031 lambda = 1.0F / ajj;
2032 ix = ((6 - b_j) * 7 + jj) + 8;
2033 for (b_iy = jj + 7; b_iy + 1 <= ix; b_iy += 7) {
2054 for (b_j = 0; b_j + 1 <= jmax; b_j++) {
2055 for (colj = b_j + 1; colj + 1 <= jmax; colj++) {
2056 SQ[colj + 7 * b_j] = 0.0F;
2060 memcpy(&Y[0], &SQ[0], 49U *
sizeof(
real32_T));
2063 u[i] = tmp[i] - rtb_z[i];
2066 for (i = 0; i < 7; i++) {
2068 for (jmax = 0; jmax < 6; jmax++) {
2069 lambda += K[7 * jmax + i] * u[jmax];
2072 p[i] = rtb_x1[i] + lambda;
2073 for (jmax = 0; jmax < 7; jmax++) {
2074 rtb_P1[jmax + 7 * i] = Y[7 * jmax + i];
2078 ukf_Y.
xout[i] = p[i];
2084 memcpy(&ukf_Y.
Pout[0], &rtb_P1[0], 49U *
sizeof(
real32_T));
2087 for (i = 0; i < 7; i++) {
static real32_T xnrm2_f(int32_T n, const real32_T x[147], int32_T ix0)
static void xgeqrf(real32_T A[120], real32_T tau[6])
real32_T Delay1_DSTATE[7]
static void xgeqrf_f(real32_T A[147], real32_T tau[7])
static void qr(const real32_T A[120], real32_T Q[120], real32_T R[36])
void UKF_Wind_Estimator_step(void)
real32_T Delay_DSTATE[49]
static void mrdivide(real32_T A[42], const real32_T B_0[36])
static real32_T xnrm2(int32_T n, const real32_T x[120], int32_T ix0)
static void qr_e(const real32_T A[147], real32_T Q[147], real32_T R[49])
static const float scale[]
void UKF_Wind_Estimator_initialize(void)
static void h(const real32_T x[7], const real32_T q[4], real32_T y[6])
static void RungeKutta(const real32_T x[7], real32_T dt, const real32_T u[6], real32_T xi[7])
ukf_params_type ukf_params