APM:Libraries
libraries
AP_NavEKF
Models
GimbalEstimatorExample
calcH_MAG.c
Go to the documentation of this file.
1
t2
= cos(gPhi);
2
t3
= cos(gTheta);
3
t4
= sin(gPhi);
4
t5
= sin(gTheta);
5
t6
= q0*q0;
6
t7
= q1*q1;
7
t8
= q2*q2;
8
t9
= q3*q3;
9
t10
=
t6
+
t7
-
t8
-
t9
;
10
t11
= sin(gPsi);
11
t12
= cos(gPsi);
12
t13
= q0*q2*2.0;
13
t14
= q1*q3*2.0;
14
t15
=
t13
+
t14
;
15
t16
= q0*q3*2.0;
16
t18
= q1*q2*2.0;
17
t17
=
t16
-
t18
;
18
t19
=
t3
*
t11
;
19
t20
=
t4
*
t5
*
t12
;
20
t21
=
t19
+
t20
;
21
t22
=
t16
+
t18
;
22
t23
=
t5
*
t11
;
23
t41
=
t3
*
t4
*
t12
;
24
t24
=
t23
-
t41
;
25
t25
= q0*q1*2.0;
26
t31
= q2*q3*2.0;
27
t26
=
t25
-
t31
;
28
t27
=
t6
-
t7
+
t8
-
t9
;
29
t28
=
t5
*
t12
;
30
t29
=
t3
*
t4
*
t11
;
31
t30
=
t28
+
t29
;
32
t32
=
t3
*
t12
;
33
t46
=
t4
*
t5
*
t11
;
34
t33
=
t32
-
t46
;
35
t35
=
t4
*
t17
;
36
t36
=
t2
*
t5
*
t10
;
37
t37
=
t2
*
t3
*
t15
;
38
t38
=
t35
+
t36
-
t37
;
39
t39
= magZ*
t38
;
40
t40
=
t10
*
t21
;
41
t42
=
t15
*
t24
;
42
t43
=
t2
*
t12
*
t17
;
43
t44
=
t40
+
t42
-
t43
;
44
t45
= magY*
t44
;
45
t47
=
t10
*
t33
;
46
t48
=
t15
*
t30
;
47
t49
=
t2
*
t11
*
t17
;
48
t50
=
t47
+
t48
+
t49
;
49
t51
= magX*
t50
;
50
t52
= -
t39
+
t45
+
t51
;
51
t53
= 1.0/
t52
;
52
t54
=
t4
*
t27
;
53
t55
=
t2
*
t3
*
t26
;
54
t56
=
t2
*
t5
*
t22
;
55
t57
= -
t54
+
t55
+
t56
;
56
t58
= magZ*
t57
;
57
t59
=
t21
*
t22
;
58
t60
=
t24
*
t26
;
59
t61
=
t2
*
t12
*
t27
;
60
t62
=
t59
-
t60
+
t61
;
61
t63
= magY*
t62
;
62
t64
=
t26
*
t30
;
63
t65
=
t22
*
t33
;
64
t66
=
t2
*
t11
*
t27
;
65
t67
=
t64
-
t65
+
t66
;
66
t68
= magX*
t67
;
67
t69
=
t58
-
t63
+
t68
;
68
t70
=
t53
*
t69
;
69
t34
= tan(
t70
);
70
t71
=
t34
*
t34
;
71
t72
=
t71
+1.0;
72
t73
= 1.0/(
t52
*
t52
);
73
A0
[0][0] = -
t72
*(
t53
*(magZ*(
t4
*
t26
+
t2
*
t3
*
t27
)+magY*(
t24
*
t27
+
t2
*
t12
*
t26
)+magX*(
t27
*
t30
-
t2
*
t11
*
t26
))-
t69
*
t73
*(magZ*(
t4
*
t15
+
t2
*
t3
*
t17
)+magY*(
t17
*
t24
+
t2
*
t12
*
t15
)+magX*(
t17
*
t30
-
t2
*
t11
*
t15
)));
74
A0
[0][1] =
t72
*(
t53
*(magZ*(
t2
*
t3
*
t22
-
t2
*
t5
*
t26
)+magY*(
t22
*
t24
+
t21
*
t26
)+magX*(
t22
*
t30
+
t26
*
t33
))+
t69
*
t73
*(magZ*(
t2
*
t3
*
t10
+
t2
*
t5
*
t15
)+magY*(
t10
*
t24
-
t15
*
t21
)+magX*(
t10
*
t30
-
t15
*
t33
)));
75
A0
[0][2] =
t72
*(
t53
*(-magZ*(
t4
*
t22
+
t2
*
t5
*
t27
)+magY*(
t21
*
t27
-
t2
*
t12
*
t22
)+magX*(
t27
*
t33
+
t2
*
t11
*
t22
))-
t69
*
t73
*(magZ*(
t4
*
t10
-
t2
*
t5
*
t17
)+magY*(
t17
*
t21
+
t2
*
t10
*
t12
)+magX*(
t17
*
t33
-
t2
*
t10
*
t11
)));
t70
t70
Definition:
calcH_MAG.c:68
t42
t42
Definition:
calcH_MAG.c:41
t2
t2
Definition:
calcH_MAG.c:1
t50
t50
Definition:
calcH_MAG.c:48
t33
t33
Definition:
calcH_MAG.c:34
t73
t73
Definition:
calcH_MAG.c:72
t37
t37
Definition:
calcH_MAG.c:37
t41
t41
Definition:
calcH_MAG.c:23
t26
t26
Definition:
calcH_MAG.c:27
t71
t71
Definition:
calcH_MAG.c:70
t16
t16
Definition:
calcH_MAG.c:15
t24
t24
Definition:
calcH_MAG.c:24
t34
t34
Definition:
calcH_MAG.c:69
t28
t28
Definition:
calcH_MAG.c:29
t35
t35
Definition:
calcH_MAG.c:35
t61
t61
Definition:
calcH_MAG.c:59
t31
t31
Definition:
calcH_MAG.c:26
t36
t36
Definition:
calcH_MAG.c:36
t21
t21
Definition:
calcH_MAG.c:20
t60
t60
Definition:
calcH_MAG.c:58
t54
t54
Definition:
calcH_MAG.c:52
t13
t13
Definition:
calcH_MAG.c:12
t27
t27
Definition:
calcH_MAG.c:28
t39
t39
Definition:
calcH_MAG.c:39
t46
t46
Definition:
calcH_MAG.c:33
t67
t67
Definition:
calcH_MAG.c:65
t12
t12
Definition:
calcH_MAG.c:11
t45
t45
Definition:
calcH_MAG.c:44
t7
t7
Definition:
calcH_MAG.c:6
t64
t64
Definition:
calcH_MAG.c:62
t65
t65
Definition:
calcH_MAG.c:63
t56
t56
Definition:
calcH_MAG.c:54
t72
t72
Definition:
calcH_MAG.c:71
t66
t66
Definition:
calcH_MAG.c:64
A0
A0[0][0]
Definition:
calcH_MAG.c:73
t40
t40
Definition:
calcH_MAG.c:40
t43
t43
Definition:
calcH_MAG.c:42
t38
t38
Definition:
calcH_MAG.c:38
t48
t48
Definition:
calcH_MAG.c:46
t59
t59
Definition:
calcH_MAG.c:57
t14
t14
Definition:
calcH_MAG.c:13
t23
t23
Definition:
calcH_MAG.c:22
t68
t68
Definition:
calcH_MAG.c:66
t47
t47
Definition:
calcH_MAG.c:45
t15
t15
Definition:
calcH_MAG.c:14
t3
t3
Definition:
calcH_MAG.c:2
t49
t49
Definition:
calcH_MAG.c:47
t8
t8
Definition:
calcH_MAG.c:7
t5
t5
Definition:
calcH_MAG.c:4
t4
t4
Definition:
calcH_MAG.c:3
t69
t69
Definition:
calcH_MAG.c:67
t25
t25
Definition:
calcH_MAG.c:25
t29
t29
Definition:
calcH_MAG.c:30
t18
t18
Definition:
calcH_MAG.c:16
t6
t6
Definition:
calcH_MAG.c:5
t11
t11
Definition:
calcH_MAG.c:10
t32
t32
Definition:
calcH_MAG.c:32
t58
t58
Definition:
calcH_MAG.c:56
t19
t19
Definition:
calcH_MAG.c:18
t10
t10
Definition:
calcH_MAG.c:9
t20
t20
Definition:
calcH_MAG.c:19
t17
t17
Definition:
calcH_MAG.c:17
t9
t9
Definition:
calcH_MAG.c:8
t30
t30
Definition:
calcH_MAG.c:31
t44
t44
Definition:
calcH_MAG.c:43
t51
t51
Definition:
calcH_MAG.c:49
t63
t63
Definition:
calcH_MAG.c:61
t22
t22
Definition:
calcH_MAG.c:21
t53
t53
Definition:
calcH_MAG.c:51
t52
t52
Definition:
calcH_MAG.c:50
t55
t55
Definition:
calcH_MAG.c:53
t57
t57
Definition:
calcH_MAG.c:55
t62
t62
Definition:
calcH_MAG.c:60
Generated on Sun Jun 17 2018 14:18:50 for APM:Libraries by
1.8.13