forked from analogdevicesinc/SensorToolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadis16460_motion.m
More file actions
59 lines (55 loc) · 1.27 KB
/
adis16460_motion.m
File metadata and controls
59 lines (55 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
clear all; %#ok<CLALL>
%% ADIS16460 Motion Example
%% Setup
% IMU
IMU = adi.ADIS16460;
IMU.SamplesPerRead = 8;
IMU.uri = 'ip:analog';
IMU.SampleRate = 128;
fs = IMU.SampleRate;
% Filter
ifilt = imufilter('SampleRate', fs);
% Scopes
N = 64;
viewer = HelperOrientationViewer;
useScope = true;
if useScope
ts = dsp.TimeScope;
ts.SampleRate = fs;
ts.TimeSpanOverrunAction = 'Scroll';
ts.TimeSpan = 1/fs*N;
ts.NumInputPorts = 2;
ts.ShowLegend = true;
ts.ChannelNames = {'Acceleration X','Acceleration Y','Acceleration Z',...
'Angular Velocity X','Angular Velocity Y','Angular Velocity Z'};
ts.ShowGrid = true;
ts.LayoutDimensions = [2 ,1];
ts.AxesScaling = 'Auto';
ts_parts = clone(ts);
ts_parts.LayoutDimensions = [1 ,1];
ts_parts.NumInputPorts = 4;
ts_parts.ChannelNames = {'W','X','Y','Z'};
end
%% Get info
numSamples = IMU.SamplesPerFrame;
t = 0:1/fs:(numSamples-1)/fs;
for k=1:N
[acc,gyro] = IMU();
for ii=1:size(acc,1)
qimu = ifilt(acc(ii,:), gyro(ii,:));
viewer(qimu);
pause(0);
end
if useScope
ts(acc(ii,:), gyro(ii,:));
[w,x,y,z] = qimu.parts;
ts_parts(w,x,y,z);
end
end
%% Cleanup
release(ifilt);
release(IMU);
release(viewer);
if useScope
release(ts);
end