-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplotController.m
More file actions
44 lines (39 loc) · 1.3 KB
/
plotController.m
File metadata and controls
44 lines (39 loc) · 1.3 KB
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
function [] = plotController(x0,y0,v0,delta0,phi0, ...
phi_dot0,psi0,p, K, delta_offset, lag1,lag2, numtime, graph)
%adapted from PlotMultipleControllersTogether to be usable with multiple
%timelags and to be usable as a function with many inputs.
%timelag specifies the lag between observing and acting on the state;
%version specifies that if 0, no time delays are desired, 1 specifies that
%only
[~, offset0] = runBicycleTestR(x0,y0,v0,delta0,phi0, ...
phi_dot0,psi0, p,K, delta_offset,lag1,lag2, numtime,graph);
times = offset0(1:numtime,1);
phi = offset0(1:numtime,4);
delta = offset0(1:numtime,6);
phidot = offset0(1:numtime,7);
deltadot = diff(delta)./diff(times);
subplot(2,2,1)
hold on
plot(times,phi);
title('lean vs. time');
xlabel('time (s)');
ylabel('phi');
subplot(2,2,2)
hold on
plot(times,phidot);
title('lean rate vs. time');
xlabel('time (s)');
ylabel('phi-dot');
subplot(2,2,3)
hold on
plot(times,delta);
title('steer vs. time');
xlabel('time (s)');
ylabel('delta');
subplot(2,2,4)
hold on
plot(times(1:end-1),deltadot);
title('steer rate vs. time');
xlabel('time (s)');
ylabel('deltadot');
end