-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain_runtonight.m
82 lines (65 loc) · 2.04 KB
/
Main_runtonight.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
71
72
73
74
75
76
77
78
79
80
81
82
clear all
close all
clc
%Main program for pendulum swingup
% Declare parameters
params.m = 5;
params.l = 1.2;
params.g = 9.81;
params.ktheta = 0.01;
params.kthetadot = 0.01;
params.T = 10; %Duration of motion
params.nstates = 2;
params.ncontrols= 1;
params.NperSU = 60;
params.NSU = 1; %number of swingups
params = getParams(params);
params.omega = zeros(params.nstates,params.N);
[X0, L, U] = getIniConBound(params);
[~, params] = conjacstructure(L, U, params);
%First result witout noise for desired trajectory
result1 = Optimize(X0, L, U, params);
params1 = params;
% Now add more swingups and noise
params.NSU = 100;
params = getParams(params);
params.omega = 0.001*randn(params.nstates,params.N); %Added noise, low pass filtered
% [b,a] = butter(2,0.1);
% params.omega = filter(b,a,omega);
[X0, L, U] = getIniConBound(params, result1);
[~, params] = conjacstructure(L, U, params);
result2 = Optimize(X0, L, U, params);
params2 = params;
% plotresult(result, params);
% More noise
X0 = result2.X;
params.omega = 0.01*randn(params.nstates,params.N); %Added noise, low pass filtered
[~, params] = conjacstructure(L, U, params);
result3 = Optimize(X0, L, U, params);
params3 = params;
% profile on
% More noise
X0 = result3.X;
params.omega = 0.05*randn(params.nstates,params.N); %Added noise, low pass filtered
[~, params] = conjacstructure(L, U, params);
result4 = Optimize(X0, L, U, params);
params4 = params;
% profile viewer
% More noise
X0 = result4.X;
params.omega = 0.1*randn(params.nstates,params.N); %Added noise, low pass filtered
[~, params] = conjacstructure(L, U, params);
result5 = Optimize(X0, L, U, params);
params5 = params;
% More noise
X0 = result5.X;
params.omega = 0.3*randn(params.nstates,params.N); %Added noise, low pass filtered
[~, params] = conjacstructure(L, U, params);
result6 = Optimize(X0, L, U, params);
params6 = params;
% More noise
X0 = result6.X;
params.omega = 1*randn(params.nstates,params.N); %Added noise, low pass filtered
[~, params] = conjacstructure(L, U, params);
result7 = Optimize(X0, L, U, params);
params7 = params;