-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplotDrones.m
51 lines (38 loc) · 824 Bytes
/
plotDrones.m
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
% Fetch drone .csv files in the directory of ´drones´
files = dir("drones");
k = 1;
% Read all the data belongs to the drones
for file = files'
if (~file.isdir)
fname = ['drones/' file.name];
datas(:, :, k) = importDrones(fname);
k = k + 1;
end
end
sz = size(datas);
% Number of iteration to visualize
iter = sz(1);
if (length(sz) ~= 2)
numberOfDrones = sz(3);
else
numberOfDrones = 1;
end
a = figure('Visible', 'on');
hold on;
i = 0;
% Simple animation routine
for k = 1:100:iter
for m = 1:numberOfDrones
plot(datas(k, 1, m), datas(k, 2, m), 'o-', 'MarkerSize', 6);
end
axis equal;
set(gca, 'xlim', [-10 30]);
set(gca, 'ylim', [-10 30]);
drawnow;
i = i + 1;
if (mod(i, 2) == 0)
cla;
i = 1;
end
end
hold off;