Added positional control and discretized model

This commit is contained in:
Lakshu Periakaruppan
2020-04-16 11:45:05 -04:00
parent 0de43c3cb8
commit 12bbc1ce73
2 changed files with 14 additions and 8 deletions

View File

@@ -47,6 +47,8 @@ C = [1 0 0 0 0 0 0 0 0 0 0 0;...
0 0 0 0 0 0 0 1 0 0 0 0;... 0 0 0 0 0 0 0 1 0 0 0 0;...
0 0 0 0 0 0 0 0 1 0 0 0] 0 0 0 0 0 0 0 0 1 0 0 0]
D = zeros(6,4) D = zeros(6,4)
sys = ss(A,B,C,D);
sysd = c2d(sys, 1/100);
x0 = 0; x0 = 0;
y0 = 0; y0 = 0;
@@ -62,16 +64,20 @@ thetadot0 = 0;
psidot0 = 0; psidot0 = 0;
initialCondition = [x0, y0, z0, xdot0, ydot0, zdot0, phi0, theta0, psi0, phidot0, thetadot0, psidot0]; initialCondition = [x0, y0, z0, xdot0, ydot0, zdot0, phi0, theta0, psi0, phidot0, thetadot0, psidot0];
%%
%Gains %Gains
kpp = 10; kpp = 0.4754;
kdp = 0.2; kdp = .1;
kpt = 4; kpt = 0.4754;
kdt = 0.2; kdt = 0.1;
kpps = 1; kpps = 0.0901;
kdps = .4; kdps = 0.0486;
kpz = 100; kpz = 4.0670;
kdz = 20; kdz = 2.9031;
Q = zeros(12); Q(7:9, 7:9) = eye(3);
R = 1;
%K = lqr(A,B,Q,R);

Binary file not shown.