Lecture 15: Stability and Control III — Control Holonomic systems with N degrees of freedom and K distinct inputs Philosophy of control: closed loop with feedback Ad hoc control thoughts Controllability Three link robot control 1 K dimensional vector Ideal output INVERSE PLANT disturbance Mechanical/electromechanical system + + GOAL input PLANT - Actual output + error feedback CONTROL 2 Ideal output EQUILIBRIUM disturbance + + GOAL Actual output Q0 input + SIMULATION - error feedback LINEAR CONTROL 3 Ideal output 0 disturbance + + L Q0i i q q i q0i , qÝi 0 Q0 Actual output qÝj M ji pi input - pÝi L Qi q i feedback + error LINEAR CONTROL 4 Let’s think about control in the context of the simple inverted pendulum add a small, variable torque at the pivot q 5 Hamilton’s equations 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 6 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 7 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 8 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 9 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 . . . 10 Suppose we feed back the speed of the pendulum as well as its 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 11 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 12 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 13 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 14 ?? 15 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? ?? 16 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 BfE xÝi A ij x j B ij f Ej In the ad hoc example we worked, we used Q, the generalized force, as input We cannot do that in general, so I have put in fE as the actual external force vector 17 For a single input system like the one we just saw B will be a column vector and fE a scalar and the equation is xÝi A ij x j B i f E We’ll eventually see how we get from Euler-Lagrange to state space including B 18 We want fE (or fE for one input) to be proportional to x the minus sign is conventional f Ej Gkj x k 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 manycolumns as there are state variables G is a row vector for single input systems 19 Rename dummy indices (j —> m) 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? 20 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 W ji Bij , Aki Bkj , Aki Amk Bmj , must be equal to the number of variables in the state There are as many terms in W as there are variables in the state 21 W has as many rows as there are variables. The number of columns in W is equal to the number of variables times the number of inputs In the single input case W 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. 22 ?? 23 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 We are working on the yellow box in the block diagram (This may be a bit hard to follow; we’ll do an example shortly.) 24 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 25 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. 26 Ý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 27 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 vector is The state qk M miQi mi q k 0 qm x m u and the A matrixis straightforward 28 The meaning of B is not immediately clear B is a matrix connecting the actual inputs to the system It is not the connection between the generalized forces and the system We get that by going back and remembering how the generalized forces are defined WÝ Qi i qÝ 29 Recall WÝ F1 v1 1 1 The vector forces and torques are made of components and wearrange the components into the vector fE The velocities and rotation rates are linear functions of the qÝi The terms in WÝ are linear in the components of fE We can combine all this to write WÝ aij qk qÝi f Ej 30 The coefficients will depend on the individual problem but in any case we will have WÝ Qi i aij qk f Ej qÝ We can substitute this into the momentum equation 2 L uÝ M qiqk m 2 L uÝ M qiqk m qk M miQi mi q k 0 qk M miaij qk f Ej mi q k 0 31 Now we can go back to the state picture with a better idea of what A and B are qm x m u state vector state equations Explicit appearance of the actual forces in the differential equations 0 2 L mi xÝ M i k q q q k 0 I m 0 q 0um M mi a qk fE ij 32 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 k M a q ij 33 Can we make sense out of the whole thing — how do we do a problem?! Suppose we are given a mechanism and a task for it to do Consider only the simple task of going to some configuration and stopping there We can treat the final configuration as our equilibrium and design a control that will bring us to that equilibrium j Ýj qÝ Ý q j q0j q1j qÝj qÝ1j , qÝ 1 Qi Q0i Qi We want to make q1j 0, Qi 0 34 Start from square one using what we know so far all the holonomic constraints generalized coordinates Lagrangian generalized forces goal Euler-Lagrange track Hamilton track linearization equilibrium forces control design simulation (nonlinear) 35 Ideal output Hamilton 0 disturbance + + L Q0i i q q i q0i , qÝi 0 Q0 qÝj M ji pi input Actual output Hamilton - pÝi L Qi q i feedback + error LINEAR CONTROL Euler-Lagrange 36 ?? 37