From 31e88a85355d60429e65b0ff9d887ecfeb5b523e Mon Sep 17 00:00:00 2001 From: Kevin D Date: Thu, 2 Apr 2026 13:19:14 -0700 Subject: [PATCH] first aerpaw test prepared --- aerpaw/controller.coderprj | 7 ++++++- aerpaw/results/plotGpsLogs.m | 9 ++++++--- aerpaw/results/readRadioLogs.m | 20 ++++++++++++++++---- aerpaw/results/resultsAnalysis.m | 5 +++-- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/aerpaw/controller.coderprj b/aerpaw/controller.coderprj index 8fe2fe0..023a9ed 100644 --- a/aerpaw/controller.coderprj +++ b/aerpaw/controller.coderprj @@ -143,6 +143,11 @@ + + int32 + + + @@ -708,7 +713,7 @@ true - 2026-04-01T21:59:22 + 2026-04-02T10:07:33 diff --git a/aerpaw/results/plotGpsLogs.m b/aerpaw/results/plotGpsLogs.m index abcbec1..33d4185 100644 --- a/aerpaw/results/plotGpsLogs.m +++ b/aerpaw/results/plotGpsLogs.m @@ -1,7 +1,8 @@ -function [f, G] = plotGpsLogs(logDirs, seaToGroundLevel) +function [f, G] = plotGpsLogs(logDirs, seaToGroundLevel, plotWholeFlight) arguments (Input) logDirs (1, 1) string; seaToGroundLevel (1, 1) double = 110; % measured approximately from USGS national map viewer for the AERPAW test field + plotWholeFlight (1, 1) logical = false; end arguments (Output) f (1, 1) matlab.ui.Figure; @@ -48,8 +49,10 @@ function [f, G] = plotGpsLogs(logDirs, seaToGroundLevel) stopIdx = find(verticalSpeed <= prctile(verticalSpeed, pctThreshold), 1, "last"); % % Plot whole flight, including setup/cleanup - % startIdx = 1; - % stopIdx = length(verticalSpeed); + if plotWholeFlight + startIdx = 1; + stopIdx = length(verticalSpeed); + end % Convert LLA trajectory data to ENU for external analysis % NaN out entries outside the algorithm flight range so they don't plot diff --git a/aerpaw/results/readRadioLogs.m b/aerpaw/results/readRadioLogs.m index fefcb75..9ab042d 100644 --- a/aerpaw/results/readRadioLogs.m +++ b/aerpaw/results/readRadioLogs.m @@ -31,14 +31,26 @@ function R = readRadioLogs(logPath) end fid = fopen(filepath, 'r'); - % Skip 3 lines: 2 junk (tail errors) + 1 header (tx_uav_id,value) - for k = 1:3 - fgetl(fid); + % Skip header lines: some files have 2 tail-error lines + 1 column + % header ("tx_uav_id,value"), others start with data immediately. + % Read until a line that looks like a data record, then rewind to it. + dataPattern = '^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+\] [-\d]'; + linePos = ftell(fid); + while true + line = fgetl(fid); + if ~ischar(line) + break; % EOF + end + if ~isempty(regexp(line, dataPattern, 'once')) + fseek(fid, linePos, 'bof'); % rewind to start of this line + break; + end + linePos = ftell(fid); end data = textscan(fid, '[%26c] %d,%f'); fclose(fid); - ts = datetime(data{1}, 'InputFormat', 'yyyy-MM-dd HH:mm:ss.SSSSSS'); + ts = datetime(cellstr(data{1}), 'InputFormat', 'yyyy-MM-dd HH:mm:ss.SSSSSS'); txId = int32(data{2}); val = data{3}; diff --git a/aerpaw/results/resultsAnalysis.m b/aerpaw/results/resultsAnalysis.m index 8bc961f..0d425d2 100644 --- a/aerpaw/results/resultsAnalysis.m +++ b/aerpaw/results/resultsAnalysis.m @@ -3,7 +3,8 @@ resultsPath = fullfile(matlab.project.rootProject().RootFolder, "sandbox", "two_ % Plot GPS logged data and scenario information (domain, objective, obstacles) seaToGroundLevel = 110; % measured approximately from USGS national map viewer -[fGlobe, G] = plotGpsLogs(resultsPath, seaToGroundLevel); +plotWholeFlight = true; % do not attempt to automatically trim initial and final positioning and landing from flight plot (buggy) +[fGlobe, G] = plotGpsLogs(resultsPath, seaToGroundLevel, true); % Plot radio statistics [fRadio, R] = plotRadioLogs(resultsPath); @@ -21,7 +22,7 @@ makeVideo = true; % Define scenario according to CSV specification domain = rectangularPrism; domain = domain.initialize([params.domainMin; params.domainMax], REGION_TYPE.DOMAIN, "Domain"); -domain.objective = domain.objective.initialize(objectiveFunctionWrapper(params.objectivePos, reshape(params.objectiveVar, [2 2])), domain, params.discretizationStep, params.protectedRange, params.sensorPerformanceMinimum); +domain.objective = domain.objective.initialize(objectiveFunctionWrapper(params.objectivePos, reshape(params.objectiveVar, [1, 2 2])), domain, params.discretizationStep, params.protectedRange, params.sensorPerformanceMinimum); agents = cell(size(params.initialPositions, 2) / 3, 1); for ii = 1:size(agents, 1)