included features from SPAWC 2026 branch
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
function obj = initialize(obj, objectiveFunction, domain, discretizationStep, protectedRange, sensorPerformanceMinimum)
|
||||
function obj = initialize(obj, objectiveFunction, domain, discretizationStep, protectedRange, sensorPerformanceMinimum, objectiveMu, objectiveSigma)
|
||||
arguments (Input)
|
||||
obj (1,1) {mustBeA(obj, "sensingObjective")};
|
||||
objectiveFunction (1, 1) {mustBeA(objectiveFunction, "function_handle")};
|
||||
@@ -6,6 +6,8 @@ function obj = initialize(obj, objectiveFunction, domain, discretizationStep, pr
|
||||
discretizationStep (1, 1) double = 1;
|
||||
protectedRange (1, 1) double = 1;
|
||||
sensorPerformanceMinimum (1, 1) double = 1e-6;
|
||||
objectiveMu (:, 2) double = NaN(1, 2);
|
||||
objectiveSigma (:, 2, 2) double = NaN(1, 2, 2);
|
||||
end
|
||||
arguments (Output)
|
||||
obj (1,1) {mustBeA(obj, "sensingObjective")};
|
||||
@@ -36,9 +38,14 @@ function obj = initialize(obj, objectiveFunction, domain, discretizationStep, pr
|
||||
obj.values = obj.values ./ max(obj.values, [], "all");
|
||||
|
||||
% store ground position
|
||||
idx = obj.values == 1;
|
||||
obj.groundPos = [obj.X(idx), obj.Y(idx)];
|
||||
obj.groundPos = obj.groundPos(1, 1:2); % for safety, in case 2 points are maximal (somehow)
|
||||
idx = obj.values == 1;
|
||||
if any(isnan(objectiveMu))
|
||||
obj.groundPos = [obj.X(idx), obj.Y(idx)];
|
||||
obj.groundPos = obj.groundPos(1, 1:2); % for safety, in case 2 points are maximal (somehow)
|
||||
else
|
||||
obj.groundPos = objectiveMu;
|
||||
end
|
||||
obj.objectiveSigma = objectiveSigma;
|
||||
|
||||
assert(domain.distance([obj.groundPos, domain.center(3)]) > protectedRange, "Domain is crowding the sensing objective")
|
||||
assert(domain.distance([obj.groundPos, ones(size(obj.groundPos, 1), 1) .* domain.center(3)]) > protectedRange, "Domain is crowding the sensing objective");
|
||||
end
|
||||
@@ -11,7 +11,7 @@ function obj = initializeRandomMvnpdf(obj, domain, discretizationStep, protected
|
||||
|
||||
% Set random objective position
|
||||
mu = domain.minCorner;
|
||||
while domain.distance(mu) < protectedRange
|
||||
while domain.distance(mu) < protectedRange * 1.01
|
||||
mu = domain.random();
|
||||
end
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ classdef sensingObjective
|
||||
% Sensing objective definition parent class
|
||||
properties (SetAccess = private, GetAccess = public)
|
||||
label = "";
|
||||
groundPos = [NaN, NaN];
|
||||
groundPos = NaN(1, 2);
|
||||
objectiveSigma = NaN(1, 2, 2);
|
||||
discretizationStep = NaN;
|
||||
X = [];
|
||||
Y = [];
|
||||
|
||||
Reference in New Issue
Block a user