Skip to content

Commit f73f49f

Browse files
committed
2019-03-15
1 parent bfb3b78 commit f73f49f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+145
-127
lines changed

F_update.m

100644100755
File mode changed.

LICENSE

100644100755
File mode changed.

README.md

100644100755
File mode changed.

allan-variance/allan_get_b_dyn.m

100644100755
File mode changed.

allan-variance/allan_get_rw.m

100644100755
File mode changed.

allan-variance/allan_imu.m

100644100755
Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@
55
% -------------------------------------------------------------------------
66
%
77
% INPUT
8-
% imu_sta. Input data structure must contains the following fields:
8+
% imu_sta, input data structure must contains the following fields:
99
%
1010
% fb, Nx3 matrix, accelerations [X Y Z] (m/s^2).
1111
% wb, Nx3 matrix, turn rates [X Y Z] (rad/s).
1212
% t, Nx1, time vector (s).
1313
%
14-
% - verbose. Verbose level for allan_overlap function.
14+
% verbose. Verbose level for allan_overlap function.
15+
% 0 = silent & no data plots; 1 = status messages; 2 = all messages
1516
%
1617
% OUTPUT
17-
% imu. Output data structure with the following fields:
18+
% imu, input data structure with the following addtional fields:
1819
%
1920
% arw, 1x3 vector, angle random walk (rad/root-s). Value is taken
2021
% straightfoward from the plot at t = 1 s.
2122
% Note: units of rad/s from the plot have to be transformed to
2223
% rad/root-s. This is done by multiplying (rad/s * root-s/root-s) =
2324
% (rad/s * root-s/1) = rad/root-s, since root-s = 1 for tau = 1, time
24-
% at which random walk is evaluated.
25-
%
25+
% at which random walk is evaluated.
2626
%
2727
% vrw, 1x3 vector, velocity random walk (m/s/root-s). Value is taken
2828
% straightfoward from the plot at t = 1 s.
@@ -38,46 +38,30 @@
3838
% from the plot at the minimun value.
3939
%
4040
% gb_corr, 1x3 vector, gyros correlation times (s).
41-
%
4241
% ab_corr, 1x3 vector, accs correlation times (s).
4342
%
4443
% g_std, 1x3 vector, gyros standard deviations (rad/s).
45-
%
4644
% a_std, 1x3 vector, accs standard deviations (m/s^2).
4745
%
4846
% g_max, 1x3 vector, gyros maximum values (rad/s).
49-
%
5047
% a_max, 1x3 vector, accs maximum values (m/s^2).
5148
%
5249
% g_min, 1x3 vector, gyros minimum values (rad/s).
53-
%
5450
% a_min, 1x3 vector, accs maximum values (m/s^2).
5551
%
5652
% g_mean, 1x3 vector, gyros mean values (rad/s).
57-
%
5853
% a_meam, 1x3 vector, accs mean values (m/s^2).
5954
%
6055
% g_median, 1x3 vector, gyros median values (rad/s).
61-
%
6256
% a_median, 1x3 vector, accs median values (m/s^2).
6357
%
64-
% fb_tau, Mx3 with time vector from AV for accelerometers [X Y Z],
65-
% respectively.
66-
%
67-
% fb_allan, Mx3 with AV vector for accelerometers [X Y Z],
68-
% respectively.
69-
%
70-
% fb_error, Mx3 with AV errors for accelerometers [X Y Z],
71-
% respectively.
72-
%
73-
% wb_tau, Mx3 with time vector from AV for gyros [X Y Z],
74-
% respectively.
75-
%
76-
% wb_allan, Mx3 with AV vector for gyros [X Y Z],
77-
% respectively.
58+
% fb_tau, Mx3 with time vector from AV for accelerometers [X Y Z].
59+
% fb_allan, Mx3 with AV vector for accelerometers [X Y Z].
60+
% fb_error, Mx3 with AV errors for accelerometers [X Y Z].
7861
%
79-
% wb_error, Mx3 with AV errors for gyros [X Y Z],
80-
% respectively.
62+
% wb_tau, Mx3 with time vector from AV for gyros [X Y Z].
63+
% wb_allan, Mx3 with AV vector for gyros [X Y Z].
64+
% wb_error, Mx3 with AV errors for gyros [X Y Z].
8165
%
8266
% -------------------------------------------------------------------------
8367
%
@@ -120,8 +104,8 @@
120104
%
121105
% -------------------------------------------------------------------------
122106
%
123-
% Version: 006
124-
% Date: 2018/03/26
107+
% Version: 007
108+
% Date: 2019/02/18
125109
% Author: Rodrigo Gonzalez <[email protected]>
126110
% URL: https://github.com/rodralez/navego
127111
%
@@ -155,13 +139,15 @@
155139
imu.a_mean = zeros(1,3);
156140
imu.a_median = zeros(1,3);
157141
imu.a_outliers = zeros(1,3);
142+
imu.a_linear = zeros(3,2);
158143

