Overview
Comment: | Updated for liuping's qp_hild.m Used on IP experiment |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
efb6c42d89ea0a7bbbf92ac11a5bf22a |
User & Date: | gawthrop@users.sourceforge.net on 2004-10-20 21:58:12 |
Other Links: | branch diff | manifest | tags |
Context
2005-01-06
| ||
12:28:36 | Minor typos. check-in: b064c9ddbc user: geraint@users.sourceforge.net tags: origin/master, trunk | |
2004-10-20
| ||
21:58:12 |
Updated for liuping's qp_hild.m Used on IP experiment check-in: efb6c42d89 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
2004-10-14
| ||
21:42:44 | Changed timing - now works with inverted pendulum. check-in: d896096f57 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/lib/control/PPP/ppp_are.m from [374eed77eb] to [36a7ac48d8].
|
| | | > > > > > > > > > > | > > > > > | | | | 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 | function [P,A_u,A_w,k] = ppp_are (A,B,C,D,Q,R,A_type) ## usage: [P,A_u,A_w] = ppp_are (A,B,C,D,Q,R,A_type) ## ## if nargin<1 disp("usage: [P,A_u,A_w] = ppp_are (A,B,C,D,Q,R,A_type)"); return endif if nargin<7 A_type = "feedback"; endif ## Steady-state Linear Quadratic solution ## using Algebraic Riccati equation (ARE) Q_x = C'*Q*C; # Weighting on x [k, P, poles] = lqr (A, B, Q_x, R); # Algebraic Riccati solution ## Basis functions if strcmp(A_type,"companion") A_u = compan(poly(poles)); elseif strcmp(A_type,"feedback") A_u = A-B*k; else error(sprintf("A_type must be %s, not %s", "companion or feedback", A_type)); endif ## Avoid spurious imag parts due to rounding A_u = real(A_u); ## Setpoint basis functions A_w = 0; endfunction |
Modified mttroot/mtt/lib/control/PPP/ppp_lin_run.m from [2ee57392e6] to [10c572cbb5].
︙ | ︙ | |||
11 12 13 14 15 16 17 | ## Control = 0: step test ## Control = 1: PPP open-loop ## Control = 2: PPP closed-loop ## w is the (constant) setpoint ## par_control and par_observer are structures containing parameters ## for the observer and controller | < < | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Control = 0: step test ## Control = 1: PPP open-loop ## Control = 2: PPP closed-loop ## w is the (constant) setpoint ## par_control and par_observer are structures containing parameters ## for the observer and controller ##Defaults if nargin<1 # Default name to dir name names = split(pwd,"/"); [n_name,m_name] = size(names); Name = deblank(names(n_name,:)); endif |
︙ | ︙ |
Modified mttroot/mtt/lib/control/PPP/ppp_qp.m from [fa82338072] to [78c9145b4b].
|
| | | 1 2 3 4 5 6 7 8 | function [u,U,n_active] = ppp_qp (x,W,J_uu,J_ux,J_uw,Us0,Gamma,gamma,mu,test) ## usage: [u,U] = ppp_qp (x,W,J_uu,J_ux,J_uw,Gamma,gamma) ## INPUTS: ## x: system state ## W: Setpoint vector ## J_uu,J_ux,J_uw: Cost derivatives (see ppp_lin) ## Us0: value of U* at tau=0 (see ppp_lin) |
︙ | ︙ | |||
41 42 43 44 45 46 47 | if (n != n_U)||(m != n_x) error("J_ux should be %ix%i not %ix%i",n_U,n_x,n,m); endif if length(gamma)>0 # Constraints exist: do the QP algorithm ## QP solution for weights U | > | > | | 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 | if (n != n_U)||(m != n_x) error("J_ux should be %ix%i not %ix%i",n_U,n_x,n,m); endif if length(gamma)>0 # Constraints exist: do the QP algorithm ## QP solution for weights U ## [U,iterations] = qp_mu(J_uu,(J_ux*x-J_uw*W),Gamma,gamma,mu,[],[],0,test); [U,n_active] = qp_hild(J_uu,(J_ux*x - J_uw*W),Gamma,gamma); # ## iterations = 0; ##U = qp(J_uu,(J_ux*x - J_uw*W),Gamma,gamma); # QP solution for weights U ##U = pd_lcp04(J_uu,(J_ux*x - J_uw*W),Gamma,gamma); # QP solution for weights U u = Us0*U; # Control signal else # Do the unconstrained solution ## Compute the open-loop gains n_active = 0; K_w = J_uu\J_uw; K_x = J_uu\J_ux; ## Closed-loop control U = K_w*W - K_x*x; # Basis functions weights - U(t) u = Us0*U; # Control u(t) endif endfunction |