plots: horizontal and vertical inputs

master
= 2024-08-31 13:31:35 +02:00
parent 0ecae887f7
commit 9cf24a1983
5 changed files with 60 additions and 34 deletions

View File

@ -3,26 +3,26 @@ clear all
close all
disp('Creating figure')
figure
figure('units','normalized','outerposition',[0 0 1 1])
disp('Photos will start in 3s')
pause(3)
PLOT_TESTS = [
%"results-diffdrive/straightline/chill/01-Aug-2024 15-34-03";
%"results-diffdrive/straightline/chill_errortheta_pisixths/01-Aug-2024 15-56-36";
%"results-diffdrive/square/01-Aug-2024 16-18-51";
%"results-diffdrive/circle/start_center/01-Aug-2024 16-46-41";
%"results-diffdrive/circle/start_tangent/01-Aug-2024 16-55-09";
%"results-diffdrive/circle/toofast/01-Aug-2024 17-35-25"
%"results-diffdrive/straightline/toofast/01-Aug-2024 15-37-48"
%"results-diffdrive/figure8/chill/15-Aug-2024 09-16-21";
%"results-diffdrive/figure8/toofast/15-Aug-2024 09-10-32"cd
"results-diffdrive/straightline/chill/01-Aug-2024 15-34-03";
"results-diffdrive/straightline/chill_errortheta_pisixths/01-Aug-2024 15-56-36";
"results-diffdrive/square/01-Aug-2024 16-18-51";
"results-diffdrive/circle/start_center/01-Aug-2024 16-46-41";
"results-diffdrive/circle/start_tangent/01-Aug-2024 16-55-09";
"results-diffdrive/circle/toofast/01-Aug-2024 17-35-25";
"results-diffdrive/straightline/toofast/01-Aug-2024 15-37-48";
"results-diffdrive/figure8/chill/15-Aug-2024 09-16-21";
"results-diffdrive/figure8/toofast/15-Aug-2024 09-10-32";
"results-diffdrive/straightline/abrupt_stop_chill/27-Aug-2024 10-27-31";
"results-diffdrive/straightline/abrupt_stop_toofast/27-Aug-2024 10-44-35"
"results-diffdrive/straightline/abrupt_stop_toofast/27-Aug-2024 10-44-35";
"results-diffdrive/sin/no_start_error/27-Aug-2024 19-28-17";
"results-diffdrive/sin/no_start_error/27-Aug-2024 19-29-42";
"results-diffdrive/sin/no_start_error/27-Aug-2024 19-31-17";
"results-diffdrive/sin/no_start_error/27-Aug-2024 19-38-03"
"results-diffdrive/sin/no_start_error/27-Aug-2024 19-38-03";
]
s_ = size(PLOT_TESTS)
@ -38,10 +38,17 @@ for i = 1:s_(1)
for n=1:3
clf; plot_trajectory(t{n}, ref_t{n}, q{n})
export_fig(gcf, '-transparent', [dir, num2str(n), '_trajectory.eps'])
%exportgraphics(gcf, [dir, num2str(n), '_trajectory.png'], Resolution=300);
%print([dir, num2str(n), '_trajectory.png'], '-dpng')
clf; plot_error(t{n}, ref_t{n}, q{n})
export_fig(gcf, '-transparent', [dir, num2str(n), '_error.eps'])
clf; plot_doubleinput(t{n}, sim_data{n}.SATURATION, U_track{n}, U_corr{n}, 0)
export_fig(gcf, '-transparent', [dir, num2str(n), '_double_input_1x2.eps'])
clf; plot_doubleinput(t{n}, sim_data{n}.SATURATION, U_track{n}, U_corr{n}, 1)
export_fig(gcf, '-transparent', [dir, num2str(n), '_double_input_2x1.eps'])
clf; plot_tripleinput(t{n}, sim_data{n}.SATURATION, U{n}, U_track{n}, U_corr{n}, 0)
export_fig(gcf, '-transparent', [dir, num2str(n), '_triple_input_1x2.eps'])
clf; plot_tripleinput(t{n}, sim_data{n}.SATURATION, U{n}, U_track{n}, U_corr{n}, 1)
export_fig(gcf, '-transparent', [dir, num2str(n), '_triple_input_2x1.eps'])
%print([dir, num2str(n), '_error.png'], '-dpng')
%clf; plot_input(t{n}, sim_data{n}.SATURATION, U_track{n}, 'track')
%export_fig(gcf, '-transparent', [dir, num2str(n), '_track_input.eps'])
@ -49,14 +56,12 @@ for i = 1:s_(1)
%clf; plot_input(t{n}, sim_data{n}.SATURATION, U_corr{n}, 'corr')
%export_fig(gcf, '-transparent', [dir, num2str(n), '_corr_input.eps'])
%print([dir, num2str(n), '_corr_input.png'], '-dpng')
clf; plot_doubleinput(t{n}, sim_data{n}.SATURATION, U_track{n}, U_corr{n})
export_fig(gcf, '-transparent', [dir, num2str(n), '_double_input.eps'])
clf; plot_tripleinput(t{n}, sim_data{n}.SATURATION, U{n}, U_track{n}, U_corr{n})
export_fig(gcf, '-transparent', [dir, num2str(n), '_triple_input.eps'])
%clf; plot_input(t{n},sim_data{n}.SATURATION, U{n}, '')
%export_fig(gcf, '-transparent', [dir, num2str(n), '_total_input.eps'])
%print([dir, num2str(n), '_total_input.png'], '-dpng')
end
clf; plot_input_diff(t{3}, U_corr{3}, U_corr{2},0)
export_fig(gcf, '-transparent', [dir, num2str(n), 'corr_input_diff_1x2.eps'])
%print([dir, 'corr_input_diff_1x2.png'], '-dpng')

