-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetData_onSpot_AT.m
541 lines (491 loc) · 17.9 KB
/
getData_onSpot_AT.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
%% fetch data from raspberry pi
mypi=raspberrypi;
getFile(mypi,'multicore_dataRec*.mat');
getFile(mypi,'~/MATLAB_ws/R2021b/raspi_multicore_MPCtest_AT.log'); % get the log file
%% data plot
close all;
load multicore_dataRec1.mat;
load multicore_dataRec2.mat;
load multicore_dataRec3.mat;
load multicore_dataRec4.mat;
load multicore_dataRec5.mat;
load multicore_dataRec6.mat;
load multicore_dataRec7.mat;
load multicore_dataRec8.mat;
load multicore_dataRec9.mat;
load multicore_dataRec10.mat;
load multicore_dataRec11.mat;
load multicore_dataRec12.mat;
load multicore_dataRec13.mat;
%%% recorded variables
t_slow=rt_x_FB_slow(1,:);
pCoM_slow=rt_x_FB_slow(2:4,:);
RPY_slow=rt_x_FB_slow(5:7,:);
vCoM_slow=rt_x_FB_slow(8:10,:);
OmegaW_slow=rt_x_FB_slow(11:13,:);
mvOut_slow=rt_mvOut_qpStatus_slow(2:13,:);
qpStatus_slow=rt_mvOut_qpStatus_slow(end,:);
refSeq2_slow=rt_refSeq2_refP_slow(2:14,:);
refP_slow=rt_refSeq2_refP_slow(15:end,:);
pLbas=rt_pLbas_fLst_fLRes_pLAdm_pLDelta(2:13,:);
fLst=rt_pLbas_fLst_fLRes_pLAdm_pLDelta(14:25,:);
fLRes=rt_pLbas_fLst_fLRes_pLAdm_pLDelta(26:37,:);
pLAdm=rt_pLbas_fLst_fLRes_pLAdm_pLDelta(38:49,:);
pLDelta=rt_pLbas_fLst_fLRes_pLAdm_pLDelta(50:61,:);
touchInd=rt_estSPLeg_estSP_LegState(2:5,:);
LegState=rt_estSPLeg_estSP_LegState(end-3:end,:);
pArrayLFK=rt_pLm(2:end,:);
%refOVnew=rt_refOVbew_refMVnew_slow(2:14,:);
%refMVnew=rt_refOVbew_refMVnew_slow(15:end,:);
t_fast=rt_mvOut_fast(1,:);
mvOut_fast=rt_mvOut_fast(2:end,:);
pCoM_fast=rt_x_FB_fast(2:4,:);
RPY_fast=rt_x_FB_fast(5:7,:);
vCoM_fast=rt_x_FB_fast(8:10,:);
OmegaW_fast=rt_x_FB_fast(11:13,:);
vxPercent_fast=rt_vxPercent_vyPercent_wzPercent(2,:);
vyPercent_fast=rt_vxPercent_vyPercent_wzPercent(3,:);
wzPercent_fast=rt_vxPercent_vyPercent_wzPercent(4,:);
% PendAllLocal_fast=rt_PendAllLocal(2:end,:);
spMPC_fast=rt_spMPC_surVN_surV1_surV2_surP_headG(2:13,:);
surVNrec=rt_spMPC_surVN_surV1_surV2_surP_headG(14:16,:);
surV1rec=rt_spMPC_surVN_surV1_surV2_surP_headG(17:19,:);
surV2rec=rt_spMPC_surVN_surV1_surV2_surP_headG(20:22,:);
surPrec=rt_spMPC_surVN_surV1_surV2_surP_headG(23:25,:);
headGrec=rt_spMPC_surVN_surV1_surV2_surP_headG(26:28,:);
estSPLeg_fast=rt_estSPLeg_estSP_LegState(2:5,:);
estSP_fast=rt_estSPLeg_estSP_LegState(6:17,:);
estXbar=rt_estXbar_slow(2:end,:);
estDis=estXbar(14:19,:);
EstOff=rt_EstOff_OscEN_mpcSTOP_ES(2,:);
OscEN=rt_EstOff_OscEN_mpcSTOP_ES(3,:);
mpcSTOP=rt_EstOff_OscEN_mpcSTOP_ES(4,:);
ES=rt_EstOff_OscEN_mpcSTOP_ES(5,:);
pCoM_mpcPre_slow=rt_xMPCOut_slow(2:4,:);
RPY_mpcPre_slow=rt_xMPCOut_slow(5:7,:);
vCoM_mpcPre_slow=rt_xMPCOut_slow(8:10,:);
omegaW_mpcPre_slow=rt_xMPCOut_slow(11:13,:);
pWRec=estSP_fast;
LegStateRec=LegState;
xRefRec=refP_slow; % t_slow
xFBRec=rt_x_FB_fast(2:13,:);
DisableRec=mpcSTOP;
% sim_pW=timeseries(pWRec,t_fast);
% sim_LegState=timeseries(LegStateRec,t_fast);
% sim_xRef=timeseries(xRefRec,t_slow);
% sim_xFB=timeseries(xFBRec,t_fast);
% sim_disable=timeseries(DisableRec,t_fast);
% sim_tEnd=t_fast(end);
% save('CentroidTestData','sim_pW','sim_LegState','sim_xRef','sim_xFB','sim_disable','sim_tEnd');
% qpXnew=rt_qpXnew_qpUnew_qpExitFlag_fast(2:14,:);
% qpUnew=rt_qpXnew_qpUnew_qpExitFlag_fast(15:26,:);
% qpExitFlag=rt_qpXnew_qpUnew_qpExitFlag_fast(27,:);
startT=0;
endT=10;
startNs=1;
endNs=2;
startNf=1;
endNf=2;
tmp=find(mpcSTOP<=0);
if isempty(tmp)
tmp=1;
end
startNf=tmp(1);
tmp=find(t_slow>=t_fast(tmp(1)));
startNs=tmp(1);
tmp=find(ES>=1);
if isempty(tmp)
tmp=length(t_fast);
end
endT=t_fast(tmp(1));
endNf=tmp(1);
tmp=find(t_slow>=endT);
if isempty(tmp)
tmp=length(t_slow);
end
endNs=tmp(1);
%%% check the multirate delay
% figure();
% stairs(t_slow,mvOut_slow(1,:));
% hold on;
% stairs(t_fast,mvOut_fast(1,:));
% legend('mvOut1\_slow','mvOut1\_fast');
%%% check the fLst and the pLDelta, fLst is the output of the balance control module
figure()
subplot(2,4,1)
plot(t_fast(startNf:endNf),fLst(1,startNf:endNf), ...
t_fast(startNf:endNf),fLst(2,startNf:endNf), ...
t_fast(startNf:endNf),fLst(3,startNf:endNf));
ylabel('virtualF_Leg1');legend('fx','fy','fz')
subplot(2,4,2)
plot(t_fast(startNf:endNf),pLDelta(1,startNf:endNf), ...
t_fast(startNf:endNf),pLDelta(2,startNf:endNf), ...
t_fast(startNf:endNf),pLDelta(3,startNf:endNf));
ylabel('virtualF_Leg1');legend('pLdeX','pLdeY','pLdeZ')
subplot(2,4,3)
plot(t_fast(startNf:endNf),fLst(4,startNf:endNf),...
t_fast(startNf:endNf),fLst(5,startNf:endNf),...
t_fast(startNf:endNf),fLst(6,startNf:endNf));
ylabel('virtualF_Leg2');legend('fx','fy','fz')
subplot(2,4,4)
plot(t_fast(startNf:endNf),pLDelta(4,startNf:endNf),...
t_fast(startNf:endNf),pLDelta(5,startNf:endNf),...
t_fast(startNf:endNf),pLDelta(6,startNf:endNf));
ylabel('virtualF_Leg2');legend('pLdeX','pLdeY','pLdeZ');
subplot(2,4,5)
plot(t_fast(startNf:endNf),fLst(7,startNf:endNf), ...
t_fast(startNf:endNf),fLst(8,startNf:endNf), ...
t_fast(startNf:endNf),fLst(9,startNf:endNf));
ylabel('virtualF_Leg3');legend('fx','fy','fz')
subplot(2,4,6)
plot(t_fast(startNf:endNf),pLDelta(7,startNf:endNf), ...
t_fast(startNf:endNf),pLDelta(8,startNf:endNf), ...
t_fast(startNf:endNf),pLDelta(9,startNf:endNf));
ylabel('virtualF_Leg3');legend('pLdeX','pLdeY','pLdeZ');
subplot(2,4,7)
plot(t_fast(startNf:endNf),fLst(10,startNf:endNf), ...
t_fast(startNf:endNf),fLst(11,startNf:endNf),...
t_fast(startNf:endNf),fLst(12,startNf:endNf));
ylabel('virtualF_Leg4');legend('fx','fy','fz')
subplot(2,4,8)
plot(t_fast(startNf:endNf),pLDelta(10,startNf:endNf), ...
t_fast(startNf:endNf),pLDelta(11,startNf:endNf),...
t_fast(startNf:endNf),pLDelta(12,startNf:endNf));
ylabel('virtualF_Leg4');legend('pLdeX','pLdeY','pLdeZ')
%%% chekc the mv
figure()
subplot(2,2,1)
plot(t_fast(startNf:endNf),mvOut_fast(1,startNf:endNf), ...
t_fast(startNf:endNf),mvOut_fast(2,startNf:endNf),t_fast(startNf:endNf),mvOut_fast(3,startNf:endNf));
ylabel('Leg1');legend('fx','fy','fz')
subplot(2,2,2)
plot(t_fast(startNf:endNf),mvOut_fast(4,startNf:endNf),...
t_fast(startNf:endNf),mvOut_fast(5,startNf:endNf),...
t_fast(startNf:endNf),mvOut_fast(6,startNf:endNf));
ylabel('Leg2');legend('fx','fy','fz')
subplot(2,2,3)
plot(t_fast(startNf:endNf),mvOut_fast(7,startNf:endNf), ...
t_fast(startNf:endNf),mvOut_fast(8,startNf:endNf), ...
t_fast(startNf:endNf),mvOut_fast(9,startNf:endNf));
ylabel('Leg3');legend('fx','fy','fz')
subplot(2,2,4)
plot(t_fast(startNf:endNf),mvOut_fast(10,startNf:endNf), ...
t_fast(startNf:endNf),mvOut_fast(11,startNf:endNf),...
t_fast(startNf:endNf),mvOut_fast(12,startNf:endNf));
ylabel('Leg4');legend('fx','fy','fz')
%%% check payload balance in z direction
figure();
subplot(2,1,1)
plot(t_fast(startNf:endNf),fLRes(3,startNf:endNf));
hold on;
plot(t_fast(startNf:endNf),fLRes(12,startNf:endNf));
legend('leg1z','leg4z');ylabel('payload in leg frame(N)')
subplot(2,1,2)
plot(t_fast(startNf:endNf),fLRes(6,startNf:endNf));
hold on;
plot(t_fast(startNf:endNf),fLRes(9,startNf:endNf));
legend('leg2z','leg3z');ylabel('payload in leg frame(N)')
%%% check the trunk state
figure();
subplot(2,2,1)
plot(t_fast(startNf:endNf),pCoM_fast(:,startNf:endNf));ylabel('pCoM');legend('x','y','z');
subplot(2,2,2)
plot(t_fast(startNf:endNf),RPY_fast(:,startNf:endNf)/pi*180);ylabel('RPY');legend('x','y','z');
subplot(2,2,3)
plot(t_fast(startNf:endNf),vCoM_fast(:,startNf:endNf));ylabel('vCoM');legend('x','y','z');
subplot(2,2,4)
plot(t_fast(startNf:endNf),OmegaW_fast(:,startNf:endNf));ylabel('omegaW');legend('x','y','z');
%%% check the control cmd and qpStatus
figure();
subplot(2,1,1)
plot(t_fast,EstOff,t_fast,OscEN,t_fast,mpcSTOP,t_fast,ES);
legend('EstOff','OscEN','mpcSTOP','ES');
ylabel('Control Cmd');
subplot(2,1,2)
stairs(t_slow,qpStatus_slow);
ylabel('qpStatus');
%%% check orientation control
figure();
subplot(3,1,1)
plot(t_slow(startNs:endNs),RPY_slow(1,startNs:endNs), ...
t_slow(startNs:endNs),RPY_mpcPre_slow(1,startNs:endNs))
legend('real','predicted')
ylabel('roll');
subplot(3,1,2)
plot(t_slow(startNs:endNs),RPY_slow(2,startNs:endNs), ...
t_slow(startNs:endNs),RPY_mpcPre_slow(2,startNs:endNs))
legend('real','predicted')
ylabel('pitch');
subplot(3,1,3)
plot(t_slow(startNs:endNs),RPY_slow(3,startNs:endNs), ...
t_slow(startNs:endNs),RPY_mpcPre_slow(3,startNs:endNs))
legend('real','predicted')
ylabel('yaw');
%%% check the CoM control
figure();
subplot(3,1,1)
plot(t_slow(startNs:endNs),pCoM_slow(1,startNs:endNs), ...
t_slow(startNs:endNs),pCoM_mpcPre_slow(1,startNs:endNs))
legend('real','predicted')
ylabel('pCoMx');
subplot(3,1,2)
plot(t_slow(startNs:endNs),pCoM_slow(2,startNs:endNs), ...
t_slow(startNs:endNs),pCoM_mpcPre_slow(2,startNs:endNs))
legend('real','predicted')
ylabel('pCoMy');
subplot(3,1,3)
plot(t_slow(startNs:endNs),pCoM_slow(3,startNs:endNs), ...
t_slow(startNs:endNs),pCoM_mpcPre_slow(3,startNs:endNs))
legend('real','predicted')
ylabel('pCoMz');
%%% check foot position interpolation
% figure();
% subplot(3,1,1)
% stairs(t_fast(startNf:endNf),pArrayLAdm(1,startNf:endNf))
% hold on;
% stairs(t_fast(startNf:endNf),pArrayL(1,startNf:endNf)*1000);
% legend('MPC_cmd','interpolated');
% ylabel('Leg1x');
% subplot(3,1,2)
% stairs(t_fast(startNf:endNf),pArrayLAdm(2,startNf:endNf));hold on;
% stairs(t_fast(startNf:endNf),pArrayL(2,startNf:endNf)*1000);
% legend('MPC_cmd','interpolated');ylabel('Leg1y');
% subplot(3,1,3)
% stairs(t_fast(startNf:endNf),pArrayLAdm(3,startNf:endNf));
% hold on;
% stairs(t_fast(startNf:endNf),pArrayL(3,startNf:endNf)*1000);
% legend('MPC_cmd','interpolated');ylabel('Leg1z');
%%% check the ref cmd
figure();
subplot(2,2,1)
plot(t_slow(startNs:endNs),refSeq2_slow(4:6,startNs:endNs)/pi*180);
ylabel('refSeq2');legend('SitaX','SitaY','SitaZ');
subplot(2,2,2)
plot(t_slow(startNs:endNs),refSeq2_slow(1:3,startNs:endNs));
ylabel('refSeq2');legend('pCoMX','pCoMY','pCoMZ');
subplot(2,2,3)
plot(t_slow(startNs:endNs),refP_slow(4:6,startNs:endNs));
ylabel('refP');legend('SitaX','SitaY','SitaZ');
subplot(2,2,4)
plot(t_slow(startNs:endNs),refP_slow(1:3,startNs:endNs));
ylabel('refP');legend('pCoMX','pCoMY','pCoMZ');
%%% check xFB vs xRef
figure();
subplot(2,3,1)
plot(t_slow(startNs:endNs),refP_slow(1,startNs:endNs));
hold on;
plot(t_fast(startNf:endNf),pCoM_fast(1,startNf:endNf));
ylabel('pCoMx vx Ref');
subplot(2,3,2)
plot(t_slow(startNs:endNs),refP_slow(2,startNs:endNs));
hold on;
plot(t_fast(startNf:endNf),pCoM_fast(2,startNf:endNf));
ylabel('pCoMy vx Ref');
subplot(2,3,3)
plot(t_slow(startNs:endNs),refP_slow(3,startNs:endNs));
hold on;
plot(t_fast(startNf:endNf),pCoM_fast(3,startNf:endNf));
ylabel('pCoMz vx Ref');
subplot(2,3,4)
plot(t_slow(startNs:endNs),refSeq2_slow(4,startNs:endNs));
hold on;
plot(t_fast(startNf:endNf),RPY_fast(1,startNf:endNf));
ylabel('roll Ref');
subplot(2,3,5)
plot(t_slow(startNs:endNs),refSeq2_slow(5,startNs:endNs));
hold on;
plot(t_fast(startNf:endNf),RPY_fast(2,startNf:endNf));
ylabel('pitch Ref');
subplot(2,3,6)
plot(t_slow(startNs:endNs),refSeq2_slow(6,startNs:endNs));
hold on;
plot(t_fast(startNf:endNf),RPY_fast(3,startNf:endNf));
ylabel('yaw Ref');
%%% check commanded foot position
figure();
subplot(2,2,1)
yyaxis left;
plot(t_fast(startNf:endNf),pLAdm(1,startNf:endNf), ...
t_fast(startNf:endNf),pLAdm(2,startNf:endNf),t_fast(startNf:endNf),pLAdm(3,startNf:endNf));
ylabel('leg1\_pL');
yyaxis right
plot(t_fast(startNf:endNf),LegState(1,startNf:endNf),...
t_fast(startNf:endNf),touchInd(1,startNf:endNf));
ylim([-0.1 1.1]);
legend('x','y','z','LegState','touchInd');
subplot(2,2,2)
yyaxis left
plot(t_fast(startNf:endNf),pLAdm(4,startNf:endNf),...
t_fast(startNf:endNf),pLAdm(5,startNf:endNf),t_fast(startNf:endNf),pLAdm(6,startNf:endNf));
ylabel('leg2\_pL');
yyaxis right
plot(t_fast(startNf:endNf),LegState(2,startNf:endNf),t_fast(startNf:endNf),touchInd(2,startNf:endNf));
ylim([-0.1 1.1]);
legend('x','y','z','LegState','touchInd');
subplot(2,2,3)
yyaxis left
plot(t_fast(startNf:endNf),pLAdm(7,startNf:endNf),t_fast(startNf:endNf), ...
pLAdm(8,startNf:endNf),t_fast(startNf:endNf),pLAdm(9,startNf:endNf));
ylabel('leg3\_pL');
yyaxis right
plot(t_fast(startNf:endNf),LegState(3,startNf:endNf),t_fast(startNf:endNf),touchInd(3,startNf:endNf));
ylim([-0.1 1.1]);
legend('x','y','z','LegState','touchInd');
subplot(2,2,4)
yyaxis left
plot(t_fast(startNf:endNf),pLAdm(10,startNf:endNf),t_fast(startNf:endNf),pLAdm(11,startNf:endNf), ...
t_fast(startNf:endNf),pLAdm(12,startNf:endNf));
yyaxis right
plot(t_fast(startNf:endNf),LegState(4,startNf:endNf),t_fast(startNf:endNf),touchInd(4,startNf:endNf));
ylim([-0.1 1.1]);
ylabel('leg4\_pL');
legend('x','y','z','LegState','touchInd');
%%% check the swing trajectory tracking
% figure();
% subplot(2,2,1)
% plot(t_fast(startNf:endNf),pArrayLAdm(3,startNf:endNf)/1000,t_fast(startNf:endNf),pArrayL(3,startNf:endNf), ...
% t_fast(startNf:endNf),pArrayLFK(3,startNf:endNf)/1000);
% legend('Adm','pL','pLFK');
% ylabel('Leg1');
% subplot(2,2,2)
% plot(t_fast(startNf:endNf),pArrayLAdm(6,startNf:endNf)/1000,t_fast(startNf:endNf),pArrayL(6,startNf:endNf), ...
% t_fast(startNf:endNf),pArrayLFK(6,startNf:endNf)/1000);
% legend('Adm','pL','pLFK');
% ylabel('Leg2');
% subplot(2,2,3)
% plot(t_fast(startNf:endNf),pArrayLAdm(9,startNf:endNf)/1000,t_fast(startNf:endNf),pArrayL(9,startNf:endNf), ...
% t_fast(startNf:endNf),pArrayLFK(9,startNf:endNf)/1000);
% legend('Adm','pL','pLFK');
% ylabel('Leg3');
% subplot(2,2,4)
% plot(t_fast(startNf:endNf),pArrayLAdm(12,startNf:endNf)/1000,t_fast(startNf:endNf),pArrayL(12,startNf:endNf), ...
% t_fast(startNf:endNf),pArrayLFK(12,startNf:endNf)/1000);
% legend('Adm','pL','pLFK');
% ylabel('Leg4');
%%% check joystick input command
% figure();
% plot(t_fast(startNf:endNf),vxPercent_fast(startNf:endNf),...
% t_fast(startNf:endNf),vyPercent_fast(startNf:endNf),...
% t_fast(startNf:endNf),wzPercent_fast(startNf:endNf));
% legend('vxPer','vyPer','wzPer');
%%% check qp output
% figure();
% subplot(4,3,1)
% plot(t_fast(startNf:endNf),qpUnew(1,startNf:endNf));
% hold on;
% plot(t_fast(startNf:endNf),mvOut_fast(1,startNf:endNf));
% legend('qpLeg1x','mpcLeg1x')
% subplot(4,3,2)
% plot(t_fast(startNf:endNf),qpUnew(2,startNf:endNf));
% hold on;
% plot(t_fast(startNf:endNf),mvOut_fast(2,startNf:endNf));
% legend('qpLeg1y','mpcLeg1y')
% subplot(4,3,3)
% plot(t_fast(startNf:endNf),qpUnew(3,startNf:endNf));
% hold on;
% plot(t_fast(startNf:endNf),mvOut_fast(3,startNf:endNf));
% legend('qpLeg1z','mpcLeg1z')
% subplot(4,3,4)
% plot(t_fast(startNf:endNf),qpUnew(4,startNf:endNf));
% hold on;
% plot(t_fast(startNf:endNf),mvOut_fast(4,startNf:endNf));
% legend('qpLeg2x','mpcLeg2x')
% subplot(4,3,5)
% plot(t_fast(startNf:endNf),qpUnew(5,startNf:endNf));
% hold on;
% plot(t_fast(startNf:endNf),mvOut_fast(5,startNf:endNf));
% legend('qpLeg2y','mpcLeg2y')
% subplot(4,3,6)
% plot(t_fast(startNf:endNf),qpUnew(6,startNf:endNf));
% hold on;
% plot(t_fast(startNf:endNf),mvOut_fast(6,startNf:endNf));
% legend('qpLeg2z','mpcLeg2z')
% subplot(4,3,7)
% plot(t_fast(startNf:endNf),qpUnew(7,startNf:endNf));
% hold on;
% plot(t_fast(startNf:endNf),mvOut_fast(7,startNf:endNf));
% legend('qpLeg3x','mpcLeg3x')
% subplot(4,3,8)
% plot(t_fast(startNf:endNf),qpUnew(8,startNf:endNf));
% hold on;
% plot(t_fast(startNf:endNf),mvOut_fast(8,startNf:endNf));
% legend('qpLeg3y','mpcLeg3y')
% subplot(4,3,9)
% plot(t_fast(startNf:endNf),qpUnew(9,startNf:endNf));
% hold on;
% plot(t_fast(startNf:endNf),mvOut_fast(9,startNf:endNf));
% legend('qpLeg3z','mpcLeg3z')
% subplot(4,3,10)
% plot(t_fast(startNf:endNf),qpUnew(10,startNf:endNf));
% hold on;
% plot(t_fast(startNf:endNf),mvOut_fast(10,startNf:endNf));
% legend('qpLeg4x','mpcLeg4x')
% subplot(4,3,11)
% plot(t_fast(startNf:endNf),qpUnew(11,startNf:endNf));
% hold on;
% plot(t_fast(startNf:endNf),mvOut_fast(11,startNf:endNf));
% legend('qpLeg4y','mpcLeg4y')
% subplot(4,3,12)
% plot(t_fast(startNf:endNf),qpUnew(12,startNf:endNf));
% hold on;
% plot(t_fast(startNf:endNf),mvOut_fast(12,startNf:endNf));
% legend('qpLeg4z','mpcLeg4z')
%%% check the estDis
figure();
subplot(2,3,1)
plot(t_slow(startNs:endNs),estDis(1,startNs:endNs));
ylabel('estDis\_pCoMx')
subplot(2,3,2)
plot(t_slow(startNs:endNs),estDis(2,startNs:endNs));
ylabel('estDis\_pCoMy')
subplot(2,3,3)
plot(t_slow(startNs:endNs),estDis(3,startNs:endNs));
ylabel('estDis\_pCoMz')
subplot(2,3,4)
plot(t_slow(startNs:endNs),estDis(4,startNs:endNs));
ylabel('estDis\_RPYx')
subplot(2,3,5)
plot(t_slow(startNs:endNs),estDis(5,startNs:endNs));
ylabel('estDis\_RPYy')
subplot(2,3,6)
plot(t_slow(startNs:endNs),estDis(6,startNs:endNs));
ylabel('estDis\_RPYz')
%%% check estL and pST
% figure();
% subplot(2,3,1);
% plot(t_fast(startNf:endNf),estL(1,startNf:endNf)/m/0.19);
% hold on;
% plot(t_fast(startNf:endNf),vCoM_fast(2,startNf:endNf));
% legend('estL\_x/m/H','vY');
% subplot(2,3,2);
% plot(t_fast(startNf:endNf),estL(2,startNf:endNf));
% hold on;
% plot(t_fast(startNf:endNf),vCoM_fast(1,startNf:endNf));
% legend('estL\_y','vX');
% subplot(2,3,3);
% plot(t_fast(startNf:endNf),estL(3,startNf:endNf));
% ylabel('estL\_z');
% subplot(2,3,4);
% plot(t_fast(startNf:endNf),pST(1,startNf:endNf));
% ylabel('pST\_x');
% subplot(2,3,5);
% plot(t_fast(startNf:endNf),pST(2,startNf:endNf));
% ylabel('pST\_y');
% subplot(2,3,6);
% plot(t_fast(startNf:endNf),pST(3,startNf:endNf));
% ylabel('pST\_z');
%%% plot foot end in the world frame
% figure();
% p1=plot(estSP_fast(1,startNf:endNf-200),estSP_fast(2,startNf:endNf-200),'color',[0 0.4470 0.7410]);
% axis equal; grid on;
% hold on;
% p2=plot(estSP_fast(4,startNf:endNf-200),estSP_fast(5,startNf:endNf-200),'color',[0.8500 0.3250 0.0980]);
% p3=plot(estSP_fast(7,startNf:endNf-200),estSP_fast(8,startNf:endNf-200),'color',[0.9290 0.6940 0.1250]);
% p4=plot(estSP_fast(10,startNf:endNf-200),estSP_fast(11,startNf:endNf-200),'color',[0.4940 0.1840 0.5560]);
% plot(estSP_fast(1,startNf),estSP_fast(2,startNf),'o','color',[0 0.4470 0.7410],'markersize',10);
% plot(estSP_fast(4,startNf),estSP_fast(5,startNf),'o','color',[0.8500 0.3250 0.0980],'markersize',10);
% plot(estSP_fast(7,startNf),estSP_fast(8,startNf),'o','color',[0.9290 0.6940 0.1250],'markersize',10);
% plot(estSP_fast(10,startNf),estSP_fast(11,startNf),'o','color',[0.4940 0.1840 0.5560],'markersize',10);
%
%
% legend([p1 p2 p3 p4],{'1','2','3','4'});