-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbag_analysis.m
49 lines (32 loc) · 1.07 KB
/
bag_analysis.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
bag = rosbag("C:\Users\micha\homeworks\BC\camp_tests\mikhail_bag_files\23_2022_04_28_17_55_30_louka_3_s_rviz\_2022-04-28-17-58-01.bag");
bagselect1 = select(bag,"Topic","/visualization_marker_array");
msgs = readMessages(bagselect1, "DataFormat", "struct");
size(msgs)
coords = [];
starts = [];
for i = 1:size(msgs)
array = msgs{i}.Markers;
for j = 1:size(array, 2)
if array(j).Type == 2
if array(j).Pose.Position.X ~= 0
coords = [coords [array(j).Pose.Position.X
array(j).Pose.Position.Y]];
else
starts = [starts [array(j).Pose.Position.X
array(j).Pose.Position.Y]];
end
end
end
end
f = figure;
scatter(coords(2, :), coords(1, :), 'LineWidth', 1.2);
hold on;
scatter(starts(2, :), starts(1, :), 'LineWidth', 2);
xlabel("Distance to goal in Y axis [m]");
ylabel("Distance to goal in X axis [m]");
xlim([-15.3 0.2]);
ylim([-2 0.8]);
legend('Position deviations', 'Start and goal references');
grid on;
grid minor;
f.Position = [700 300 900 400];