159144
imu.g_std = zeros(1,3);
160145
imu.g_max = zeros(1,3);
161146
imu.g_min = zeros(1,3);
162147
imu.g_mean = zeros(1,3);
163148
imu.g_median = zeros(1,3);
164149
imu.g_outliers = zeros(1,3);
150+
imu.g_linear = zeros(3,2);
165151

166152
%% TIME VECTOR FOR ALLAN VARIANCE
167153

@@ -225,6 +211,7 @@
225211
imu.a_min(i) = s.min;
226212
imu.a_median(i) = s.median;
227213
imu.a_outliers(i) = s.outliers;
214+
imu.a_linear(i,:) = s.linear;
228215
end
229216

230217
% Plot ACCRS
@@ -263,6 +250,7 @@
263250
imu.g_min(i) = s.min;
264251
imu.g_median(i) = s.median;
265252
imu.g_outliers(i) = s.outliers;
253+
imu.g_linear(i,:) = s.linear;
266254
end
267255

268256
imu.freq = data.rate;

allan-variance/allan_overlap.m

100644100755
Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
if isfield(data,'time')
188188
if size(data.time,2) > size(data.time,1), data.time=data.time'; end % ensure columns
189189
s.linear=polyfit(data.time(1:length(data.freq)),data.freq,1);
190-
elseif isfield(data,'rate') && data.rate ~= 0;
190+
elseif isfield(data,'rate') && data.rate ~= 0
191191
s.linear=polyfit((1/data.rate:1/data.rate:length(data.freq)/data.rate)',data.freq,1);
192192
else
193193
error('Either "time" or "rate" must be present in DATA. Type "help allan_overlap" for details. [err1]');
@@ -212,8 +212,17 @@
212212
outliers = data.freq(odl);
213213
fprintf(1, 'allan_overlap: OUTLIERS: There appear to be %d outliers in the frequency data.\n', length(outliers));
214214

215-
% idl = (abs(medianfreq) < 5*MAD);
216-
% data.freq = data.freq(idl);
215+
% ELIMINATE OUTLIERS FROM DATA
216+
fit_line = polyval(s.linear, (1/data.rate:1/data.rate:length(data.freq)/data.rate)') - s.median;
217+
idl = ( medianfreq < (3*MAD + fit_line) );
218+
data.freq = data.freq(idl);
219+
medianfreq = medianfreq(idl);
220+
221+
fit_line = polyval(s.linear, (1/data.rate:1/data.rate:length(data.freq)/data.rate)') - s.median;
222+
idl = ( medianfreq > (-3*MAD + fit_line) );
223+
data.freq = data.freq(idl);
224+
medianfreq = medianfreq(idl);
225+
217226
s.outliers = length(outliers);
218227

219228
else
@@ -478,7 +487,7 @@
478487
%%%%%%%%
479488
%% Plotting
480489

481-
if verbose >= 2 % show all data
490+
if verbose >= 1 % show all data
482491

483492
% plot the frequency data, centered on median
484493
if size(dtime,2) > size(dtime,1), dtime=dtime'; end % this should not be necessary, but dsplot 1.1 is a little bit brittle
@@ -497,12 +506,18 @@
497506
fx = xlim;
498507
% plot([fx(1) fx(2)],[s.median s.median],'-k');
499508
plot([fx(1) fx(2)],[0 0],':k');
509+
500510
% show 5x Median Absolute deviation (MAD) values
501511
hm=plot([fx(1) fx(2)],[5*MAD 5*MAD],'-r');
502512
plot([fx(1) fx(2)],[-5*MAD -5*MAD],'-r');
513+
503514
% show linear fit line
504515
hf=plot(xlim,polyval(s.linear,xlim)-s.median,'-g');
505516
title(['Data: ' name],'FontSize',FontSize+2,'FontName','Arial');
517+
518+
plot(xlim,polyval(s.linear,xlim)-3*MAD,'--m');
519+
plot(xlim,polyval(s.linear,xlim)+3*MAD,'--m');
520+
506521
%set(get(gca,'Title'),'Interpreter','none');
507522
xlabel('Time [sec]','FontSize',FontSize,'FontName',FontName);
508523
if isfield(data,'units')
@@ -514,7 +529,6 @@
514529
legend([hd hm hf],{'data (centered on median)','5x MAD outliers',['Linear Fit (' num2str(s.linear(1),'%g') ')']},'FontSize',max(10,FontSize-2));
515530
% tighten up
516531
xlim([dtime(1) dtime(end)]);
517-
518532

519533
end % end plot raw data
520534

allan-variance/dsplot.m

100644100755
File mode changed.

att_update.m

100644100755
File mode changed.

conversions/dcm2euler.m

100644100755
File mode changed.

0 commit comments

Comments
 (0)