Seesaw Lab Experiment - Laboratory Experience

Page created by Shannon Mann
 
CONTINUE READING
Seesaw Lab Experiment - Laboratory Experience
Seesaw Lab Experiment

         Laboratory Experience

    Institute for Dynamic Systems and Control
Swiss Federal Institute of Technology (ETH) Zurich

                      Edit
               Michele Vivaldelli
               Florian Zurbriggen
                 Gehlen Manuel

                 September 2013
Seesaw Lab Experiment - Laboratory Experience
Contents

1 Introduction                                                                                                                                                        1

2 Home Works                                                                                                                                                          3
  2.1 Model Derivation . . . . . .    .   .   .   .   .   .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   3
      TASK: Coulomb Friction .        .   .   .   .   .   .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   4
      TASK: Equilibrium States        .   .   .   .   .   .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   5
  2.2 Linear Model . . . . . . . .    .   .   .   .   .   .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   5
      QUESTION: Carts Input           .   .   .   .   .   .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   6
  2.3 Position Controller . . . . .   .   .   .   .   .   .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   6
      QUESTION: PD Tuning .           .   .   .   .   .   .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   7
      TASK: SISO Controller . .       .   .   .   .   .   .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   7

3 Lab Experience                                                                                                                                                       8
  3.1 SISO Controller application . . . . . .                 . . . . . . .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    8
      TASK: Position Controller Test . . .                    . . . . . . .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    9
      QUESTION: Steady State Error . .                        . . . . . . .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   10
      QUESTION: Solutions to the Steady                       State Error                     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   10
      QUESTION: Test on the hardware .                        . . . . . . .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   10
  3.2 LQR Controller . . . . . . . . . . . . .                . . . . . . .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   11
      TASK: LQR simulation . . . . . . . .                    . . . . . . .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   11
      QUESTION: Derivative Actions . . .                      . . . . . . .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   12
      TASK: LQR application . . . . . . .                     . . . . . . .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   12
      QUESTION: Encoder Initialisation .                      . . . . . . .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   13
  3.3 Observer - LQG . . . . . . . . . . . . .                . . . . . . .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   14
      TASK: Observer . . . . . . . . . . . .                  . . . . . . .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   14
      QUESTION: Cart 1 effect . . . . . .                     . . . . . . .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   14
  3.4 Full State Space - LQG . . . . . . . .                  . . . . . . .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   15
      TASK: LQG full state space . . . . .                    . . . . . . .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   15
  3.5 Integral Action - LQGI . . . . . . . . .                . . . . . . .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   17
      TASK: LQGI . . . . . . . . . . . . . .                  . . . . . . .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   17
      QUESTION: SISO Controller . . . .                       . . . . . . .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   18

                                                              i
Chapter 1

Introduction

                               Figure 1.1: Seesaw hardware

The aim of the present laboratory experience is to make the students gain familiarity with
various control techniques by applying them to the system depicted in Figure 1.1.

The system is known as Seesaw and it is constituted by a body (the seesaw itself) free to
rotate with respect to its central kingpin and two carts, which can be moved on its top
thanks to electric motors. The sensors in use are three encoders, two of which are used
to determine the position of the carts and the third one measures the angle of the seesaw.
Therefore, the system is defined by two inputs (the torques to the carts’ drives) and three
outputs (position first cart, position second cart and seesaw angle).

                                            1
Chapter 1. Introduction                                                                   2

The final objective of the lab experience is to stabilize the seesaw around a user-defined
angle, balancing it throughout the movements of one cart and using the second cart as a
disturbance. This final result is achieved by going through some intermediate steps, which
are detailed in the following script and are meant to give a deeper insight into the control
challenges. In particular, Chapter 2 presents the modeling part of the system and involves
the students into some first tasks, which have to be carried out at home before coming
to the laboratory. Chapter 3, instead, deals with the tasks the students will have to go
through while being in the lab.

