cleaned up plotting
This commit is contained in:
@@ -20,25 +20,23 @@ function f = plotParameters(obj)
|
|||||||
|
|
||||||
% Distance
|
% Distance
|
||||||
nexttile(1, [1, 1]);
|
nexttile(1, [1, 1]);
|
||||||
grid(f.Children(1).Children(1), "on");
|
grid("on");
|
||||||
title(f.Children(1).Children(1), "Distance Membership Sigmoid");
|
title("Distance Membership Sigmoid");
|
||||||
xlabel(f.Children(1).Children(1), "Distance (m)");
|
xlabel("Distance (m)");
|
||||||
ylabel(f.Children(1).Children(1), "Membership");
|
ylabel("Membership");
|
||||||
hold(f.Children(1).Children(1), 'on');
|
hold('on');
|
||||||
plot(f.Children(1).Children(1), d, d_x, 'LineWidth', 2);
|
plot(d, d_x, 'LineWidth', 2);
|
||||||
hold(f.Children(1).Children(1), 'off');
|
hold('off');
|
||||||
ylim([0, 1]);
|
ylim([0, 1]);
|
||||||
|
|
||||||
% Tilt
|
% Tilt
|
||||||
nexttile(2, [1, 1]);
|
nexttile(2, [1, 1]);
|
||||||
grid(f.Children(1).Children(1), "on");
|
grid("on");
|
||||||
title(f.Children(1).Children(1), "Tilt Membership Sigmoid");
|
title("Tilt Membership Sigmoid");
|
||||||
xlabel(f.Children(1).Children(1), "Tilt (deg)");
|
xlabel("Tilt (deg)");
|
||||||
ylabel(f.Children(1).Children(1), "Membership");
|
ylabel("Membership");
|
||||||
hold(f.Children(1).Children(1), 'on');
|
hold('on');
|
||||||
plot(f.Children(1).Children(1), t, t_x, 'LineWidth', 2);
|
plot(t, t_x, 'LineWidth', 2);
|
||||||
hold(f.Children(1).Children(1), 'off');
|
hold('off');
|
||||||
|
ylim([0, 1]);
|
||||||
|
|
||||||
keyboard
|
|
||||||
end
|
end
|
||||||
@@ -13,7 +13,7 @@ classdef sigmoidSensor
|
|||||||
[obj] = initialize(obj, alphaDist, betaDist, alphaPan, betaPan, alphaTilt, betaTilt);
|
[obj] = initialize(obj, alphaDist, betaDist, alphaPan, betaPan, alphaTilt, betaTilt);
|
||||||
[values, positions] = sense(obj, agent, sensingObjective, domain, partitioning);
|
[values, positions] = sense(obj, agent, sensingObjective, domain, partitioning);
|
||||||
[value] = sensorPerformance(obj, agentPos, agentPan, agentTilt, targetPos);
|
[value] = sensorPerformance(obj, agentPos, agentPan, agentTilt, targetPos);
|
||||||
plotParameters(obj);
|
[f] = plotParameters(obj);
|
||||||
end
|
end
|
||||||
methods (Access = private)
|
methods (Access = private)
|
||||||
x = distanceMembership(obj, d);
|
x = distanceMembership(obj, d);
|
||||||
|
|||||||
@@ -356,6 +356,7 @@ classdef test_miSim < matlab.unittest.TestCase
|
|||||||
sensor = sigmoidSensor;
|
sensor = sigmoidSensor;
|
||||||
% Homogeneous sensor model parameters
|
% Homogeneous sensor model parameters
|
||||||
sensor = sensor.initialize(2.5, 3, NaN, NaN, deg2rad(15), 3);
|
sensor = sensor.initialize(2.5, 3, NaN, NaN, deg2rad(15), 3);
|
||||||
|
f = sensor.plotParameters();
|
||||||
% Heterogeneous sensor model parameters
|
% Heterogeneous sensor model parameters
|
||||||
% sensor = sensor.initialize(tc.alphaDistMin + rand * (tc.alphaDistMax - tc.alphaDistMin), tc.betaDistMin + rand * (tc.betaDistMax - tc.betaDistMin), NaN, NaN, tc.alphaTiltMin + rand * (tc.alphaTiltMax - tc.alphaTiltMin), tc.betaTiltMin + rand * (tc.betaTiltMax - tc.betaTiltMin));
|
% sensor = sensor.initialize(tc.alphaDistMin + rand * (tc.alphaDistMax - tc.alphaDistMin), tc.betaDistMin + rand * (tc.betaDistMax - tc.betaDistMin), NaN, NaN, tc.alphaTiltMin + rand * (tc.alphaTiltMax - tc.alphaTiltMin), tc.betaTiltMin + rand * (tc.betaTiltMax - tc.betaTiltMin));
|
||||||
|
|
||||||
@@ -365,10 +366,10 @@ classdef test_miSim < matlab.unittest.TestCase
|
|||||||
tc.agents{2} = tc.agents{2}.initialize(tc.domain.center - [d, 0, 0], zeros(1,3), 0, 0, geometry2, sensor, @gradientAscent, 3*d, 2, sprintf("Agent %d", 2));
|
tc.agents{2} = tc.agents{2}.initialize(tc.domain.center - [d, 0, 0], zeros(1,3), 0, 0, geometry2, sensor, @gradientAscent, 3*d, 2, sprintf("Agent %d", 2));
|
||||||
|
|
||||||
% Optional third agent along the +Y axis
|
% Optional third agent along the +Y axis
|
||||||
% geometry3 = rectangularPrism;
|
geometry3 = rectangularPrism;
|
||||||
% geometry3 = geometry3.initialize([tc.domain.center - [0, d, 0] - tc.collisionRanges(1) * ones(1, 3); tc.domain.center - [0, d, 0] + tc.collisionRanges(1) * ones(1, 3)], REGION_TYPE.COLLISION, sprintf("Agent %d collision volume", 3));
|
geometry3 = geometry3.initialize([tc.domain.center - [0, d, 0] - tc.collisionRanges(1) * ones(1, 3); tc.domain.center - [0, d, 0] + tc.collisionRanges(1) * ones(1, 3)], REGION_TYPE.COLLISION, sprintf("Agent %d collision volume", 3));
|
||||||
% tc.agents{3} = agent;
|
tc.agents{3} = agent;
|
||||||
% tc.agents{3} = tc.agents{3}.initialize(tc.domain.center - [0, d, 0], zeros(1, 3), 0, 0, geometry3, sensor, @gradientAscent, 3*d, 3, sprintf("Agent %d", 3));
|
tc.agents{3} = tc.agents{3}.initialize(tc.domain.center - [0, d, 0], zeros(1, 3), 0, 0, geometry3, sensor, @gradientAscent, 3*d, 3, sprintf("Agent %d", 3));
|
||||||
|
|
||||||
% Initialize the simulation
|
% Initialize the simulation
|
||||||
tc.testClass = tc.testClass.initialize(tc.domain, tc.domain.objective, tc.agents, tc.timestep, tc.partitoningFreq, tc.maxIter);
|
tc.testClass = tc.testClass.initialize(tc.domain, tc.domain.objective, tc.agents, tc.timestep, tc.partitoningFreq, tc.maxIter);
|
||||||
|
|||||||
Reference in New Issue
Block a user