forked from j-petit/consensus-formation-control
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplot_limit_acc.m
136 lines (123 loc) · 4.61 KB
/
plot_limit_acc.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
% Plots acceleration limits of dmax and required accleration
% turn off optimization in simulation for results without optimization
plot_tikz = true;
% x direction
scrsz = get(groot,'ScreenSize');
figure('OuterPosition',[scrsz(3)/2 0 scrsz(3)/2 scrsz(4)/3]);
h = plot(timeseries(limit_acc_dmax.data(1:10:end,1:3:end),limit_acc_dmax.time(1:10:end)));
set(h(1),'LineStyle','--','Color','k');
set(h(2),'LineStyle','-.','Color','k');
hold on;
hline = refline(0,0);
hline.Color = [0.8,0.8,0.8];
h2 = plot(timeseries(max_acc.data(1:10:end,1),max_acc.time(1:10:end)));
set(h2,'LineStyle','-','Color','r');
xlabel('Time [s]');
ylabel('x acceleration [m/s^2]','Interpreter','tex');
legend([h(1) h(2) h2],{'upper limit','lower limit','required'},'Location','Southwest');
title('');
if (plot_tikz)
cleanfigure;
matlab2tikz('acc_x_limits_dmax.tikz','width','.8\textwidth');
end;
% y direction
scrsz = get(groot,'ScreenSize');
figure('OuterPosition',[scrsz(3)/2 0 scrsz(3)/2 scrsz(4)/3]);
% a_y limit and required acc for dmax
h = plot(timeseries(limit_acc_dmax.data(1:10:end,2:3:end),limit_acc_dmax.time(1:10:end)));
set(h(1),'LineStyle','--','Color','k');
set(h(2),'LineStyle','-.','Color','k');
hold on;
hline = refline(0,0);
hline.Color = [0.8,0.8,0.8];
h2 = plot(timeseries(max_acc.data(1:10:end,2),max_acc.time(1:10:end)));
set(h2,'LineStyle','-','Color','r');
xlabel('Time [s]');
ylabel('y acceleration [m/s^2]','Interpreter','tex');
legend([h(1) h(2) h2],{'upper limit','lower limit','required'},'Location','Southwest');
title('');
if (plot_tikz)
cleanfigure;
matlab2tikz('acc_y_limits_dmax.tikz','width','.8\textwidth');
end;
% z direction
scrsz = get(groot,'ScreenSize');
figure('OuterPosition',[scrsz(3)/2 0 scrsz(3)/2 scrsz(4)/3]);
% a_z limit and required acc for dmax
h = plot(timeseries(limit_acc_dmax.data(1:10:end,3:3:end),limit_acc_dmax.time(1:10:end)));
set(h(1),'LineStyle','--','Color','k');
set(h(2),'LineStyle','-.','Color','k');
hold on;
hline = refline(0,0);
hline.Color = [0.8,0.8,0.8];
h2 = plot(timeseries(max_acc.data(1:10:end,3),max_acc.time(1:10:end)));
set(h2,'LineStyle','-','Color','r');
xlabel('Time [s]');
ylabel('z acceleration [m/s^2]','Interpreter','tex');
legend([h(1) h(2) h2],{'upper limit','lower limit','required'},'Location','Southwest');
title('');
if (plot_tikz)
cleanfigure;
matlab2tikz('acc_z_limits_dmax.tikz','width','.8\textwidth');
end;
%% for d_min
% x direction
scrsz = get(groot,'ScreenSize');
figure('OuterPosition',[scrsz(3)/2 0 scrsz(3)/2 scrsz(4)/3]);
% a_x limit and required acc for dmax
h = plot(timeseries(limit_acc_dmin.data(1:10:end,1:3:end),limit_acc_dmin.time(1:10:end)));
set(h(1),'LineStyle','--','Color','k');
set(h(2),'LineStyle','-.','Color','k');
hold on;
hline = refline(0,0);
hline.Color = [0.8,0.8,0.8];
h2 = plot(timeseries(max_acc2.data(1:10:end,1),max_acc2.time(1:10:end)));
set(h2,'LineStyle','-','Color','r');
xlabel('Time [s]');
ylabel('x acceleration [m/s^2]','Interpreter','tex');
legend([h(1) h(2) h2],{'upper limit','lower limit','required'},'Location','Southwest');
title('');
if (plot_tikz)
cleanfigure;
matlab2tikz('acc_x_limits_dmin.tikz','width','.8\textwidth');
end;
% y direction
scrsz = get(groot,'ScreenSize');
figure('OuterPosition',[scrsz(3)/2 0 scrsz(3)/2 scrsz(4)/3]);
% a_y limit and required acc for dmax
h = plot(timeseries(limit_acc_dmin.data(1:10:end,2:3:end),limit_acc_dmin.time(1:10:end)));
set(h(1),'LineStyle','--','Color','k');
set(h(2),'LineStyle','-.','Color','k');
hold on;
hline = refline(0,0);
hline.Color = [0.8,0.8,0.8];
h2 = plot(timeseries(max_acc2.data(1:10:end,2),max_acc2.time(1:10:end)));
set(h2,'LineStyle','-','Color','r');
xlabel('Time [s]');
ylabel('y acceleration [m/s^2]','Interpreter','tex');
legend([h(1) h(2) h2],{'upper limit','lower limit','required'},'Location','Southwest');
title('');
if (plot_tikz)
cleanfigure;
matlab2tikz('acc_y_limits_dmin.tikz','width','.8\textwidth');
end;
% z direction
scrsz = get(groot,'ScreenSize');
figure('OuterPosition',[scrsz(3)/2 0 scrsz(3)/2 scrsz(4)/3]);
% a_z limit and required acc for dmax
h = plot(timeseries(limit_acc_dmin.data(1:10:end,3:3:end),limit_acc_dmin.time(1:10:end)));
set(h(1),'LineStyle','--','Color','k');
set(h(2),'LineStyle','-.','Color','k');
hold on;
hline = refline(0,0);
hline.Color = [0.8,0.8,0.8];
h2 = plot(timeseries(max_acc2.data(1:10:end,3),max_acc2.time(1:10:end)));
set(h2,'LineStyle','-','Color','r');
xlabel('Time [s]');
ylabel('z acceleration [m/s^2]','Interpreter','tex');
legend([h(1) h(2) h2],{'upper limit','lower limit','required'},'Location','Southwest');
title('');
if (plot_tikz)
cleanfigure;
matlab2tikz('acc_z_limits_dmin.tikz','width','.8\textwidth');
end;