The overall experience involves:

   • System analysis and understanding;

   • SISO controllers loop shaping;

   • LQR controller;

   • Observer design;

   • Integral action for steady state error;

   • Critical comparison of the different control solutions.

The assistant will explain to each group how to handle the mechanical system and what
initialization procedure has to be followed in order to use it. Moreover, the system is
equipped with some safety measures. In particular:

   • Sensors will recognize when the carts are close to their boundaries and will set their
     torque to zero, to avoid the carts from hitting the walls at high speed;

   • There is a red safety in front of experiment. Pressing it immediately stops all the
     inputs to the carts and should be used when the system does not respond as expected.
     Always keep a hand on it when using the real system in order to be ready to stop
     the experiment if something goes wrong;

   • It is always possible to stop the experiment from the Simulink interface, when the
     behavior of the system is not as desired.
Chapter 2

Home Works

2.1     Model Derivation

                                                  Y0

                                                            Ym

                                                                  Xi

                                                            FMi
                                                                        mi
                                                                             FFi
                                                                   Xm
                                                  θ
                                                          Ψi

                                                      Ms , Js
                              h
                                         hs

                                                            CF
                                                                                         X0

                              Figure 2.1: System Modelling

Figure 2.1 presents the main quantities and forces acting on the system. In order to math-
ematically describe the mechanical system, it has been chosen to use the Force and Torque
Balance approach, which eases the complexity of the resulting model while approximating
the real behavior in an acceptable way.

In order to build up the model, the following assumptions are made:

                                              3
Chapter 2. Home Works                                                                          4

   • The motor forces are considered linear and dependent on the current given to the
     electric drive and the velocity of the cart itself:
     FM i = Cui Ii − Cẋi ẋi  i ∈ (1, 2)
   • The dynamic friction forces are considered as a damping effect that is proportional
     to the velocity of each cart:
     FF i = µi ẋi   i ∈ (1, 2)
   • The dynamic friction torque is considered proportional to the angular velocity:
     CF = µs θ̇
The following table presents the parameters used in the model, including their meaning
and value.
   Parameter    Description                                              Value    Unit
      m1        Mass of Cart 1                                           0.696    kg
      m2        Mass of Cart 2                                           0.690    kg
      Ms        Mass of the Seesaw in its Center of Gravity              4.872    kg
       Js       Inertia of the Seesaw in its Center of Gravity            0.8     kg·m2
       hs       Height of the Center of Gravity of the Seesaw            0.077    m
       h        Height of the Seesaw                                      0.12    m
       r1       Dynamic friction coefficient for Cart 1 (Cẋ1 + µ1 )      2.32    N·s/m
       r2       Dynamic friction coefficient for Cart 2 (Cẋ2 + µ2 )       3      N·s/m
      Cu1       Motor Cart 1 Constant                                    3.944    N/A
      Cu2       Motor Cart 2 Constant                                     5.7     N/A
      µs        Dynamic friction coefficient of the Seesaw                0.4     N·m·s/rad
      Fc        Coulomb Force                                              ??     ??
The overall system has three degrees of freedom, namely the position of the first cart (x1 ),
the position of the second cart (x2 ) and the seesaw angle (θ). Therefore, three equations
of motion need to be formulated. Based on the Force and Torque balance method, the
following equations are obtained:
     m1 x¨1 = Cu1 I1 − Cẋ1 x˙1 − µ1 x˙1 + m1 g sin(θ) − sign(x˙1 )Fc                       (2.1)
     m2 x¨2 = Cu2 I2 − Cẋ2 x˙2 − µ2 x˙2 + m2 g sin(θ) − sign(x˙2 )Fc                       (2.2)
      Js θ̈ = Ms g sin(θ)hs − µs θ̇ − h(Cu1 I1 − Cẋ1 x˙1 − µ1 x˙1 − sign(x˙1 )Fc ) + · · ·
              −h(Cu2 I2 − Cẋ2 x˙2 − µ2 x˙2 − sign(x˙2 )Fc ) + m1 g(h sin(θ) + x1 cos(θ)) + · · ·
              +m2 g(h sin(θ) + x2 cos(θ))                                                   (2.3)
