Master Thesis Code
by Simon Moser
Loading...
Searching...
No Matches
exp_231205_scriptRectRot.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%% add functions path and get data path
7addpath(genpath('../../functions'));
8datapath = getDataPath();
9datapath = fullfile(datapath, "self_captured/231205_rotating_around_a_rectangle");
10
11%% load data
12data(1) = jumpReadData(fullfile(datapath, "sensor1", "S-24-A-13026_001.BIN"));
13data(2) = jumpReadData(fullfile(datapath, "sensor2", "S-24-A-13036_001.BIN"));
14data(3) = jumpReadData(fullfile(datapath, "sensor3", "S-24-A-13169_000.BIN"));
15
16%% cut start and end
17g_thres = 0.2;
18for i=1:height(data)
19 % first possible movment is 25 s after start
20 [~, idx_start] = min(abs(data(i).tt.t - (data(i).tt.t(1) + seconds(25))));
21
22 % find the actual movement
23 norm_acc = vecnorm(data(i).tt.acc(idx_start:end, :),2,2);
24 idx_start = idx_start + ...
25 find(abs(norm_acc - mean(norm_acc,"all")) > g_thres, 1);
26
27 % find the index 25s before
28 [~, idx_start] = min(abs(data(i).tt.t - data(i).tt.t(idx_start) + seconds(25)));
29
30 % define the last index (start index plus datarate times 153s [= experiment duration]
31 idx_end = idx_start + data(i).mpu_rate * 153;
32
33 % cut the timetable
34 data(i).tt = data(i).tt(idx_start:idx_end,:);
35end
36
37%% Inertial Orientation Estimation with VQF
38vqf = MyVqf();
39IOE.vqf = vqf.filterOffline(data(2).tt.acc, data(2).tt.gyr, data(2).tt.mag);
40
41%% animate
42animateQuat(IOE.vqf.quat9D, "speedup",4);
43
44figure;
45stem(IOE.vqf.restDetected)
function animateQuat(in quat, in options)
MyVqf is an interface to the VQF python package.
Definition MyVqf.m:29
function getDataPath()
function jumpReadData(in filePath, in options)