coopPayloadSim.m 1.17 KB
Newer Older
mmroma's avatar
mmroma committed
1
%% Cooperative Payload Simulator
mmroma's avatar
mmroma committed
2
3
4
5
6
7
8
% Author: Matthew Romano (mmroma@umich.edu)
% Date: 1/21/2019

% This is the high level script that calls all of the necessary functions
% to run the simulation. When tuning and testing, changes should be made to
% the parameters files (called by setUpParameters() ).

mmroma's avatar
mmroma committed
9
10
%% Add Necessary Folders to MATLAB Path (add everything)
addpath(genpath(pwd))
mmroma's avatar
mmroma committed
11

12
13
14
15
16
17
18
%% Load Data (if user requested)
answer = input('Would you like to load from a matlab file? (Y/N) ', 's');
if strcmp(answer, 'Y') == 1
    file = input('Enter file name: ', 's');
    load(file);
    params.curr_run = int8(str2double(extractBetween(file, 4, 4)));

mmroma's avatar
mmroma committed
19
%% Set Up Parameters
20
21
22
else
    params = setUpParameters();
end
mmroma's avatar
mmroma committed
23
24
25
26

%% Simulate
simData = runSimulation(params);

27
28
29
30
%% Save Params & simData
if strcmp(answer, 'Y') ~= 1
    saveData(simData,params, 'run');
end
mmroma's avatar
mmroma committed
31
%% Plot
32
plotData(simData,params);
33
34
35
if strcmp(answer, 'Y') == 1
    save_current_figure("WPs_set", 1, params.curr_run, 1);
end
mmroma's avatar
mmroma committed
36
37

%% Animate
38
39
40
41
42
43
if strcmp(answer, 'Y') == 1
     %save_video(['Run_' int2str(params.curr_run)], simData,params);
     animate(['Run_' int2str(params.curr_run)], simData,params);
else
    animate('none', simData,params);
end