forked from analogdevicesinc/SensorToolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadis16460.m
More file actions
44 lines (38 loc) · 878 Bytes
/
adis16460.m
File metadata and controls
44 lines (38 loc) · 878 Bytes
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
clear all; %#ok<CLALL>
%% ADIS16460 Example
%% Setup
% IMU
IMU = adi.ADIS16460.Rx;
IMU.SamplesPerFrame = 32;
IMU.uri = 'ip:analog';
% Filter
fs = IMU.SamplingRate;
aFilter = imufilter('SampleRate',fs);
%% Get info
numSamples = IMU.SamplesPerFrame;
t = 0:1/fs:(numSamples-1)/fs;
[accelBody,gyroBody] = IMU();
orientation = aFilter(accelBody,gyroBody);
%% Cleanup
release(aFilter);
release(IMU);
%% Plot
figure;
plot(t,eulerd(orientation,'ZYX','frame'))
xlabel('Time (s)')
ylabel('Rotation (degrees)')
title('Orientation Estimation -- IMU Data, Default IMU Filter')
legend('Z-axis','Y-axis','X-axis');
grid on;
figure;
plot(t,accelBody);title('Acceleration');
xlabel('Time (s)')
ylabel('m/s^2');
legend('X-axis','Y-axis','Z-axis');
grid on;
figure;
plot(t,gyroBody);title('Angular Velocity');
xlabel('Time (s)');
ylabel('rad/s');
legend('X-axis','Y-axis','Z-axis');
grid on;