The first and second equation result from the balance of forces acting on the carts, while
the third equation is the balance of torques around the seesaw kingpin.

TASK: Coulomb Friction
In the parameter table, everything is known except from the Coulomb Force Fc . Knowing
that the current needed to move Cart 1 is at least 0.2 A, find the value of Fc .
Chapter 2. Home Works                                                                        5

TASK: Equilibrium States
Calculate the equilibrium states of the system from the given model. Explain why there
are infinite equilibrium positions and why they are all unstable.

2.2      Linear Model
Linearizing the system in the ~x = ~0 equilibrium yields to the following linear state-space
representation:
      (
        ~x˙ = Ã~x + B̃~u
        ~y = C̃~x + D̃~u

where:
                                                             
                                                 0         I1
      ~x =       x1 x2 θ x˙1 x˙2 θ̇ ,                  ~u =     ,          ~y = I~x
                                                             I2

                  0     0                     0          1      0        0
                                                                                
                 0     0                     0          0      1        0       
                                                                                
                 0     0                     0          0      0        1       
      Ã = 
                 0     0                     g         − mr11  0        0
                                                                                 
                                                                                 
                                                               − mr22
                                                                                
                 0     0                     g          0               0       
                 gm1    gm2      Ms ghs +m1 gh+m2 gh
                  Js     Js               Js
                                                         hr1
                                                         Js
                                                                 hr2
                                                                 Js
                                                                        − µJss

                  0              0
                                         
                 0              0        
                                         
                 0              0        
      B̃ = 
            Cmu1                0
                                          
                                                                                         (2.4)
            1                 Cu2
                                          
            0                            
                               m2
            − CJu1s h         − CJu2s h

The eigenvalues of matrix à are:
          3.5216; −1.3054 + 2.708i; −1.3054 − 2.708i; 0; −5.2775; −3.8145
Therefore, as expected, the system has an unstable pole for s = 3.5216.

Since the system will be controlled with a state-space controller (LQR), it is important
to normalize it. For the given system it is not possible to normalize the system around
the position in which it has been linearized, since in this specific equilibrium all states are
zero. Therefore, a normalization with the maximum value of each variable is used in the
following:
Chapter 2. Home Works                                                                      6

                      x1max    =    0.47   [m]
                      x2max    =    0.47   [m]
                      θmax     =    15     [deg]     =   0.2618   [rad]
                      ẋ1max   =    5      [m/s]
                      ẋ2max   =    5      [m/s]
                      θ̇max    =    30     [deg/s]   =   0.5236   [rad/s]
                      I1max    =    4.8    [A]
                      I2max    =    4.8    [A]

QUESTION: Carts Input
Up to this point, the model has been derived, linearized and normalized. Before proceeding
to the next part, it is useful to understand why the two motor currents are considered as the
inputs to the system. In fact, we are assuming that the torques (directly proportional to
the currents) can be chosen at every time step. Under which conditions is this assumption
valid?

2.3     Position Controller
The first controller that has to be derived for this system is a position controller for Cart
1. It will be used to move the cart when the seesaw is fixed in its horizontal position. This
is a good exercise to apply loop-shaping techniques for SISO controllers. During the lab
experience, the resulting regulator will be used to introduce disturbances and hence test
the robustness of LQR controllers (which will use the other cart to stabilize the seesaw).

                               Figure 2.2: Horizontal Position

When the seesaw is fixed in the horizontal position as shown in Figure 2.2, the transfer
function between the current and the position of Cart 1 is:

      X1 (s)  1    Ki
             = ·                   Ki = 1.7     Ti = 0.3                                (2.5)
      I1 (s)  s 1 + s · Ti
Chapter 2. Home Works                                                                     7

The non-normalized system is used here. The normalization will be introduced later-on,
when dealing with state-space controllers.

QUESTION: PID Tuning
Why is the classical Ziegler and Nichols tuning procedure not possible for this plant?
Discuss this by looking at the Nyquist plot of the plant transfer function.

TASK: SISO Controller
   • Download the simulation files from the website ’Prelab.zip’, unzip them in a folder
     and set that folder as ’Current Folder’ in Matlab;

   • Create the Transfer Function of Cart 1 (2.5) in the workspace and name it P

   • Open the sisotool GUI with the command sisotool(P). By default, Bode plots
     and Root Locus are shown. In the window ’SISO Design for SISO Design Task’ it is
     possible to choose various additional plot from the menu ’Analysis’, such as Nyquist
     plot, Step Response, etc. See the Matlab documentation for more information about
     the usage of sisotool.

   • The tab ’Compensator Editor’ in the window ’Control and Estimation Tools Man-
     ager’ allows the user to modify the controller, adding zeros and poles. Try to find a
     suitable controller that guarantees:

        – ωc ∼ 10 [rad/sec] cut-off frequency;
        – φm ∼ 60 [deg] phase margin;

   • In order to simulate the behavior of a controller, go to the window ’SISO Design for
     SISO Design Task’ and choose ’Export...’ from the ’File’ menu. Click on ’C’ to
     select it and only afterwards click on the button ’Export to Workspace’. Make sure
     that the new variable called ’C’ has been created in the workspace.

   • Launch the simulation running the m-file called ’RunSimulation.m’. You probably
     recognize - depending on the controller structure - that there is a steady-state error
     between the cart position and the required position, although the linearized plant
     has an integrator.

        – What is the reason for this behavior?

   • Save the controller (for example in a .mat file) and bring the file to the lab. It will
     be tested on the real hardware during the lab.
Chapter 3

Lab Experience

3.1      SISO Controller application
The first task of the laboratory experience is to test the position controller you designed at
home on the real hardware. In order to do this, the seesaw has to be fixed in the horizontal
position as shown in Figure 3.1.

Ask for the help of the assistant when trying to interface Simulink to the real hardware for
the first time. An initialization procedure has to be followed in order to make the system
work properly. The procedure is also explained in the task below.

Note that ’Cart 1’ is the one on the back, closer to the wall, while ’Cart 2’ is the one next
to the emergency button.

                     Figure 3.1: Seesaw fixed in the horizontal position

                                              8
Chapter 3. Lab Experience                                                                      9

TASK: Position Controller Test
   • Enter into the folder ’3 1 PositionController’
   • Store the transfer function of the controller you derived at home with sisotool in
     the workspace. The name of this transfer function has to be ’C’;
   • Open the Simulink interface file named ’PositionController.mdl’ ;
   • At this point, it is possible to start the experiment on the real hardware. Ask for the
     help of the assistant if this is the first time you go through the procedure.
   • Before connecting Simulink to the plant, make sure the cart is in the initialization
     position shown in Figure 3.2(a).

                         Y0                                               Y0

              MAX

                                            X0                                            X0

               (a) Initialisation                               (b) Initial Position

                    Figure 3.2: Horizontal Position - Initialisation procedure

   • During the first 10 seconds the controller is switched off and you have to manually
     bring the cart in the center position shown in Figure 3.2(b). Bearing this in mind:
       1. click on the ’Connect to Target’ button in Simulink;
       2. start the experiment using the ’Start Real-time code’ button;
       3. move the cart in the center position after the simulation started.
   • After 10 seconds, the cart will start following a pre-defined reference path. When it
     is back at the center position, the simulation is stopped automatically.
   • Plots of the measurements taken from the real hardware will be displayed on screen.
     Compare these outputs with the simulation outputs obtained at home.
   • The Simulink file integrates the absolute value of the error (actual position vs required
     position) and shows the final value in the black display at the top right of the screen.
     Pay attention to this value since it is our benchmark parameter to compare this
     controller with the following ones. A good value for this first controller should be
     around 52.
Chapter 3. Lab Experience                                                                 10

QUESTION: Steady State Error
Exactly as in the simulations at home, you should notice a steady-state error in the mea-
surements which are plotted at the end of each test on the real hardware.

Assume that the real hardware presents a friction, which can be modelled as a Coulomb
Friction (Figure 3.3). What problem does this kind of friction present when using Linear
Control Theory?

                                                F

                                               +Fc

                                                               v

                                         -Fc

                              Figure 3.3: Coulomb Friction

QUESTION: Solutions to the Steady State Error
Which possible solutions do you think will reduce or eliminate this steady-state error?
Could your solutions introduce additional problems or side-effects?
Discuss pros and cons of each solution with the assistant.

TASK: Test on the hardware
Once a solution has been discussed and agreed with the assistant, implement it in the
’PositionController.mdl’ file and test it on the real hardware. A good solution should be
able to obtain an error between 30 and 35.
Chapter 3. Lab Experience                                                                       11

3.2      LQR Controller
At this point, let the seesaw free to rotate by unfixing the vertical constrains. From now
on, the control task will be to balance the rotation of the Seesaw using only Cart 2. Cart
1 will be used to introduce disturbances to test the robustness of the designed controller.

Since the controller will act on the seesaw rotation only throughout Cart 2, it is possible to
simplify the system by assuming that Cart 1 is always kept at the center position, i.e. the
disturbance is assumed to have zero mean. This assumption leads to the reduced model:
                                                         
                 0               0             1       0
               0                0             0       1 
      Ãr =   0                g              r2
                                             − m2      0 
                                                          
                   gm2       Ms ghs +m1 gh+m2 gh   hr2   −µs
                    Js                Js           Js     Js
                        
                     0
                    0
      B̃r = 
             Cmu2 
                                                                                            (3.1)
                 2
             − hCJsu2

The state vector is composed only by x~r = [x2 , θ, x˙2 , θ̇] and the input is ur = [I2 ]. In order
to accomplish the following task, a LQR controller needs to be designed. Being a state
space controller, a LQR needs to know the whole state vector at every time step. Since it
is only possible to measure the positions (x2 and θ) with the encoders, it is necessary to
find a way to obtain the velocity states.

In a first attempt, the velocities can easily be obtained by differentiating the position
signals. The following task wants to show that this solution is not working effectively and
it can introduce problems into the control structure.

TASK: LQR simulation
   • Open the folder ’3 2 LQR’. Before applying the controller to the real hardware, it
     will be tested on simulations;

   • If the previous controller for Cart 1 is not loaded in the workspace, recreate its
     transfer function and call it ’C’;

   • Open the m-file ’simulation ControllerDesign.m’. Choose weights for the LQR con-
     troller, bearing the control objective and the meaning of each state in mind. More-
     over, considering the problems related to the usage of pure derivative actions on the
     position signals, keep the crossover frequency below 20 rad/s. If you want to test the
     effect of a faster controller, call your assistant before running the experiment on the
     hardware and be prepared to press the emergency button;
Chapter 3. Lab Experience                                                                12

   • Run the ’simulation ControllerDesign.m’ file. Results of the simulation will appear
     on screen and help to assess the performance of the designed controller.

QUESTION: Derivative Actions
In the simulation the velocities are obtained as derivatives of the positions but this does
not seem to be a problem for the controller. Which is the reason why derivative actions will
cause problems when applied to real encoders outputs? What do you think will happen
when testing this same controller on the real hardware?

TASK: LQR application
   • Make sure that the controller gain is present in the workspace under the name of
     K lqr. If not, run again the file ’simulation ControllerDesign.m’ in the folder ’LQR’ ;

   • Open the Simulink file ’LQR.mdl’, which is the interface between Matlab and the
     real hardware;

   • Before applying the controller, a start-up procedure needs to be followed. Ask for
     the help of the assistant if this is the first time you go through these steps.

   • Start-up Procedure

        1. Bring the system into the initialisation position, shown in Figure 3.4(a);
        2. Press the Simulink button ’Connect to Target’. This will initialize all the en-
           coders measures;
        3. Press the Simulink button ’Start Real-time code’. This will start the controller
           connected to the real hardware;
        4. For the first 10 seconds, the controller is still switched off. During this time,
           manually bring and keep the system in the center position, shown in Figure
           3.4(b);
        5. At exactly 10 seconds, the LQR controller will start its action. At this point,
           leave the seesaw free to rotate and assess the controller performance on the real
           hardware.
Chapter 3. Lab Experience                                                                  13

                             Y0                                         Y0

          MAX          MAX

                                           X0                                         X0

           (a) Initialisation Position                        (b) Center Position

                     Figure 3.4: Seesaw Balance - Initialisation procedure

   • If the controller is not working properly, either press the red emergency button in
     front of the seesaw or stop the Simulink file with the usual ’Stop’ button;

   • If the controller works properly, try to introduce some disturbances manually by
     changing the seesaw angle.

   • Press the ’Stop’ button when the test is finished. Plots of the measurements from
     the real hardware will be presented on screen. You should have noticed the difference
     between the performance expected based on the simulation and the performance of
     the controller applied to the real hardware.

QUESTION: Encoder Initialisation
The start-up procedure described above is essential to have the system working in the
proper way and it has to be followed in all the future tests on the real hardware. Why is
this procedure so important for the encoders? Explain the reason why it is not possible to
measure absolute displacements with these sensors.
Chapter 3. Lab Experience                                                               14

3.3     Observer - LQG
From the previous test on the real hardware, it should be clear that deriving position
signals is not always a good solution for obtaining velocity signals. The following task
wants to show how an observer, based on the system presented in (3.1), can be used to
obtain the same information while giving better control results.

TASK: Observer
   • Open the folder ’3 3 LQG Observer’ ;
   • Open the file ’simulation LQG Design.m’. Choose the weights for the LQR controller
     and for the Observer following the LTR procedure. No limits on the LQR crossover
     frequency are now present;
   • Run the ’simulation LQG Design.m’ m-file to obtain simulation results and LTR
     comparison.
   • Once LQR and Observer are considered acceptable, make sure the controller gain
     K lqg and the observer matrices Aobs, Bobs, Cobs and Dobs are present in the
     workspace. If not, run the ’simulation LQG Design.m’ file again;
   • Open the Simulink interface file ’LQG.mdl’ ;
   • Start-up Procedure: follow the start-up procedure explained in the previous task or
     call the assistant if help is needed;
   • Press the red emergency button if the controller does not respond in a good way;
   • If the controller works, try to introduce some disturbances manually changing the
     seesaw angle.
   • If the controller is able to stabilize the seesaw angle, try to move Cart 1 away from
     the center position. The Simulink interface loads the Cart 1 controller which has
     been derived with sisotool (’C’ controller) in order to use it as position controller
     for this cart.
   • Press the Simulink ’Stop’ button to stop the test and to obtain measurements plots
     on screen;
   • Using the resulting plots, notice the difference between the velocities obtained with
     the derivative actions and those obtained with the observer.

QUESTION: Cart 1 effect
Is the control structure still able to stabilize the seesaw angle, when moving Cart 1 away
from the center position? If not, which could be possible explanations?
Chapter 3. Lab Experience                                                                 15

3.4     Full State Space - LQG
Up to this point, the reduced model with 4 states has been used to derive both: LQR
controllers and Observer. It has been shown in the previous task that this representation
is not sufficient to make the controller robust towards disturbances introduced with Cart
1.
In order to improve the controller performance, in this task the full state space representa-
tion presented in (2.4) will be used for controller and observer derivation. This means that
now 6 states are available to the LQR controller and the observer has two more inputs:
the current flowing into Cart 1 (I1 ) and this cart’s position (x1 ).

As before, the objective of the controller is to balance the seesaw around the 0 position
moving Cart 2. The aim of the task is to underline that:

   • Giving to the observer the knowledge about Cart 1 quantities results in better re-
     construction of the internal state space;

   • Giving the knowledge of Cart 1 to the LQR controller results in better control per-
     formance.

TASK: LQG full state space
   • Open the folder ’3 4 LQG Full’ ;

   • Open the file ’simulation LQG Full Design.m’. Choose the weights for the LQR
     controller and for the Observer following the LTR procedure.
     Remember that now both LQR and Observer work on the full state vector with 6
     states presented in (2.4);

   • Run the ’simulation LQG Full Design.m’ m-file to obtain simulation results;

   • Once LQR and Observer are considered acceptable, make sure the controller gain
     K lqg and the observer matrices Aobs, Bobs, Cobs and Dobs are present in the
     workspace. If not, run again the ’simulation LQG Full Design.m’ file;

   • Open the Simulink interface file ’LQG Full.mdl’ ;

   • Start-up Procedure: follow the start-up procedure explained in task 3.2 or call the
     assistant if help is needed;

   • Press the red emergency button if the controller does not respond in a good way;

   • If the controller works, try to introduce some disturbances manually changing the
     seesaw angle.
Chapter 3. Lab Experience                                                                  16

   • If the controller is able to stabilize the seesaw angle, try to move Cart 1 away from the
     center position. The Simulink interface always loads the ’C’ controller for moving
     Cart 1.

   • Press the Simulink ’Stop’ button to stop the test and to obtain measurements plots
     on screen;

   • Is the controller now able to stabilize the seesaw even if Cart 1 is moved away from
     the center position?
Chapter 3. Lab Experience                                                               17

3.5     Integral Action - LQGI
From the tests on the real hardware it is possible to notice that, introducing disturbances
on the seesaw angle or moving Cart 1, the controller can stabilize the seesaw angle but
not exactly in the zero position. This means that an integral action is missing both in the
plant and in the controller and therefore it has to be added.

This last task requires the implementation of an integral action on the seesaw angle and
tests the controller performances also when an angle different from 0o is asked.

TASK: LQGI
   • Open the folder ’3 5 LQGI Full’ ;

   • Open the file ’simulation LQGI Full Design.m’. Choose the weights for the LQR
     controller and the Observer following the LTR procedure.
     Bear in mind that now the controller works with 7 states, the 6 from the full state
     space model (2.4) plus the one of the integrator on θ. Also the observer is built on
     the full state space representation (2.4);

   • Run the ’simulation LQGI Design.m’ m-file to obtain simulation results;

   • Once LQR and Observer are considered acceptable, make sure the controller gains,
     K lqg and K i, and the observer matrices Aobs, Bobs, Cobs and Dobs are present in
     the workspace. If not, run again the ’simulation LQG Full Design.m’ file;

   • Open the Simulink interface file ’LQGI Full.mdl’ ;

   • Start-up Procedure: follow the start-up procedure explained in task 3.2 or call the
     assistant if help is needed;

   • Press the red emergency button if the controller does not respond in a good way;

   • If the controller works, try to introduce some disturbances manually changing the
     seesaw angle.
     With the introduction of the integrator, now the control system should be able to
     bring the seesaw always to the 0o angle position.

   • Change the reference angle in the Simulink interface from 0o to ±5o .
     Test if the controller is able to stabilize the seesaw around this new set-point even
     introducing disturbances on its angle (manually).

   • Check if the controller stabilizes the seesaw angle even moving Cart 1 away from the
     0 position.
Chapter 3. Lab Experience                                                              18

QUESTION: SISO Controller (optional)
The given control problem can be described as a Single-Input (the Cart 2 current) Single-
Output (the seesaw angle) system. Why is it not asked to derive a standard SISO controller
but directly a LQR one?

Suggestion: obtain the transfer function between the current and the angle from the state-
space representation (2.4). What do you notice which makes the SISO synthesis complex?
You can also read