-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrobot_simulation.m
46 lines (40 loc) · 1.25 KB
/
robot_simulation.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
% double nested loopy boi
A = zeros(20,3);
%B = zeros(20,3);
for i = 1:3
parfor z = 1:20
control_type = i;
disp(z);
botscore(z,i) = robot_sim(control_type);
A(z,i) = botscore(z,i);
%B(i,z) = botscore(1,2);
end
csvwrite('data.csv',A);
disp(A);
%disp(B);
end
function botscore = robot_sim(control_type)
addpath('Setup Simulation');
addpath('Execute Simulation');
addpath('Execute Simulation/Control');
addpath('Plot');
% load parameters
robot = load_physical_parameters();
control = load_control_parameters(control_type);
simulation_params = load_simulation_parameters();
impulse_response = load_impulse_response(robot, simulation_params);
% initialize variables
sim = initialize_simulation_data(robot, control, impulse_response, simulation_params);
% go through the simulation and control the robot
for n = 2:length(sim.time)
sim = update_control(sim);
sim = update_simulation(sim);
end
% plot results and animation
plot_animation(sim);
plot_performance(sim);
plot_impulse_response(sim);
% gather score
botscore = (sim.score(n));
%botscore(1,2) = sim.position;
end