|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
37 void extractPhiGamma(
float **inmat,
float **phi,
float **gamma,
int m,
int n_a,
int n_b)
39 int totalsize = m + n_b;
40 for (
int i = 0; i < m; i++) {
41 for (
int j = 0; j < totalsize; j++) {
43 phi[i][j] = inmat[i][j];
45 gamma[i][j - n_a] = inmat[i][j];
57 int totalsize = m + n_b;
58 for (
int i = 0; i < totalsize; i++) {
59 for (
int j = 0; j < totalsize; j++) {
60 if (i < m && j < n_a) {
63 o[i][j] =
b[i][j - n_a];
74 void c2d(
int m,
int nA,
int nB,
float **Fx,
float **G,
float dt,
float **phi,
float **gamma)
77 int totalsize = m + nB;
78 float combmat[totalsize][totalsize];
79 float expm[totalsize][totalsize];
103 output[0] = input[
r1m] * statein[
y12] - statein[
u1] + statein[
u2] * cosf(statein[
gam]) - statein[
v2] * sinf(
105 output[1] = -input[
r1m] * statein[
x12] - statein[
v1] + statein[
u2] * sinf(statein[
gam]) + statein[
v2] * cosf(
109 output[4] = input[
u1dm] + input[
r1m] * statein[
v1];
110 output[5] = input[
v1dm] - input[
r1m] * statein[
u1];
111 output[6] = input[
u2dm] + input[
r2m] * statein[
v2];
112 output[7] = input[
v2dm] - input[
r2m] * statein[
u2];
113 output[8] = input[
r2m] - input[
r1m];
121 output[0] = powf(powf((statein[
z1] - statein[
z2]), 2.0) + powf(statein[
x12], 2.0) + powf(statein[
y12], 2.0), 0.5);
122 output[1] = statein[
z1];
123 output[2] = statein[
z2];
124 output[3] = statein[
u1];
125 output[4] = statein[
v1];
126 output[5] = statein[
u2];
127 output[6] = statein[
v2];
134 output[0][1] = input[
r1m];
136 output[0][6] = cosf(statein[
gam]);
137 output[0][7] = -sinf(statein[
gam]);
138 output[0][8] = -statein[
v2] * cosf(statein[
gam]) - statein[
u2] * sinf(statein[
gam]);
139 output[1][0] = -input[
r1m];
141 output[1][6] = sinf(statein[
gam]);
142 output[1][7] = cosf(statein[
gam]);
143 output[1][8] = statein[
u2] * cosf(statein[
gam]) - statein[
v2] * sinf(statein[
gam]);
144 output[4][5] = input[
r1m];
145 output[5][4] = -input[
r1m];
146 output[6][7] = input[
r2m];
147 output[7][6] = -input[
r2m];
154 output[0][4] = statein[
y12];
155 output[1][4] = -statein[
x12];
157 output[4][4] = statein[
v1];
159 output[5][4] = -statein[
u1];
161 output[6][4] = statein[
v2];
163 output[7][4] = -statein[
u2];
172 output[0][0] = statein[
x12] / (powf(powf(statein[
z1] - statein[
z2], 2.0) + powf(statein[
x12], 2.0) + powf(statein[
y12],
174 output[0][1] = statein[
y12] / (powf(powf(statein[
z1] - statein[
z2], 2.0) + powf(statein[
x12], 2.0) + powf(statein[
y12],
176 output[0][2] = (2 * statein[
z1] - 2 * statein[
z2]) / (2 * powf(powf(statein[
z1] - statein[
z2], 2.0) + powf(statein[
x12],
177 2.0) + powf(statein[
y12], 2.0), 0.5));
178 output[0][3] = -(2 * statein[
z1] - 2 * statein[
z2]) / (2 * powf(powf(statein[
z1] - statein[
z2],
179 2.0) + powf(statein[
x12],
180 2.0) + powf(statein[
y12], 2.0), 0.5));
200 filter->
Q[4][4] = powf(0.2, 2);
201 filter->
Q[5][5] = powf(0.2, 2);
204 filter->
R[0][0] = powf(0.5, 2);
205 filter->
R[1][1] = powf(0.2, 2);
206 filter->
R[2][2] = powf(0.2, 2);
static void float_mat_scale(float **a, float k, int m, int n)
a *= k, where k is a scalar value
void discrete_ekf_no_north_Hx(float *statein, float **output)
float Gamma[EKF_N][EKF_L]
void float_mat_exp(float **a, float **o, int n)
void extractPhiGamma(float **inmat, float **phi, float **gamma, int m, int n_a, int n_b)
void discrete_ekf_no_north_fsym(float *statein, float *input, float *output)
void float_mat_invert(float **o, float **mat, int n)
Calculate inverse of any n x n matrix (passed as C array) o = mat^-1 Algorithm verified with Matlab.
#define MAKE_MATRIX_PTR(_ptr, _mat, _rows)
Make a pointer to a matrix of _rows lines.
static void float_mat_transpose_square(float **a, int n)
transpose square matrix
static void float_mat_diff(float **o, float **a, float **b, int m, int n)
o = a - b
static void float_mat_diagonal_scal(float **o, float v, int n)
Make an n x n identity matrix (for matrix passed as array)
Paparazzi floating point algebra.
void discrete_ekf_no_north_hsym(float *statein, float *output)
static void float_vect_zero(float *a, const int n)
a = 0
static void float_mat_zero(float **a, int m, int n)
a = 0
void discrete_ekf_no_north_Fx(float *statein, float *input, float **output)
static void float_mat_vect_mul(float *o, float **a, float *b, int m, int n)
o = a * b
static void float_vect_diff(float *o, const float *a, const float *b, const int n)
o = a - b
void discrete_ekf_no_north_G(float *statein, float **output)
void float_mat_combine(float **a, float **b, float **o, int m, int n_a, int n_b)
static void float_mat_transpose(float **o, float **a, int n, int m)
transpose non-square matrix
void c2d(int m, int nA, int nB, float **Fx, float **G, float dt, float **phi, float **gamma)
static void float_vect_scale(float *a, const float s, const int n)
a *= s
void discrete_ekf_no_north_predict(struct discrete_ekf_no_north *filter, float *U)
static void float_mat_sum(float **o, float **a, float **b, int m, int n)
o = a + b
void discrete_ekf_no_north_update(struct discrete_ekf_no_north *filter, float *Z)
static void float_mat_mul(float **o, float **a, float **b, int m, int n, int l)
o = a * b
static void float_vect_sum(float *o, const float *a, const float *b, const int n)
o = a + b
void discrete_ekf_no_north_new(struct discrete_ekf_no_north *filter)