CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/Tools/CPUInfo/EKF_Maths.h
Views: 1798
1
#pragma once
2
3
/*
4
data structure for measuring speed of EKF mag fusion code
5
*/
6
#include <AP_Math/AP_Math.h>
7
#include <AP_Math/ftype.h>
8
#include <stdint.h>
9
10
class EKF_Maths {
11
public:
12
EKF_Maths() {}
13
14
typedef ftype Vector2[2];
15
typedef ftype Vector3[3];
16
typedef ftype Vector4[4];
17
typedef ftype Vector5[5];
18
typedef ftype Vector6[6];
19
typedef ftype Vector7[7];
20
typedef ftype Vector8[8];
21
typedef ftype Vector9[9];
22
typedef ftype Vector10[10];
23
typedef ftype Vector11[11];
24
typedef ftype Vector13[13];
25
typedef ftype Vector14[14];
26
typedef ftype Vector15[15];
27
typedef ftype Vector22[22];
28
typedef ftype Vector23[23];
29
typedef ftype Vector24[24];
30
typedef ftype Vector25[25];
31
typedef ftype Vector28[28];
32
typedef ftype Matrix3[3][3];
33
typedef ftype Matrix24[24][24];
34
typedef ftype Matrix34_50[34][50];
35
typedef uint32_t Vector_u32_50[50];
36
37
struct state_elements {
38
Vector3f angErr; // 0..2
39
Vector3f velocity; // 3..5
40
Vector3f position; // 6..8
41
Vector3f gyro_bias; // 9..11
42
Vector3f gyro_scale; // 12..14
43
float accel_zbias; // 15
44
Vector3f earth_magfield; // 16..18
45
Vector3f body_magfield; // 19..21
46
Vector2f wind_vel; // 22..23
47
Quaternion quat; // 24..27
48
};
49
50
union {
51
Vector28 statesArray;
52
struct state_elements stateStruct;
53
};
54
55
struct {
56
ftype q0;
57
ftype q1;
58
ftype q2;
59
ftype q3;
60
ftype magN;
61
ftype magE;
62
ftype magD;
63
ftype magXbias;
64
ftype magYbias;
65
ftype magZbias;
66
Matrix3f DCM;
67
Vector3f MagPred;
68
ftype R_MAG;
69
Vector9 SH_MAG;
70
} mag_state;
71
72
Vector3f innovMag;
73
Vector3f varInnovMag;
74
75
Matrix24 P;
76
Vector28 Kfusion;
77
78
void init(void);
79
float test(void);
80
};
81
82
83