View File

@ -1,9 +1,15 @@
function plot_doubleinput(t, sat, U_track, U_corr)
function plot_doubleinput(t, sat, U_track, U_corr, type)
tiledlayout(1,1,'Padding','tight', 'TileSpacing','compact')
nexttile
if type == 0
subplot(1,2,1);
else
subplot(2,1,1);
end
hold on
plot(t, U_track(:, 1), 'Linewidth', 5, 'DisplayName', '\omega_r^{track}');
plot(t, U_corr(:, 1), 'Linewidth', 5, 'DisplayName', '\omega_r^{corr}');
@ -20,10 +26,16 @@ Axes.FontWeight='bold';
grid minor;
Axes.PlotBoxAspectRatio = [1 1 1];
if type == 0
subplot(1,2,2);
else
subplot(2,1,2);
end
hold on
plot(t, U_track(:, 2), 'Linewidth', 5, 'DisplayName', '\omega_r^{track}');
plot(t, U_corr(:, 2), 'Linewidth', 5, 'DisplayName', '\omega_r^{corr}');
plot(t, U_track(:, 2), 'Linewidth', 5, 'DisplayName', '\omega_l^{track}');
plot(t, U_corr(:, 2), 'Linewidth', 5, 'DisplayName', '\omega_l^{corr}');
legend('FontSize', 12, 'Location', 'east', 'AutoUpdate','off')
plot(t, ones(1,length(t))*sat(2), 'Linewidth', 2.5, 'LineStyle', '--');
plot(t, -ones(1,length(t))*sat(2), 'Linewidth', 2.5, 'LineStyle', '--');

View File

@ -10,8 +10,7 @@ subplot(2,1,1);
end
plot(t, U_corr1(:, 1) - U_corr2(:,1), 'Linewidth', 5);
xlabel('\textbf{t[s]}', 'FontSize', 24, 'Interpreter','latex');
ylabel('\textbf{$$w_r^{corr, multistep}$$} - \textbf{$$w_r^{corr, 1step}$$ [rad/s]}', 'FontSize', 18, 'Interpreter','latex');
ylabel('\textbf{$$\omega_r^{corr, multistep}$$} - \textbf{$$\omega_r^{corr, 1step}$$ [rad/s]}', 'FontSize', 18, 'Interpreter','latex');
Axes = gca;
Axes.FontSize=18;
@ -27,7 +26,7 @@ subplot(2,1,2);
end
plot(t, U_corr1(:, 2) - U_corr2(:,2), 'Linewidth', 5);
xlabel('\textbf{t[s]}', 'FontSize', 24, 'Interpreter','latex');
ylabel('\textbf{$$w_l^{corr, multistep}$$} - \textbf{$$w_l^{corr, 1step}$$ [rad/s]}', 'FontSize', 18, 'Interpreter','latex');
ylabel('\textbf{$$\omega_l^{corr, multistep}$$} - \textbf{$$\omega_l^{corr, 1step}$$ [rad/s]}', 'FontSize', 18, 'Interpreter','latex');
Axes = gca;
Axes.FontSize=18;

