diff --git a/agent.m b/agent.m
index 2302ed1..9034c9b 100644
--- a/agent.m
+++ b/agent.m
@@ -15,7 +15,8 @@ classdef agent
lastPos = NaN(1, 3); % position from previous timestep
pos = NaN(1, 3); % current position
vel = NaN(1, 3); % current velocity
- cBfromC = NaN(3); % current DCM body from sim cartesian (assume fixed for now)
+ pan = NaN; % pan angle
+ tilt = NaN; % tilt angle
% Collision
collisionGeometry;
@@ -28,12 +29,13 @@ classdef agent
end
methods (Access = public)
- function obj = initialize(obj, pos, vel, cBfromC, collisionGeometry, sensorModel, guidanceModel, comRange, index, label)
+ function obj = initialize(obj, pos, vel, pan, tilt, collisionGeometry, sensorModel, guidanceModel, comRange, index, label)
arguments (Input)
obj (1, 1) {mustBeA(obj, 'agent')};
pos (1, 3) double;
vel (1, 3) double;
- cBfromC (3, 3) double {mustBeDcm};
+ pan (1, 1) double;
+ tilt (1, 1) double;
collisionGeometry (1, 1) {mustBeGeometry};
sensorModel (1, 1) {mustBeSensor}
guidanceModel (1, 1) {mustBeA(guidanceModel, 'function_handle')};
@@ -47,7 +49,8 @@ classdef agent
obj.pos = pos;
obj.vel = vel;
- obj.cBfromC = cBfromC;
+ obj.pan = pan;
+ obj.tilt = tilt;
obj.collisionGeometry = collisionGeometry;
obj.sensorModel = sensorModel;
obj.guidanceModel = guidanceModel;
diff --git a/miSim.m b/miSim.m
index 7ee8ebf..cb99076 100644
--- a/miSim.m
+++ b/miSim.m
@@ -13,7 +13,6 @@ classdef miSim
end
properties (Access = private)
- v = VideoWriter(fullfile('sandbox', strcat(string(datetime('now'), 'yyyy_MM_dd_HH_mm_ss'), '_miSimHist')));
connectionsPlot; % objects for lines connecting agents in spatial plots
graphPlot; % objects for abstract network graph plot
end
@@ -94,9 +93,8 @@ classdef miSim
times = linspace(0, obj.timestep * obj.maxIter, obj.maxIter+1)';
% Start video writer
- % obj.v.FrameRate = 1/obj.timestep;
- % obj.v.Quality = 90;
- obj.v.open();
+ v = setupVideoWriter(obj.timestep);
+ v.open();
for ii = 1:size(times, 1)
% Display current sim time
@@ -116,11 +114,11 @@ classdef miSim
% Write frame in to video
I = getframe(f);
- obj.v.writeVideo(I);
+ v.writeVideo(I);
end
% Close video file
- obj.v.close();
+ v.close();
end
function [obj, f] = updatePlots(obj, f)
arguments (Input)
diff --git a/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/G4ZDRUCYKeWyePBmClgd0b2gv90d.xml b/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/G4ZDRUCYKeWyePBmClgd0b2gv90d.xml
new file mode 100644
index 0000000..99772b4
--- /dev/null
+++ b/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/G4ZDRUCYKeWyePBmClgd0b2gv90d.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/G4ZDRUCYKeWyePBmClgd0b2gv90p.xml b/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/G4ZDRUCYKeWyePBmClgd0b2gv90p.xml
new file mode 100644
index 0000000..3d5bb39
--- /dev/null
+++ b/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/G4ZDRUCYKeWyePBmClgd0b2gv90p.xml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/setupVideoWriter.m b/setupVideoWriter.m
new file mode 100644
index 0000000..0a464b7
--- /dev/null
+++ b/setupVideoWriter.m
@@ -0,0 +1,17 @@
+function v = setupVideoWriter(timestep)
+ arguments (Input)
+ timestep (1, 1) double;
+ end
+ arguments (Output)
+ v (1, 1) {mustBeA(v, 'VideoWriter')};
+ end
+
+ if ispc || ismac
+ v = VideoWriter(fullfile('sandbox', strcat(string(datetime('now'), 'yyyy_MM_dd_HH_mm_ss'), '_miSimHist')), 'MPEG-4');
+ elseif isunix
+ v = VideoWriter(fullfile('sandbox', strcat(string(datetime('now'), 'yyyy_MM_dd_HH_mm_ss'), '_miSimHist')), 'Motion JPEG AVI');
+ end
+
+ v.FrameRate = 1/timestep;
+ v.Quality = 90;
+end
\ No newline at end of file
diff --git a/test_miSim.m b/test_miSim.m
index cdacb20..ac8ed1c 100644
--- a/test_miSim.m
+++ b/test_miSim.m
@@ -194,7 +194,7 @@ classdef test_miSim < matlab.unittest.TestCase
sensor = sensor.initialize(tc.sensingLength);
% Initialize candidate agent
- newAgent = tc.agents{ii}.initialize(candidatePos, zeros(1,3), eye(3), candidateGeometry, sensor, @gradientAscent, tc.comRange, ii, sprintf("Agent %d", ii));
+ newAgent = tc.agents{ii}.initialize(candidatePos, zeros(1,3), 0, 0, candidateGeometry, sensor, @gradientAscent, tc.comRange, ii, sprintf("Agent %d", ii));
% Make sure candidate agent doesn't collide with
% domain
@@ -362,7 +362,7 @@ classdef test_miSim < matlab.unittest.TestCase
sensor.initialize(tc.sensingLength);
% Initialize candidate agent
- newAgent = tc.agents{ii}.initialize(candidatePos, zeros(1,3), eye(3), candidateGeometry, sensor, @gradientAscent, tc.comRange, ii, sprintf("Agent %d", ii));
+ newAgent = tc.agents{ii}.initialize(candidatePos, zeros(1,3), 0, 0, candidateGeometry, sensor, @gradientAscent, tc.comRange, ii, sprintf("Agent %d", ii));
% Make sure candidate agent doesn't collide with
% domain
diff --git a/validators/arguments/mustBeDcm.m b/validators/arguments/mustBeDcm.m
deleted file mode 100644
index 747d0d6..0000000
--- a/validators/arguments/mustBeDcm.m
+++ /dev/null
@@ -1,12 +0,0 @@
-function mustBeDcm(dcm)
- % Assert 2D
- assert(numel(size(dcm)) == 2, "DCM is not 2D");
- % Assert square
- assert(size(unique(size(dcm)), 1) == 1, "DCM is not a square matrix");
-
- epsilon = 1e-9;
- % Assert inverse equivalent to transpose
- assert(all(abs(inv(dcm) - dcm') < epsilon, "all"), "DCM inverse is not equivalent to transpose");
- % Assert determinant is 1
- assert(det(dcm) > 1 - epsilon && det(dcm) < 1 + epsilon, "DCM has determinant not equal to 1");
-end
\ No newline at end of file