-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathFindFixData.m
More file actions
61 lines (43 loc) · 1.27 KB
/
FindFixData.m
File metadata and controls
61 lines (43 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function [fix_point, rotation] = FindFixData(cal, threshold)
n = size(cal, 1);
j = 1;
for i = 1:n
norm_gyro(i, 1) = norm(cal(i, 5:7));
if i == 1
if norm_gyro(i) < threshold
P(j, 1) = i;
end
else
if norm_gyro(i) <= threshold && norm_gyro(i - 1) > threshold
P(j, 1) = i;
end
if norm_gyro(i) > threshold && norm_gyro(i - 1) <= threshold
P(j, 2) = i - 1;
j = j + 1;
end
end
end
j = 1;
PP = [];
for i = 1:size(P, 1) - 1
% if P(i,2)-P(i,1)>20
if P(i, 2) - P(i, 1) > 300
PP(j, 1) = P(i, 1);
PP(j, 2) = P(i, 2);
fix_point(j, :) = mean(cal(PP(j, 1):PP(j, 2), 2:7), 1);
if j >= 2
rotation{j - 1, 1} = cal(PP(j - 1, 2) - 50:PP(j, 1) + 50, :);
end
j = j + 1;
end
end
figure
plot(1:n, norm_gyro, 'b')
for j = 1:size(PP, 1)
hold on
plot(PP(j, 1), norm_gyro(PP(j, 1)), 'ro');
hold on
plot(PP(j, 2), norm_gyro(PP(j, 2)), 'b*');
end
legend('gyro norm', 'start', 'end');
end