-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgenerate_params.m
70 lines (63 loc) · 1.77 KB
/
generate_params.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
function [cparams, gstate] = generate_params(X, goal, terrain, gstate, action_queue)
if ~action_queue.isempty()
cparams = action_queue.pop();
return;
end
cparams = ControllerParams();
cparams.target_dx = goal.dx;
switch gstate.n
case 0 % Same as last step
cparams = gstate.last_cparams;
% case 1
% cparams.step_offset = -0.2;
% case 2
% cparams.step_offset = -0.15;
% case 3
% cparams.step_offset = -0.1;
% case 4
% cparams.step_offset = -0.05;
% case 5
% cparams.step_offset = 0;
% case 6
% cparams.step_offset = 0.05;
% case 7
% cparams.step_offset = 0.1;
% case 8
% cparams.step_offset = 0.15;
% case 9
% cparams.step_offset = 0.2;
case 1 % Stop
cparams.target_dx = 0;
case 2 % Standard walk
case 3 % Short step
cparams.step_offset = -0.05;
case 4 % Shorter step
cparams.step_offset = -0.1;
case 5 % Long step
cparams.step_offset = 0.05;
case 6 % Longer step
cparams.step_offset = 0.1;
case 7 % Jump
cparams.energy_injection = 400;
case 8 % Big jump
cparams.energy_injection = 800;
case 9 % High step
cparams.step_height = cparams.step_height + 0.1;
case 10 % Higher step
cparams.step_height = cparams.step_height + 0.2;
otherwise % Random
cparams.step_offset = (rand() - 0.5) * 0.5;
cparams.step_height = rand() * 0.2 + 0.1;
cparams.energy_injection = (rand() - 0.5) * 1000;
cparams.phase_rate = rand() + 1;
cparams.target_dx = goal.dx * (rand + 0.5);
end
% if gstate.n > 0
% if gstate.n <= 7
cparams.n = gstate.n;
% else
% cparams.n = 2;
% end
% end
gstate.n = gstate.n + 1;
end