Master Thesis Code
by Simon Moser
Loading...
Searching...
No Matches
exp_240213_allanDeviationComparison.m
Go to the documentation of this file.
1%
2% For LICENSE / TERMS OF USE, see the file LICENSE in the root directory of the repository.
3
4clear; close all; clc;
5
6%% analyze actual recorded data (recorded in the damping chamber at around 20.2 °C)
7datapath = getDataPath();
8datapath = fullfile(datapath, "self_captured/240205_allan_deviation_2");
9data(1) = jumpReadData(fullfile(datapath, "S-24-A-13026_000.BIN"));
10data(2) = jumpReadData(fullfile(datapath, "S-24-A-13036_000.BIN"));
11data(3) = jumpReadData(fullfile(datapath, "S-24-A-13169_000.BIN"));
12
13% remove start because of temperature decrease and end because of me
14% walking
15data(1).tt = data(1).tt(2e6:end - 200 * 60,:);
16data(2).tt = data(2).tt(2e6:end - 200 * 60,:);
17data(3).tt = data(3).tt(2e6:end - 200 * 60,:);
18
19% analyze the data
20params(1) = jumpNoiseAnalysis(data(1), "plot", false);
21params(2) = jumpNoiseAnalysis(data(2), "plot", false);
22params(3) = jumpNoiseAnalysis(data(3), "plot", false);
23
24num_measurements = 3;
25
26%% JUMP sensor models and simulate data
27
28num_simulations = 3;
29assert(num_simulations >= num_measurements, "num_simulations must be greater or equal than num_measurements");
30
31% get ground truth (laying still for 24 h)
32numsamples = 24 * 60 * 60 * 200;
33acc = zeros(numsamples,3);
34gyr = zeros(numsamples,3);
35ori = quaternion.ones(numsamples, 1);
36tmp = linspace(20.2, 20.2, numsamples);
37
38for i = 1:num_simulations
39
40 % simulator instance
41 js(i) = JumpSensor();
42
43 % simulate data
44 data_sim(i) = js(i).generate(acc, gyr, ori, "tmp_true",tmp);
45
46 % analyze the simulated data
47 params_sim(i) = jumpNoiseAnalysis(data_sim(i), "plot", false);
48
49 disp(".");
50
51end
52
53%% plot the results
54figure("Name", "Allan deviation comparison between simulated and measured data","ToolBar","none", "NumberTitle","off")
55for i = 1:num_simulations
56 subplot(231); % accelerometer
57 loglog(params_sim(i).acc.tau, params_sim(i).acc.adev, '-b'); hold on;
58 if i < num_measurements
59 loglog(params(i).acc.tau, params(i).acc.adev, '--r');
60 end
61 if i == 1
62 grid on;
63 xlabel("tau [s]");
64 ylabel("Allan deviation [m/s^2]");
65 title("accelerometer");
66 elseif i == num_simulations
67 hold off;
68 legend("simulated", "measured", "Location", "best");
69 end
70
71 subplot(232); % gyroscope
72 loglog(params_sim(i).gyr.tau, params_sim(i).gyr.adev, '-b'); hold on;
73 if i < num_measurements
74 loglog(params(i).gyr.tau, params(i).gyr.adev, '--r');
75 end
76 if i == 1
77 grid on;
78 xlabel("tau [s]");
79 ylabel("Allan deviation [rad/s]");
80 title("gyroscope");
81 elseif i == num_simulations
82 hold off;
83 legend("simulated", "measured", "Location", "best");
84 end
85
86 subplot(233); % temperature
87 loglog(params_sim(i).tmp.tau, params_sim(i).tmp.adev, '-b'); hold on;
88 if i < num_measurements
89 loglog(params(i).tmp.tau, params(i).tmp.adev, '--r');
90 end
91 if i == 1
92 grid on;
93 xlabel("tau [s]");
94 ylabel("Allan deviation [°C]");
95 title("temperature");
96 elseif i == num_simulations
97 hold off;
98 legend("simulated", "measured", "Location", "best");
99 end
100
101 subplot(234); % high g accelerometer
102 loglog(params_sim(i).hig.tau, params_sim(i).hig.adev, '-b'); hold on;
103 if i < num_measurements
104 loglog(params(i).hig.tau, params(i).hig.adev, '--r');
105 end
106 if i == 1
107 grid on;
108 xlabel("tau [s]");
109 ylabel("Allan deviation [m/s^2]");
110 title("high g accelerometer");
111 elseif i == num_simulations
112 hold off;
113 legend("simulated", "measured", "Location", "best");
114 end
115
116 subplot(235); % magnetometer
117 loglog(params_sim(i).mag.tau, params_sim(i).mag.adev, '-b'); hold on;
118 if i < num_measurements
119 loglog(params(i).mag.tau, params(i).mag.adev, '--r');
120 end
121 if i == 1
122 grid on;
123 xlabel("tau [s]");
124 ylabel("Allan deviation [uT]");
125 title("magnetometer");
126 elseif i == num_simulations
127 hold off;
128 legend("simulated", "measured", "Location", "best");
129 end
130
131 subplot(236); % pressure
132 loglog(params_sim(i).prs.tau, params_sim(i).prs.adev, '-b'); hold on;
133 if i < num_measurements
134 loglog(params(i).prs.tau, params(i).prs.adev, '--r');
135 end
136 if i == 1
137 grid on;
138 xlabel("tau [s]");
139 ylabel("Allan deviation [Pa]");
140 title("pressure");
141 elseif i == num_simulations
142 hold off;
143 legend("simulated", "measured", "Location", "best");
144 end
145end
JumpSensor is a simulation of the JUMP sensor of the ZurichMove Project.
Definition JumpSensor.m:41
function getDataPath()
function jumpNoiseAnalysis(in data, in options)
function jumpReadData(in filePath, in options)