This commit is contained in:
2026-03-17 22:15:42 -07:00
parent 8c3b853895
commit f23675a54c
4 changed files with 36 additions and 20 deletions

1
.gitignore vendored
View File

@@ -48,6 +48,7 @@ sandbox/*
# Figures
*.fig
*.png
# Python Virtual Environment
aerpaw/venv/

View File

@@ -100,7 +100,7 @@ hBar = bar(x1, C_mean);
hold(x1, 'on');
for jj = 1:nConfigsPerN
xPos = hBar(jj).XEndPoints;
errorbar(x1, xPos, C_mean(:, jj), C_var(:, jj), 'k.', 'LineWidth', 1, 'HandleVisibility', 'off');
errorbar(x1, xPos, C_mean(:, jj), C_var(:, jj), 'k.', 'LineWidth', 1, 'HandleVisibility', 'off'); % disabled the error bars because they are small to the point of meaninglessness
end
hold(x1, 'off');
set(x1, 'XTickLabel', string(n_unique));
@@ -111,6 +111,9 @@ legend(["$AI\alpha$"; "$AI\beta$"; "$AII\alpha$"; "$BI\beta$"], "Interpreter", "
grid("on");
ylim([0, 1/2]);
savefig(f1, "plot1.fig");
exportgraphics(f1, "plot1.png");
%%
f2 = figure;
x2 = axes;
@@ -181,3 +184,6 @@ grid(x2, "on");
yline(collisionRadius, 'r--', "Label", "Collision Radius", "LabelHorizontalAlignment", "left", "HandleVisibility", "off");
yline(commsRadius, 'r--', "Label", "Communications Radius", "LabelHorizontalAlignment", "left", "HandleVisibility", "off");
ylim([0, commsRadius + 5]);
savefig(f2, "plot2.fig");
exportgraphics(f2, "plot2.png");

View File

@@ -19,10 +19,10 @@ x3 = axes;
assert(size(init.objectivePos, 1) == 1)
assert(hist.useDoubleIntegrator);
plot(hist.perf./init.objectiveIntegral);
plot(hist.perf./init.objectiveIntegral, "LineWidth", 2);
hold("on");
for ii = 1:length(hist.agent)
plot(hist.agent(ii).perf./init.objectiveIntegral);
plot(hist.agent(ii).perf./init.objectiveIntegral, "LineWidth", 2);
end
grid("on");
ylabel("Performance (normalized)");
@@ -30,6 +30,9 @@ xlabel("Timestep");
legend(["Cumulative"; "Agent 1"; "Agent 2"; "Agent 3"; "Agent 4"], "Location", "northwest");
title("$AII\beta$ Performance", "Interpreter", "latex");
savefig(f3, "plot3.fig");
exportgraphics(f3, "plot3.png");
f4 = figure;
x4 = axes;
@@ -55,7 +58,7 @@ end
hold(x4, 'on');
hLeft = gobjects(nPairs, 1);
for pp = 1:nPairs
hLeft(pp) = plot(x4, pairDistMat(:, pp), 'LineWidth', 1);
hLeft(pp) = plot(x4, pairDistMat(:, pp), 'LineWidth', 2);
end
yline(x4, collisionRadius, 'r--', "Label", "Collision Radius", "LabelHorizontalAlignment", "left", "HandleVisibility", "off");
yline(x4, commsRadius, 'r--', "Label", "Communications Radius", "LabelHorizontalAlignment", "left", "HandleVisibility", "off");
@@ -75,7 +78,11 @@ for jj = 1:nAgents-1
pairLabels(pp) = sprintf("Agents %d-%d Distance", jj, kk);
end
end
% Left legend created after right-axis plots (see below)
l = legend(hLeft(:), pairLabels(:), "Location", "northeast");
savefig(f4, "plot4_distanceOnly.fig");
exportgraphics(f4, "plot4_distanceOnly.png");
% Plot all barrier function values on right Y-axis
nObs = init.numObstacles;
@@ -102,32 +109,34 @@ comStart = domStart + nAD;
hRight = gobjects(0, 1);
rightLabels = strings(0, 1);
for pp = 1:nAA
hRight(end+1) = plot(x4, hist.barriers(colStart + pp - 1, :), '--', 'LineWidth', 1, 'Color', pairColors(pp, :));
hRight(end+1) = plot(x4, hist.barriers(colStart + pp - 1, :), '--', 'LineWidth', 1.5, 'Color', pairColors(pp, :));
rightLabels(end+1) = sprintf('h_{col} %d', pp);
end
for pp = 1:nComms
hRight(end+1) = plot(x4, hist.barriers(comStart + pp - 1, :), '-', 'LineWidth', 1.5, 'Color', pairColors(pp, :));
hRight(end+1) = plot(x4, hist.barriers(comStart + pp - 1, :), '-.', 'LineWidth', 1.5, 'Color', pairColors(pp, :));
rightLabels(end+1) = sprintf('h_{com} %d', pp);
end
% Obstacle barriers colored by agent
idx = obsStart;
for aa = 1:nAgents
for oo = 1:nObs
hRight(end+1) = plot(x4, hist.barriers(idx, :), ':', 'LineWidth', 1, 'Color', agentColors(aa, :));
rightLabels(end+1) = sprintf('h_{obs} a%d-o%d', aa, oo);
idx = idx + 1;
end
end
% idx = obsStart;
% for aa = 1:nAgents
% for oo = 1:nObs
% hRight(end+1) = plot(x4, hist.barriers(idx, :), ':', 'LineWidth', 1, 'Color', agentColors(aa, :));
% rightLabels(end+1) = sprintf('h_{obs} a%d-o%d', aa, oo);
% idx = idx + 1;
% end
% end
hold(x4, 'off');
ylabel(x4, "Barrier function $h$", "Interpreter", "latex");
% Clamp both Y-axes to start at 0
yyaxis(x4, 'left'); ylim(x4, [0, 25]);
yyaxis(x4, 'right'); ylim(x4, [0, inf]);
yyaxis(x4, 'right'); ylim(x4, [0, 275]);
x4.YAxis(2).Color = 'k';
% Combined legend
legend([hLeft(:); hRight(:)], [pairLabels(:); rightLabels(:)], "Location", "eastoutside");
l = legend([hLeft(:); hRight(:)], [pairLabels(:); rightLabels(:)], "Location", "eastoutside");
savefig(f4, "plot4.fig");
exportgraphics(f4, "plot4.png");

View File

@@ -10,8 +10,8 @@ classdef results < matlab.unittest.TestCase
%% Diagnostic Parameters
% No effect on simulation dynamics
makeVideo = false; % disable video writing for big performance increase
makePlots = false; % disable plotting for big performance increase (also disables video)
makeVideo = true; % disable video writing for big performance increase
makePlots = true; % disable plotting for big performance increase (also disables video)
plotCommsGeometry = false; % disable plotting communications geometries
%% Scenario Reinitialization