split plot into different files
just to generate nice pictures for the report + plus make gifs from animationsmaster
parent
6248525cbe
commit
6661dd8f52
Binary file not shown.
After Width: | Height: | Size: 60 KiB |
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
|
@ -0,0 +1,66 @@
|
|||
clc
|
||||
clear all
|
||||
close all
|
||||
|
||||
disp('Creating figure')
|
||||
figure
|
||||
disp('Photos will start in 3s')
|
||||
pause(3)
|
||||
|
||||
PLOT_TESTS = [
|
||||
%"results/straightline/chill/01-Aug-2024 15:34:03";
|
||||
%"results/straightline/chill_errortheta_pisixths/01-Aug-2024 15:56:36";
|
||||
%"results/square/01-Aug-2024 16:18:51";
|
||||
%"results/circle/start_center/01-Aug-2024 16:46:41";
|
||||
%"results/circle/start_tangent/01-Aug-2024 16:55:09";
|
||||
%"results/circle/toofast/01-Aug-2024 17:35:25"
|
||||
%"results/straightline/toofast/01-Aug-2024 15:37:48"
|
||||
%"results/figure8/chill/15-Aug-2024 09:16:21";
|
||||
%"results/figure8/toofast/15-Aug-2024 09:10:32"cd
|
||||
"results/straightline/abrupt_stop_chill/27-Aug-2024 10:27:31";
|
||||
"results/straightline/abrupt_stop_toofast/27-Aug-2024 10:44:35"
|
||||
"results/sin/no_start_error/27-Aug-2024 19:28:17";
|
||||
"results/sin/no_start_error/27-Aug-2024 19:29:42";
|
||||
"results/sin/no_start_error/27-Aug-2024 19:31:17";
|
||||
"results/sin/no_start_error/27-Aug-2024 19:38:03"
|
||||
]
|
||||
|
||||
s_ = size(PLOT_TESTS)
|
||||
for i = 1:s_(1)
|
||||
clearvars -except PLOT_TESTS s_ i
|
||||
|
||||
sPLOT_TEST = convertStringsToChars(PLOT_TESTS(i));
|
||||
PLOT_TEST = [sPLOT_TEST, '/workspace_composite.mat']
|
||||
load(PLOT_TEST)
|
||||
|
||||
dir = ['images/', sPLOT_TEST, '/']
|
||||
mkdir(dir);
|
||||
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'])
|
||||
%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'])
|
||||
%print([dir, num2str(n), '_track_input.png'], '-dpng')
|
||||
%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')
|
||||
clf; plot_input_diff(t{3}, U_corr{3}, U_corr{2},1)
|
||||
export_fig(gcf, '-transparent', [dir, num2str(n), 'corr_input_diff_2x1.eps'])
|
||||
%print([dir, 'corr_input_diff_2x1.png'], '-dpng')
|
||||
end
|
|
@ -0,0 +1,39 @@
|
|||
function plot_doubleinput(t, sat, U_track, U_corr)
|
||||
|
||||
tiledlayout(1,1,'Padding','tight', 'TileSpacing','compact')
|
||||
nexttile
|
||||
|
||||
subplot(2,1,1);
|
||||
hold on
|
||||
plot(t, U_track(:, 1), 'Linewidth', 5, 'DisplayName', '\omega_r^{track}');
|
||||
plot(t, U_corr(:, 1), 'Linewidth', 5, 'DisplayName', '\omega_r^{corr}');
|
||||
legend('FontSize', 12, 'Location', 'east', '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', '--');
|
||||
xlabel('\textbf{t[s]}', 'FontSize', 18, 'Interpreter','latex');
|
||||
hold off
|
||||
|
||||
|
||||
Axes = gca;
|
||||
Axes.FontSize=18;
|
||||
Axes.FontWeight='bold';
|
||||
grid minor;
|
||||
Axes.PlotBoxAspectRatio = [1 1 1];
|
||||
|
||||
subplot(2,1,2);
|
||||
hold on
|
||||
plot(t, U_track(:, 2), 'Linewidth', 5, 'DisplayName', '\omega_r^{track}');
|
||||
plot(t, U_corr(:, 2), 'Linewidth', 5, 'DisplayName', '\omega_r^{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', '--');
|
||||
xlabel('\textbf{t[s]}', 'FontSize', 18, 'Interpreter','latex');
|
||||
|
||||
Axes = gca;
|
||||
Axes.FontSize=18;
|
||||
Axes.FontWeight='bold';
|
||||
grid minor;
|
||||
Axes.PlotBoxAspectRatio = [1 1 1];
|
||||
|
||||
hold off
|
||||
end
|
|
@ -0,0 +1,21 @@
|
|||
function plot_error(t,ref,x)
|
||||
|
||||
ex = ref(:, 1) - x(:, 1);
|
||||
ey = ref(:, 2) - x(:, 2);
|
||||
|
||||
error_norm = sqrt(ex.*ex + ey.*ey);
|
||||
|
||||
|
||||
plot(t, error_norm, 'Linewidth', 5);
|
||||
|
||||
Axes = gca;
|
||||
Axes.FontSize=18;
|
||||
Axes.FontWeight='bold';
|
||||
Axes.PlotBoxAspectRatio = [1 1 1];
|
||||
grid minor;
|
||||
|
||||
xlabel("\textbf{t [s]}", FontSize=18, Interpreter="latex")
|
||||
ylabel("\textbf{norm of error [m]}", FontSize=18, Interpreter="latex")
|
||||
|
||||
|
||||
end
|
|
@ -0,0 +1,36 @@
|
|||
function plot_input(t, sat, U, type)
|
||||
|
||||
tiledlayout(1,1,'Padding','tight', 'TileSpacing','compact')
|
||||
nexttile
|
||||
|
||||
subplot(2,1,1);
|
||||
hold on
|
||||
plot(t, U(:, 1), 'Linewidth', 5);
|
||||
plot(t, ones(1,length(t))*sat(1), 'Linewidth', 2.5, 'LineStyle', '--');
|
||||
plot(t, -ones(1,length(t))*sat(1), 'Linewidth', 2.5, 'LineStyle', '--');
|
||||
xlabel('\textbf{t[s]}', 'FontSize', 18, 'Interpreter','latex');
|
||||
ylabel(['\textbf{$$w_r^{' type '}$$[rad/s]}'], 'FontSize', 18, 'Interpreter','latex');
|
||||
hold off
|
||||
|
||||
|
||||
Axes = gca;
|
||||
Axes.FontSize=18;
|
||||
Axes.FontWeight='bold';
|
||||
grid minor;
|
||||
Axes.PlotBoxAspectRatio = [1 1 1];
|
||||
|
||||
subplot(2,1,2);
|
||||
hold on
|
||||
plot(t, U(:, 2), 'Linewidth', 5);
|
||||
plot(t, ones(1,length(t))*sat(2), 'Linewidth', 2.5, 'LineStyle', '--');
|
||||
plot(t, -ones(1,length(t))*sat(2), 'Linewidth', 2.5, 'LineStyle', '--');
|
||||
xlabel('\textbf{t[s]}', 'FontSize', 18, 'Interpreter','latex');
|
||||
ylabel(['\textbf{$$w_l^{' type '}$$[rad/s]}'], 'FontSize', 18, 'Interpreter','latex');
|
||||
hold off
|
||||
|
||||
Axes = gca;
|
||||
Axes.FontSize=18;
|
||||
Axes.FontWeight='bold';
|
||||
grid minor;
|
||||
Axes.PlotBoxAspectRatio = [1 1 1];
|
||||
end
|
|
@ -0,0 +1,37 @@
|
|||
function plot_input(t, U_corr1, U_corr2, type)
|
||||
|
||||
tiledlayout(1,1,'Padding','tight', 'TileSpacing','compact')
|
||||
nexttile
|
||||
|
||||
if type == 0
|
||||
subplot(1,2,1);
|
||||
else
|
||||
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');
|
||||
|
||||
|
||||
Axes = gca;
|
||||
Axes.FontSize=18;
|
||||
Axes.FontWeight='bold';
|
||||
grid minor;
|
||||
Axes.PlotBoxAspectRatio = [1 1 1];
|
||||
|
||||
|
||||
if type == 0
|
||||
subplot(1,2,2);
|
||||
else
|
||||
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');
|
||||
|
||||
Axes = gca;
|
||||
Axes.FontSize=18;
|
||||
Axes.FontWeight='bold';
|
||||
grid minor;
|
||||
Axes.PlotBoxAspectRatio = [1 1 1];
|
||||
end
|
|
@ -0,0 +1,78 @@
|
|||
function plot_results(t, x, ref, U, U_track, U_corr)
|
||||
subplot(4,2,1)
|
||||
hold on
|
||||
title("trajectory / state")
|
||||
plot(ref(:, 1), ref(:, 2), "DisplayName", "Ref")
|
||||
plot(x(:, 1), x(:, 2), "DisplayName", "state")
|
||||
rectangle('Position', [x(1,1)-0.075, x(1,2)-0.075, 0.15, 0.15], 'Curvature', [1,1])
|
||||
xlabel('x')
|
||||
ylabel('y')
|
||||
legend()
|
||||
subplot(4,2,3)
|
||||
plot(t, U(:, 1))
|
||||
xlabel('t')
|
||||
ylabel('input wr')
|
||||
subplot(4,2,4)
|
||||
plot(t, U(:, 2))
|
||||
xlabel('t')
|
||||
ylabel('input wl')
|
||||
hold off
|
||||
|
||||
subplot(4,2,5)
|
||||
plot(t, U_corr(:, 1))
|
||||
xlabel('t')
|
||||
ylabel('correction input wr')
|
||||
subplot(4,2,6)
|
||||
plot(t, U_corr(:, 2))
|
||||
xlabel('t')
|
||||
ylabel('correction input wl')
|
||||
|
||||
|
||||
subplot(4,2,7)
|
||||
plot(t, U_track(:, 1))
|
||||
xlabel('t')
|
||||
ylabel('tracking input wr')
|
||||
subplot(4,2,8)
|
||||
plot(t, U_track(:, 2))
|
||||
xlabel('t')
|
||||
|
||||
ylabel('tracking input wl')
|
||||
|
||||
ex = ref(:, 1) - x(:, 1);
|
||||
ey = ref(:, 2) - x(:, 2);
|
||||
|
||||
subplot(8,8,5)
|
||||
hold on
|
||||
xlabel('t')
|
||||
ylabel('x')
|
||||
plot(t, ref(:, 1), "DisplayName", "X_{ref}");
|
||||
plot(t, x(:, 1), "DisplayName", "X");
|
||||
legend()
|
||||
hold off
|
||||
|
||||
subplot(8,8,6)
|
||||
plot(t, ex);
|
||||
xlabel('t')
|
||||
ylabel('x error')
|
||||
|
||||
subplot(8,8,13)
|
||||
hold on
|
||||
xlabel('t')
|
||||
ylabel('y')
|
||||
plot(t, ref(:, 2), "DisplayName", "Y_{ref}");
|
||||
plot(t, x(:, 2), "DisplayName", "Y");
|
||||
legend()
|
||||
hold off
|
||||
|
||||
subplot(8,8,14)
|
||||
plot(t, ey);
|
||||
xlabel('t')
|
||||
ylabel('y error')
|
||||
|
||||
subplot(4, 4, 4);
|
||||
error_norm = sqrt(ex.*ex + ey.*ey);
|
||||
plot(t, error_norm );
|
||||
xlabel("t")
|
||||
ylabel("error norm")
|
||||
|
||||
end
|
|
@ -0,0 +1,62 @@
|
|||
|
||||
% Plots
|
||||
function plot_results(t, x, ref, U, U_track, U_corr)
|
||||
subplot(4,2,1)
|
||||
plot_results(ref, x)
|
||||
subplot(4,2,3)
|
||||
plot(t, U(:, 1))
|
||||
xlabel('t [s]')
|
||||
ylabel('input w_r [rad/s]')
|
||||
subplot(4,2,4)
|
||||
plot(t, U(:, 2))
|
||||
xlabel('t')
|
||||
ylabel('input w_l [rad/s]')
|
||||
hold off
|
||||
|
||||
|
||||
|
||||
subplot(4,2,7)
|
||||
plot(t, U_track(:, 1))
|
||||
xlabel('t [s]')
|
||||
ylabel('tracking input w_r [rad/s]')
|
||||
subplot(4,2,8)
|
||||
plot(t, U_track(:, 2))
|
||||
xlabel('t [s]')
|
||||
|
||||
ylabel('tracking input w_l [rad/s]')
|
||||
|
||||
ex = ref(:, 1) - x(:, 1);
|
||||
ey = ref(:, 2) - x(:, 2);
|
||||
|
||||
subplot(8,8,5)
|
||||
hold on
|
||||
xlabel('t [s]')
|
||||
ylabel('x [n]')
|
||||
plot(t, ref(:, 1), "DisplayName", "X_{ref}");
|
||||
plot(t, x(:, 1), "DisplayName", "X");
|
||||
legend()
|
||||
hold off
|
||||
|
||||
subplot(8,8,6)
|
||||
plot(t, ex);
|
||||
xlabel('t')
|
||||
ylabel('x error')
|
||||
|
||||
subplot(8,8,13)
|
||||
hold on
|
||||
xlabel('t')
|
||||
ylabel('y')
|
||||
plot(t, ref(:, 2), "DisplayName", "Y_{ref}");
|
||||
plot(t, x(:, 2), "DisplayName", "Y");
|
||||
legend()
|
||||
hold off
|
||||
|
||||
subplot(8,8,14)
|
||||
plot(t, ey);
|
||||
xlabel('t')
|
||||
ylabel('y error')
|
||||
|
||||
subplot(4, 4, 4);
|
||||
plot_error(t, ref, x)
|
||||
|
||||
end
|
|
@ -0,0 +1,43 @@
|
|||
function tl = plot_trajectory(t, ref, x)
|
||||
|
||||
tl = tiledlayout(1,1,'Padding','tight', 'TileSpacing','compact');
|
||||
nexttile;
|
||||
|
||||
hold on
|
||||
grid minor
|
||||
label_interval = 1:1200:length(x);
|
||||
labels = strcat(num2str(round(t(label_interval),1)), "s");
|
||||
|
||||
%title("Reference trajectory / Robot position", "FontSize", 18)
|
||||
|
||||
plot(ref(:, 1), ref(:, 2), "DisplayName", "Reference trajectory", 'Color', 'blue', 'Linewidth', 12);
|
||||
%plot(x(:, 1), x(:, 2), "DisplayName", "Robot position", 'Color', 'green', 'Linewidth', 6);
|
||||
[x_arr, y_arr] = arrowed_line(x(:, 1), x(:, 2), 600, 50, 50);
|
||||
plot(x_arr, y_arr, "DisplayName", "Robot position", 'Color', 'green', 'Linewidth', 4);
|
||||
labelpoints(x(label_interval, 1), x(label_interval, 2), labels, 'N', 0.3, 'FontWeight', 'bold', 'FontSize', 15);
|
||||
|
||||
Axes = gca;
|
||||
Axes.FontSize=18;
|
||||
Axes.FontWeight='bold';
|
||||
|
||||
xlabel('\textbf{x [m]}', 'FontSize', 18, 'Interpreter', 'latex');
|
||||
ylabel('\textbf{y [m]}', 'FontSize', 18, 'Interpreter', 'latex');
|
||||
legend('FontSize', 12, 'Location', 'southeast', 'AutoUpdate','off')
|
||||
|
||||
|
||||
xlim = Axes.XLim;
|
||||
ylim = Axes.YLim;
|
||||
xl = xlim(2) - xlim(1);
|
||||
yl = ylim(2) - ylim(1);
|
||||
rx = 0.02 * abs(xl);
|
||||
ry = 0.02 * abs(yl);
|
||||
rectangle('Position', [x(1,1)-rx, x(1,2)-ry, 2*rx, 2*ry], 'Curvature', [1,1]);
|
||||
Axes.XLim = xlim;
|
||||
Axes.YLim = ylim;
|
||||
Axes.PlotBoxAspectRatio = [1 1 1];
|
||||
Axes.Units='normalized'
|
||||
Axes.OuterPosition = [0 0 1.25 1.25];
|
||||
|
||||
|
||||
hold off
|
||||
end
|
|
@ -0,0 +1,41 @@
|
|||
function plot_doubleinput(t, sat, U, U_track, U_corr)
|
||||
|
||||
tiledlayout(1,1,'Padding','tight', 'TileSpacing','compact')
|
||||
nexttile
|
||||
|
||||
subplot(2,1,1);
|
||||
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');
|
||||
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', '--');
|
||||
xlabel('\textbf{t[s]}', 'FontSize', 18, 'Interpreter','latex');
|
||||
hold off
|
||||
|
||||
|
||||
Axes = gca;
|
||||
Axes.FontSize=18;
|
||||
Axes.FontWeight='bold';
|
||||
grid minor;
|
||||
Axes.PlotBoxAspectRatio = [1 1 1];
|
||||
|
||||
subplot(2,1,2);
|
||||
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(:, 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', '--');
|
||||
plot(t, -ones(1,length(t))*sat(2), 'Linewidth', 2.5, 'LineStyle', '--');
|
||||
xlabel('\textbf{t[s]}', 'FontSize', 18, 'Interpreter','latex');
|
||||
|
||||
Axes = gca;
|
||||
Axes.FontSize=18;
|
||||
Axes.FontWeight='bold';
|
||||
grid minor;
|
||||
Axes.PlotBoxAspectRatio = [1 1 1];
|
||||
|
||||
hold off
|
||||
end
|
92
tesi.m
92
tesi.m
|
@ -3,7 +3,7 @@ clear all
|
|||
close all
|
||||
|
||||
%TESTS = ["sin_faster", "sin", "circle", "straightline", "reverse_straightline"]
|
||||
TESTS = ["straightline/backandforth"]
|
||||
TESTS = ["figure8/fancyreps"]
|
||||
|
||||
s_ = size(TESTS);
|
||||
|
||||
|
@ -54,6 +54,16 @@ for i = 1:s_(1)
|
|||
mkdir(f)
|
||||
savefig(h, [f '/figure.fig']);
|
||||
|
||||
h = [h, figure('Name', 'difference between 1step and multistep')]
|
||||
subplot(2,1,1)
|
||||
plot(t{2}, U_corr{2}(:, 1) - U_corr{3}(:, 1))
|
||||
xlabel('t')
|
||||
ylabel('difference on w_r between 1-step and multistep')
|
||||
subplot(2,1,2)
|
||||
plot(t{2}, U_corr{2}(:, 2) - U_corr{3}(:, 2))
|
||||
xlabel('t')
|
||||
ylabel('difference on w_l between 1-step and multistep')
|
||||
|
||||
clear h
|
||||
dsave([f '/workspace_composite.mat']);
|
||||
|
||||
|
@ -112,83 +122,3 @@ function [t, q, ref_t, U, U_track, U_corr, U_corr_pred_history, Q_pred] = simula
|
|||
end
|
||||
|
||||
%%
|
||||
|
||||
% Plots
|
||||
function plot_results(t, x, ref, U, U_track, U_corr)
|
||||
subplot(4,2,1)
|
||||
hold on
|
||||
title("trajectory / state")
|
||||
plot(ref(:, 1), ref(:, 2), "DisplayName", "Ref")
|
||||
plot(x(:, 1), x(:, 2), "DisplayName", "state")
|
||||
rectangle('Position', [x(1,1)-0.075, x(1,2)-0.075, 0.15, 0.15], 'Curvature', [1,1])
|
||||
xlabel('x')
|
||||
ylabel('y')
|
||||
legend()
|
||||
subplot(4,2,3)
|
||||
plot(t, U(:, 1))
|
||||
xlabel('t')
|
||||
ylabel('input w_r')
|
||||
subplot(4,2,4)
|
||||
plot(t, U(:, 2))
|
||||
xlabel('t')
|
||||
ylabel('input w_l')
|
||||
hold off
|
||||
|
||||
subplot(4,2,5)
|
||||
plot(t, U_corr(:, 1))
|
||||
xlabel('t')
|
||||
ylabel('correction input w_r')
|
||||
subplot(4,2,6)
|
||||
plot(t, U_corr(:, 2))
|
||||
xlabel('t')
|
||||
ylabel('correction input w_l')
|
||||
|
||||
|
||||
subplot(4,2,7)
|
||||
plot(t, U_track(:, 1))
|
||||
xlabel('t')
|
||||
ylabel('tracking input w_r')
|
||||
subplot(4,2,8)
|
||||
plot(t, U_track(:, 2))
|
||||
xlabel('t')
|
||||
|
||||
ylabel('tracking input w_l')
|
||||
|
||||
ex = ref(:, 1) - x(:, 1);
|
||||
ey = ref(:, 2) - x(:, 2);
|
||||
|
||||
subplot(8,8,5)
|
||||
hold on
|
||||
xlabel('t')
|
||||
ylabel('x')
|
||||
plot(t, ref(:, 1), "DisplayName", "X_{ref}");
|
||||
plot(t, x(:, 1), "DisplayName", "X");
|
||||
legend()
|
||||
hold off
|
||||
|
||||
subplot(8,8,6)
|
||||
plot(t, ex);
|
||||
xlabel('t')
|
||||
ylabel('x error')
|
||||
|
||||
subplot(8,8,13)
|
||||
hold on
|
||||
xlabel('t')
|
||||
ylabel('y')
|
||||
plot(t, ref(:, 2), "DisplayName", "Y_{ref}");
|
||||
plot(t, x(:, 2), "DisplayName", "Y");
|
||||
legend()
|
||||
hold off
|
||||
|
||||
subplot(8,8,14)
|
||||
plot(t, ey);
|
||||
xlabel('t')
|
||||
ylabel('y error')
|
||||
|
||||
subplot(4, 4, 4);
|
||||
error_norm = sqrt(ex.*ex + ey.*ey);
|
||||
plot(t, error_norm );
|
||||
xlabel("t")
|
||||
ylabel("error norm")
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TEST = 'cardioid'
|
||||
CONTROLLER = 2
|
||||
CONTROLLER = 3
|
||||
|
||||
|
||||
sim_data = load(['tests/' TEST '/common.mat']);
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,45 @@
|
|||
|
||||
clear all
|
||||
|
||||
disp('Waiting 5s')
|
||||
pause(1)
|
||||
|
||||
PLOT_TESTS = [
|
||||
"results/straightline/chill/01-Aug-2024 15:34:03";
|
||||
"results/straightline/chill_errortheta_pisixths/01-Aug-2024 15:56:36";
|
||||
"results/square/01-Aug-2024 16:18:51";
|
||||
"results/circle/start_center/01-Aug-2024 16:46:41";
|
||||
"results/circle/start_tangent/01-Aug-2024 16:55:09";
|
||||
"results/circle/toofast/01-Aug-2024 17:35:25"
|
||||
"results/straightline/toofast/01-Aug-2024 15:37:48"
|
||||
"results/figure8/chill/15-Aug-2024 09:16:21";
|
||||
"results/figure8/toofast/15-Aug-2024 09:10:32";
|
||||
"results/straightline/abrupt_stop_chill/27-Aug-2024 10:27:31";
|
||||
"results/straightline/abrupt_stop_toofast/27-Aug-2024 10:44:35"
|
||||
"results/cardioid/start_tangent/01-Aug-2024 18:53:41";
|
||||
"results/figure8/fancyreps/09-Aug-2024 13:04:44";
|
||||
"results/sin/no_start_error/27-Aug-2024 19:28:17";
|
||||
"results/sin/no_start_error/27-Aug-2024 19:29:42";
|
||||
"results/sin/no_start_error/27-Aug-2024 19:31:17";
|
||||
"results/sin/no_start_error/27-Aug-2024 19:38:03"
|
||||
|
||||
]
|
||||
|
||||
s_ = size(PLOT_TESTS)
|
||||
for i = 1:s_(1)
|
||||
clearvars -except PLOT_TESTS s_ i
|
||||
|
||||
sPLOT_TEST = convertStringsToChars(PLOT_TESTS(i));
|
||||
PLOT_TEST = [sPLOT_TEST, '/workspace_composite.mat']
|
||||
load(PLOT_TEST)
|
||||
|
||||
dir = ['gifs/', sPLOT_TEST, '/']
|
||||
mkdir(dir);
|
||||
|
||||
close all; pause(2); video(q{1}', ref_t{1}', Q_pred{1}, U_track{1}, U_corr{1}, 0, 0.12, t{1}, 4, sim_data{1}.tc*0.25, "track only");
|
||||
close all; pause(2); video(q{2}', ref_t{2}', Q_pred{2}, U_track{2}, U_corr{2}, 1, 0.12, t{2}, 4, sim_data{2}.tc*0.25, "track and 1-step");
|
||||
close all; pause(2); video(q{3}', ref_t{3}', Q_pred{3}, U_track{3}, U_corr{3}, 3, 0.12, t{3}, 4, sim_data{3}.tc*0.25, "track and multistep");
|
||||
|
||||
movefile("*.gif", dir);
|
||||
|
||||
end
|
Loading…
Reference in New Issue