fixed unit tests

This commit is contained in:
2026-01-13 23:16:41 -08:00
parent bcb3bc3da3
commit 2604711c78
15 changed files with 160 additions and 89 deletions

View File

@@ -3,13 +3,13 @@ classdef agent
% Identifiers
label = "";
% Sensor
sensorModel;
% State
lastPos = NaN(1, 3); % position from previous timestep
pos = NaN(1, 3); % current position
% Sensor
sensorModel;
% Collision
collisionGeometry;
@@ -17,10 +17,10 @@ classdef agent
fovGeometry;
% Communication
comRange = NaN;
commsGeometry = spherical;
lesserNeighbors = [];
% Performance
performance = 0;
% Plotting
@@ -29,7 +29,7 @@ classdef agent
end
properties (SetAccess = private, GetAccess = public)
initialStepSize = 0.2;
initialStepSize = NaN;
stepDecayRate = NaN;
end

View File

@@ -1,4 +1,4 @@
function obj = initialize(obj, pos, collisionGeometry, sensorModel, comRange, maxIter, label, plotCommsGeometry)
function obj = initialize(obj, pos, collisionGeometry, sensorModel, comRange, maxIter, initialStepSize, label, plotCommsGeometry)
arguments (Input)
obj (1, 1) {mustBeA(obj, 'agent')};
pos (1, 3) double;
@@ -6,6 +6,7 @@ function obj = initialize(obj, pos, collisionGeometry, sensorModel, comRange, ma
sensorModel (1, 1) {mustBeSensor};
comRange (1, 1) double;
maxIter (1, 1) double;
initialStepSize (1, 1) double = 0.2;
label (1, 1) string = "";
plotCommsGeometry (1, 1) logical = false;
end
@@ -18,6 +19,7 @@ function obj = initialize(obj, pos, collisionGeometry, sensorModel, comRange, ma
obj.sensorModel = sensorModel;
obj.label = label;
obj.plotCommsGeometry = plotCommsGeometry;
obj.initialStepSize = initialStepSize;
obj.stepDecayRate = obj.initialStepSize / maxIter;
% Initialize performance vector