Lecture 14: Stability and Control II Remember that our analysis is limited to linear systems although we will apply linear control to nonlinear systems sometimes successfully Reprise of stability from last time The idea of feedback control 1 Reprise We are dealing with holonomic systems and working with Hamilton’s equations qÝj M ji pi pÝi L Qi i q Look at equilibria such that q i q0i , pi p0i 0 With an equilibrium force Q0i L q i p i 0,q i q 0i 2 Reprise We can combine the coordinates and the momentum into a state vector q i x pi and write the system in terms of x xÝk f k x n ,Qi Equilibrium in this setting requires f k x 0n ,Q0i 0 Last time we worked in q, p space — 3 Reprise We ask what happens if we perturb q and p, but NOT Q q j q0j q1j pi p0i p i p i qÝj M ji q0k p i 2 L k pÝ q i i k q q 0 4 Reprise The coefficients on the right hand sides are constant matrices and we can write the equations in a unified matrix notation 2 L pÝ qk i i k q q 0 qÝ M q p i j ji k 0 0 j qÝ 2 L i k pÝ i q q 0 M ji q0k j q 0 p i How does this work in state space? 5 Reprise x k x 0k x k f i k xÝ f x ,Q0i k x x i k n 0 f i k xÝ k x x i 0 j f 2 i L x i k q q 0 M ji q0k 0 This is a mixed notation to indicate what goes where it isnot a meaningful notation in terms of the location of the indices 6 Reprise The matrix is constant, so the state vector has exponential solutions f i k f i k i k x X exp st xÝ k x sIk X k X x x k k i i f i k i f i sIk k X 0 detsIk k 0 x x 7 Reprise We can write this symbolically as s s s det 2 L i k q q 0 M ji q0k 0 s s s which is a polynomial in s of the same degree as the number of variables — generally twice as many as there are generalized coordinates/degrees of freedom (This is not fully general, but it will suit our current purposes.) 8 Reprise And the real part of s tells us about stability If Re(s) < 0 for all s, the system is asymptotically stable If Re(s) > 0 for any s, the system is unstable If Re(s) = 0 for all s, the system is marginally stable stable: if we move the system away from equilibrium, the system will go back unstable: if we move the system away from equilibrium, the error will grow (initially) exponentially marginally stable: if we move the system away from equilibrium, the error will oscillate about its reference position 9 ?? 10 OK, let’s take a break and go look at the stability of a three link robot Note that I told you some wrong things last time I was working too fast and let some stuff slip GO TO MATHEMATICA 11 We quit here; the remainder of this set will reappear in our next class. 12 Let’s think about control in the context of the simple inverted pendulum add a small, variable torque at the pivot q 13 qÝ 1 L Ý p, p mglsin q Q 2 ml q There’s a change of sign from the simple pendulum from last time because I have chosen a different definition of q We have equilibrium at q = 0, and Q = 0 there as well. We know that this will be unstable if it is perturbed with Q remaining zero Let’s see how this goes in a state space representation 14 q 1 p 0 2 x xÝ ml Q p 1 mglsin q (I’ve put in the because Q is zero at equilibrium) 1 qÝ p 0 2 xÝ Q ml Ý p 1 mglsin q0 q q Ý 1 p 0 0 2 ml Q Ý 1 p mglcosq0q mglcosq0 1 q 0 2 Q ml p 1 0 15 0 Ý x mglcosq0 1 0 2 x Q ml 1 0 If q starts to increase, we feel intuitively that we ought to add a torque to cancel it Q g1q 0 xÝ mglcosq0 1 0 2 x g q ml 1 1 0 We can expand the feedback term 0 Ý x mglcosq0 1 q 0 2 x g1 0 ml 1 p 0 16 0 xÝ mglcosq0 1 0 2 x g1 0x ml 1 0 multiply the column vector and the row vector 0 xÝ mglcosq0 1 0 0 2 x x ml g 0 0 1 combine the forced system into a single homogeneous system 0 xÝ g1 mglcosq0 1 2 x ml 0 17 The characteristic polynomial for this new problem can be solved for s2 1 g1 mglcosq0 2 ml and so I can make s2 negative by applying some gain g1. So this very simple feedback can make an unstable system marginally stable We can do better . . . 18 Suppose we feedback the speed of the pendulum as well as the position? Q g1q g2 p 0 xÝ mglcosq0 0 Ý x mglcosq0 1 0 2 x g q g p 1 2 ml 1 0 1 q 0 2 x g1 g2 ml 1 p 0 0 xÝ mglcosq0 1 0 0 2 x x ml g g2 0 1 19 Combining everything again we get 0 xÝ g1 mglcosq0 1 2 x ml g2 And now the characteristic polynomial comes from 1 s 2 det ml 0 g1 mglcosq0 s g2 ss g2 1 g mglcosq0 0 2 1 ml 20 ss g2 1 g1 mglcosq0 0 ml2 The linear term is the key — the feedback from the derivative 1 1 2 1 s g2 g2 4 2 g1 mglcosq0 2 2 ml We can adjust this to get any real and imaginary parts we want If you are familiar with the idea of a natural frequency and a damping ratio then you might like to set the control problem up in that language 21 ss g2 1 g1 mglcosq0 0 ml2 can be made the same as the one degree of freedom mass-spring equation s2 2z n s n2 0 by setting g2 2z n , g1 mglcosq0 ml2 n2 s z n n z 2 1 giving The real part is always negative. If z is less than unity, there is an imaginary part. If z equals unity the system is said to be critically damped 22 This suggests a bunch of questions Is this generalizable to more complicated systems? Is there a nice ritual one can always employ? YES SOMETIMES Is this always possible? Will the linear control control the nonlinear system? NO SOMETIMES How much of this does it make sense to include in this course? ?? 23 The question of possibility is really important so I’m going to address that as soon as I can develop some more notation The general perturbation problem for control will be xÝ Ax BQ xÝi A ij x j Bij Q j For a single input system like the one we just saw B will be a column vector and Q a scalar and the equation is xÝi A ij x j B iQ 24 We want Q (or Q for one input) to be proportional to x Q j Gkj x k the minus sign is conventional xÝi A ij x j B ij Gkj x k We see that G has as many rows as there are inputs and as many columns as there are state variables G is a row vector for single input systems 25 Rename some dummy indices to make it possible to combine terms xÝi Aij BmiGmj x j We have xÝi Aij BiG j x j for the single input case Our control characteristic polynomial will come from det sI ij Aij BmiGmj 0 and the question is: is it always possible to find G such that the roots are where we want them? 26 There are always at least as many gains as there are roots, so you’d think so But it isn’t. The controllability criterion, which I will state without proof, is that the rank of Qij Bij , Aki Bkj , Aki Amk Bmj , must be equal to the number of variables in the state There are as many terms in Q as there are variables in the state 27 Q has as many rows as there are variables. The number of columns in Q is equal to the number of variables times the number of inputs In the single input case Q is a square matrix AND there is a nice simple way to figure out what the gains must be for stability We are not going to explore this — we haven’t the time — and it is covered in most decent books on control theory We can get by with guided intuition. 28 ?? 29 Single input systems are much simpler than multi-input systems but we have need of multi-input systems frequently I will outline the intuitive approach to multi-input systems which works best (at least for me) through the Euler-Lagrange equations This may be a bit hard to follow; we’ll do an example next time 30 Euler-Lagrange equations d L L Qi dt qÝi q i which we can rewrite Ýj M ijqÝ 1 d L j Ý M q Qi ij i 2 dt q 1 M ij j k L Ý M ijqÝ qÝqÝ i Qi k 2 q q j 31 For a steady equilibrium, which is what we are learning how to do L L Q 0 Q i 0i q i q i qÝk 0 perturbation j Ýj qÝ Ý q j q0j q1j qÝj qÝ1j , qÝ 1 Qi Q0i Qi 1 M ij 2 j k L Ý M ijqÝ qÝ qÝ i Q0i Qi k 2 q q j We can drop this term because of the 2. 32 Ýj M ijqÝ L Q0i Qi i q and we need to perturb the gradient of the Lagrangian to finish the linearization L L i i q q 2 L i k q q q k 0 2 L Ý i k M ijqÝ q q qk O 2 q k 0 qk Qi j q k 0 or 2 L Ý M qÝ qiqk m qk M miQi mi q k 0 33 We can use our old method of converting to first order odes on this and decide controllability (before we knock ourselves out trying to control it) qÝm u m 2 L uÝ M i k q q m The state vector is qk M miQi mi q k 0 qm x m u 34 The A matrix is 0 2 L mi A M i k q q q k 0 I 0 and the B matrix is 0 B mi M 35 ?? 36