analysis script fixes

This commit is contained in:
2026-04-06 21:34:48 -07:00
parent f7902ee220
commit 87060ca123
4 changed files with 28 additions and 7 deletions
+6 -1
View File
@@ -163,6 +163,11 @@
<Size type="coderapp.internal.codertype.Dimension"/> <Size type="coderapp.internal.codertype.Dimension"/>
<Size type="coderapp.internal.codertype.Dimension"/> <Size type="coderapp.internal.codertype.Dimension"/>
</Types> </Types>
<Types id="33" type="coderapp.internal.codertype.PrimitiveType">
<ClassName>int32</ClassName>
<Size type="coderapp.internal.codertype.Dimension"/>
<Size type="coderapp.internal.codertype.Dimension"/>
</Types>
</Types> </Types>
</coderapp.internal.interface.project.Interface> </coderapp.internal.interface.project.Interface>
</MF0> </MF0>
@@ -1178,7 +1183,7 @@
</Artifacts> </Artifacts>
<BuildFolder type="coderapp.internal.util.mfz.FileSpec"/> <BuildFolder type="coderapp.internal.util.mfz.FileSpec"/>
<Success>true</Success> <Success>true</Success>
<Timestamp>2026-04-05T14:48:49</Timestamp> <Timestamp>2026-04-06T20:46:55</Timestamp>
</MainBuildResult> </MainBuildResult>
</coderapp.internal.mlc.mfz.MatlabCoderProjectState> </coderapp.internal.mlc.mfz.MatlabCoderProjectState>
</MF0> </MF0>
+18 -2
View File
@@ -42,9 +42,10 @@ end
% TRANSIT_ALT_STEP must exceed 2 * max(collisionRadius). % TRANSIT_ALT_STEP must exceed 2 * max(collisionRadius).
% Waypoint 1: each UAV flies to (finalX, finalY) at its unique transit altitude. % Waypoint 1: each UAV flies to (finalX, finalY) at its unique transit altitude.
% Waypoint 2: each UAV adjusts to its actual target altitude. % Waypoint 2: each UAV adjusts to its actual target altitude.
% These constants are also used for the altitude-staggered return before RTL.
TRANSIT_ALT_BASE = 25.0; % must match drone.takeoff() altitude in uav_runner.py
TRANSIT_ALT_STEP = 25; % vertical separation per UAV (m); must exceed 2*collisionRadius
if ~coder.target('MATLAB') if ~coder.target('MATLAB')
TRANSIT_ALT_BASE = 25.0; % must match drone.takeoff() altitude in uav_runner.py
TRANSIT_ALT_STEP = 25; % vertical separation per UAV (m); must exceed 2*collisionRadius
for ii = double(totalLoaded):-1:1 for ii = double(totalLoaded):-1:1
transitRow = (ii - 1) * 2 + 1; transitRow = (ii - 1) * 2 + 1;
finalRow = (ii - 1) * 2 + 2; finalRow = (ii - 1) * 2 + 2;
@@ -190,6 +191,21 @@ if ~coder.target('MATLAB')
end end
% -------------------------------------------------------------------------- % --------------------------------------------------------------------------
% Altitude-staggered return: separate UAVs vertically before issuing RTL,
% mirroring the initial positioning stagger so UAVs transit laterally at
% unique altitudes and cannot collide during the return flight.
if ~coder.target('MATLAB')
for i = 1:numClients
transitAlt = TRANSIT_ALT_BASE + (double(i) - 1) * TRANSIT_ALT_STEP;
target = [positions(i, 1), positions(i, 2), transitAlt];
coder.ceval('sendTarget', int32(i), coder.ref(target));
end
coder.ceval('waitForAllMessageType', int32(numClients), int32(MESSAGE_TYPE.ACK));
coder.ceval('waitForAllMessageType', int32(numClients), int32(MESSAGE_TYPE.READY));
else
disp('Altitude-staggered return (simulation): UAVs commanded to transit altitudes.');
end
% Send RTL command to all clients % Send RTL command to all clients
for i = 1:numClients for i = 1:numClients
if coder.target('MATLAB') if coder.target('MATLAB')
+1 -1
View File
@@ -79,7 +79,7 @@ function [f, G] = plotGpsLogs(logDirs, seaToGroundLevel, plotWholeFlight)
fprintf("Minimum distance between agents %d and %d is %2.3f\n", ii, jj, min(d)); fprintf("Minimum distance between agents %d and %d is %2.3f\n", ii, jj, min(d));
if min(d) < 6 if min(d) < 6
warning("Minimum distance between agents %d and %d of %2.3f is questionable for AERPAW", ii, jj, min(d); warning("Minimum distance between agents %d and %d of %2.3f is questionable for AERPAW", ii, jj, min(d));
end end
end end
+3 -3
View File
@@ -1,5 +1,5 @@
%% Plot AERPAW logs (trajectory, radio) %% Plot AERPAW logs (trajectory, radio)
resultsPath = fullfile(matlab.project.rootProject().RootFolder, "sandbox", "two_around_wall"); % Define path to results copied from AERPAW platform resultsPath = fullfile(matlab.project.rootProject().RootFolder, "sandbox", "test2"); % Define path to results copied from AERPAW platform
% Measure intervals between issuing commands from the controller % Measure intervals between issuing commands from the controller
% (make sure this is ~4-5 seconds at minimum to avoid overwhelming the UAV autopilot) % (make sure this is ~4-5 seconds at minimum to avoid overwhelming the UAV autopilot)
@@ -16,8 +16,8 @@ fprintf("Minimum command spacing: %2.3f seconds\n", seconds(min(dt)));
fprintf("Maximum command spacing: %2.3f seconds\n", seconds(max(dt))); fprintf("Maximum command spacing: %2.3f seconds\n", seconds(max(dt)));
fprintf("Mean command spacing: %2.3f seconds\n", seconds(mean(dt))); fprintf("Mean command spacing: %2.3f seconds\n", seconds(mean(dt)));
fprintf("Median command spacing: %2.3f seconds\n", seconds(median(dt))); fprintf("Median command spacing: %2.3f seconds\n", seconds(median(dt)));
if seconds(min(dt)) > 4 if seconds(min(dt)) < 4
warning("Minimum command spacing %2.3f questionably short for AERPAW", min(dt)); warning("Minimum command spacing %2.3f questionably short for AERPAW", seconds(min(dt)));
end end
% Plot GPS logged data and scenario information (domain, objective, obstacles) % Plot GPS logged data and scenario information (domain, objective, obstacles)