added minimum command spacing log parser and check

This commit is contained in:
2026-04-06 18:16:00 -07:00
parent 9564a5707f
commit f3f9ec3db2
5 changed files with 44 additions and 1 deletions
+19
View File
@@ -0,0 +1,19 @@
function T = readControllerLogs(filepath)
arguments (Input)
filepath (1, 1) string;
end
arguments (Output)
T table;
end
assert(isfile(filepath), "File not found at %s", filepath);
T = readtable(filepath);
T.Var1 = datetime(strip(strip(append(T.Var1, " ", T.Var2), 'left', '['), 'right', ']'), "InputFormat", "yyyy-MM-dd HH:mm:ss.SSSSSS");
T.Var2 = [];
T.Var3 = strip(append(T.Var3, " ", T.Var4, " ", T.Var5, " ", T.Var6, " ", string(T.Var7), " ", T.Var8, " ", T.Var9));
T.Var4 = []; T.Var5 = []; T.Var6 = []; T.Var7 = []; T.Var8 = []; T.Var9 = [];
T.Properties.VariableNames{1} = 'timestamp';
T.Properties.VariableNames{2} = 'message';
T(ismissing(T.message), :) = [];
end
-1
View File
@@ -2,7 +2,6 @@ function R = readRadioLogs(logPath)
arguments (Input) arguments (Input)
logPath (1, 1) string {isfolder(logPath)}; logPath (1, 1) string {isfolder(logPath)};
end end
arguments (Output) arguments (Output)
R (:, 8) table; R (:, 8) table;
end end
+17
View File
@@ -1,6 +1,23 @@
%% 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", "two_around_wall"); % Define path to results copied from AERPAW platform
% Measure intervals between issuing commands from the controller
% (make sure this is ~4-5 seconds at minimum to avoid overwhelming the UAV autopilot)
r = dir(resultsPath);
controllerPath = fullfile(r(startsWith({r.name}, 'controller_')).folder, r(startsWith({r.name}, 'controller_')).name);
controllerPath = dir(controllerPath);
controllerPath = fullfile(controllerPath(endsWith({controllerPath.name}, '_controller_log.txt')).folder, controllerPath(endsWith({controllerPath.name}, '_controller_log.txt')).name);
controller = readControllerLogs(controllerPath);
rpIdx = startsWith(controller.message, "Sent REQUEST_POSITION to client 1");
rpTimes = controller.timestamp(rpIdx);
dt = diff(rpTimes);
dt.Format = "mm:ss.SSS";
fprintf("Minimum command spacing: %2.3f seconds\n", seconds(min(dt)));
fprintf("Maximum command spacing: %2.3f seconds\n", seconds(max(dt)));
fprintf("Mean command spacing: %2.3f seconds\n", seconds(mean(dt)));
fprintf("Median command spacing: %2.3f seconds\n", seconds(median(dt)));
assert(seconds(min(dt)) > 4, "Minimum command spacing questionably short");
% Plot GPS logged data and scenario information (domain, objective, obstacles) % Plot GPS logged data and scenario information (domain, objective, obstacles)
seaToGroundLevel = 110; % measured approximately from USGS national map viewer seaToGroundLevel = 110; % measured approximately from USGS national map viewer
plotWholeFlight = true; % do not attempt to automatically trim initial and final positioning and landing from flight plot (buggy) plotWholeFlight = true; % do not attempt to automatically trim initial and final positioning and landing from flight plot (buggy)
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="design"/>
</Category>
</Info>
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<Info location="readControllerLogs.m" type="File"/>