1
2
3
4
5
6
7
8
|
1
2
3
4
5
6
7
8
|
-
+
|
function [t,y,u,t_e,y_e,e_e] = ppp_lin_run (Name,Simulate,ControlType,w,x_0,p_c,p_o)
function [t,y,u,y_c,t_e,y_e,e_e] = ppp_lin_run (Name,Simulate,ControlType,w,x_0,p_c,p_o)
## usage: [t,y,u,t_e,y_e,e_e] = ppp_lin_run (Name,Simulate,ControlType,w,x_0,p_c,p_o)
##
##
## Linear closed-loop PPP of lego system (and simulation)
##
## Name: Name of system (in mtt terms)
|
242
243
244
245
246
247
248
249
250
251
252
253
254
255
|
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
+
|
disp("Writing Ustar.h");
ppp_ustar2h(Ustar);
## Control loop
y = [];
y_c = [];
u = [];
t = [];
y_e = [];
t_e = [];
e_e = [];
tick = time;
i=0;
|
305
306
307
308
309
310
311
312
313
314
315
316
317
318
|
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
+
|
(x_est,w,J_uu,J_ux,J_uw,Us0,Gamma,gamma,1e-6,1);
endif
## Save data
if Simulate
t = [t;ti'];
y = [y;yi'];
y_c = [y_c;(C_c*xsi)'];
u = [u;ui'];
else
t = [t;t_i];
y = [y;y_i'];
u = [u;u_i'];
endif
|