View File

@ -1,13 +1,19 @@
function plot_doubleinput(t, sat, U, U_track, U_corr)
function plot_doubleinput(t, sat, U, U_track, U_corr, type)
tiledlayout(1,1,'Padding','tight', 'TileSpacing','compact')
nexttile
if type == 0
subplot(1,2,1);
else
subplot(2,1,1);
end
hold on
plot(t, U_track(:, 1), 'Linewidth', 5, 'DisplayName', '\omega_r^{track}');
plot(t, U_corr(:, 1), 'Linewidth', 5, 'DisplayName', '\omega_r^{corr}');
plot(t, U(:, 1), 'Linewidth', 2.8, 'DisplayName', '\omega_r');
plot(t, U(:, 1), 'Linewidth', 2.8, 'DisplayName', '\omega');
legend('FontSize', 12, 'Location', 'northeast', 'AutoUpdate','off')
plot(t, ones(1,length(t))*sat(1), 'Linewidth', 2.5, 'LineStyle', '--');
plot(t, -ones(1,length(t))*sat(1), 'Linewidth', 2.5, 'LineStyle', '--');
@ -21,10 +27,16 @@ Axes.FontWeight='bold';
grid minor;
Axes.PlotBoxAspectRatio = [1 1 1];
if type == 0
subplot(1,2,2);
else
subplot(2,1,2);
end
hold on
plot(t, U_track(:, 2), 'Linewidth', 5, 'DisplayName', '\omega_r^{track}');
plot(t, U_corr(:, 2), 'Linewidth', 5, 'DisplayName', '\omega_r^{corr}');
plot(t, U_track(:, 2), 'Linewidth', 5, 'DisplayName', '\omega_l^{track}');
plot(t, U_corr(:, 2), 'Linewidth', 5, 'DisplayName', '\omega_l^{corr}');
plot(t, U(:, 2), 'Linewidth', 2.8, 'DisplayName', '\omega_l');
legend('FontSize', 12, 'Location', 'northeast', 'AutoUpdate','off')
plot(t, ones(1,length(t))*sat(2), 'Linewidth', 2.5, 'LineStyle', '--');

View File

@ -10,18 +10,16 @@ PLOT_TESTS = [
"results-diffdrive/square/01-Aug-2024 16-18-51";
"results-diffdrive/circle/start_center/01-Aug-2024 16-46-41";
"results-diffdrive/circle/start_tangent/01-Aug-2024 16-55-09";
"results-diffdrive/circle/toofast/01-Aug-2024 17-35-25"
"results-diffdrive/straightline/toofast/01-Aug-2024 15-37-48"
"results-diffdrive/circle/toofast/01-Aug-2024 17-35-25";
"results-diffdrive/straightline/toofast/01-Aug-2024 15-37-48";
"results-diffdrive/figure8/chill/15-Aug-2024 09-16-21";
"results-diffdrive/figure8/toofast/15-Aug-2024 09-10-32";
"results-diffdrive/straightline/abrupt_stop_chill/27-Aug-2024 10-27-31";
"results-diffdrive/straightline/abrupt_stop_toofast/27-Aug-2024 10-44-35"
"results-diffdrive/cardioid/start_tangent/01-Aug-2024 18-53-41";
"results-diffdrive/figure8/fancyreps/09-Aug-2024 13-04-44";
"results-diffdrive/straightline/abrupt_stop_toofast/27-Aug-2024 10-44-35";
"results-diffdrive/sin/no_start_error/27-Aug-2024 19-28-17";
"results-diffdrive/sin/no_start_error/27-Aug-2024 19-29-42";
"results-diffdrive/sin/no_start_error/27-Aug-2024 19-31-17";
"results-diffdrive/sin/no_start_error/27-Aug-2024 19-38-03"
"results-diffdrive/sin/no_start_error/27-Aug-2024 19-38-03";
]
s_ = size(PLOT_TESTS)