B. Control Design & Implementation (Week 2)

Controller Design

Background

Linear State-Space Representation

Given the linear state-space equations: x˙=Ax+Bu\dot{x}=Ax+Bu and y=Cx+Duy=Cx+Du, we define the state for the Quanser Aero Experiment as

the output vector as

and the control variables as

where θ\thetaand ψ\psiare the pitch and yaw angles, respectively, and VθV_\thetaand VψV_\psi are the motor voltages applied to the pitch and yaw rotors (i.e. the main and tail rotors). Using the equations of motion in Equations (1) and (2), the state-space matrices are

In this section, a state-feedback controller is designed to regulate the pitch and yaw angles of the Quanser Aero Experiment to desired angles. Using the previous state-space model, we can find a control gain KK based on the coupled dynamics to stabilize the system. The control gains are computed using Linear-Quadratic Regulator (LQR) theory. The general state-feedback control is illustrated in Figure 11. The state-feedback controller is defined

Fig. 11: Model used to acquire free-oscillation response about pitch

where xx is the state defined in Equation (38)

is the reference command (or setpoint) state with the desired pitch and yaw angles, θd\theta_d and ψd\psi_d , and

is the control input where VθV_\theta is the front/pitch motor voltage and VψV_\psi is the tail/yaw motor voltage.

Linear Quadratic Regulator (LQR) optimization can be used for finding the control gain parameters of the Quanser Aero Experiment flight control. Given the state-space representation, the LQR algorithm computes a control law uu to minimize the performance criterion or cost function:

The design matrices QQ and RR hold the penalties on the deviations of state variables from their setpoint and the control actions, respectively. When an element of QQ is increased, therefore, the cost function increases the penalty associated with any deviations from the desired setpoint of that state variable, and thus the specific control gain will be larger. When the values of the RR matrix are increased, a larger penalty is applied to the aggressiveness of the control action, and the control gains are uniformly decreased.

Since there are four states , QR4×4Q\in \mathbb{R}^{4\times 4}, and two control variables, RR2×2R\in\mathbb{R}^{2\times 2} . The setpoint, xdx_d (Equation 43) is given above the control strategy used to minimize cost function J is thus given by

Designing an LQR Controller

Various control software already has LQR optimization routines that can be used to generate the state feedback control gain KK. In order for the closed-loop response to satisfy certain time-domain specifications, the closed-loop system is typically simulated using its dynamic model, in software, first. This is an iterative process. By adjusting the weighting matrices QQ and RR and then running the simulation, we can find a control that satisfies the user's requirements. Further, we must ensure that the control signal uu is smooth (i.e. does not chatter) and does not surpass the limits of the actuator.

LQR Control Design and Simulation

LQR is used to find the state-feedback control gain KK (KK is 2×42\times 4 matrix) that will stabilize the Quanser Aero Experiment to the user's desired pitch and yaw angles. Our desired closed-loop response should match the following specifications. Use MATLAB command K = lqr(A,B,Q,R) to obtain gain, KK, matrix.

Desired closed-loop response specifications for pitch

  1. Steady-state error: pitch esse_{\rm ss} ≤ 2 deg\deg, yaw esse_{\rm ss} ≤ 2 deg\deg.

  2. Peak time: tpt_{\rm p} ≤ 2 s.

  3. Percent Overshoot: PO\rm PO ≤ 7.5%.

  4. No actuator saturation: Vψ|V_\psi| ≤ 24V and Vθ|V_\theta| ≤ 24V .

The state-space matrices derived in Equation (41) are entered in the State-Space block in SIMULINK and the control gain is set to the MATLAB variable K.

Running the closed-loop state-feedback LQR simulation

  1. Using parameters from Part A, obtain state-space matrices of the system neglecting coupling effect.

  2. Design Q,RQ,R , and KK. To start with try with following QQ, RR and KK. Q = diag([200 75 0 0 ]); R = 0.01*eye(2,2); K = lqr(A,B,Q,R)

  3. Build the SIMULINK model of the system

  4. Simulate the closed-loop response of the system with pitch-only command: θd=10 deg\theta_d=10\space \deg. (Make sure to change deg to rad in SIMULINK)

  5. Simulate the closed-loop response of the system with yaw only command: ψd=45 deg\psi_d=45 \space \deg. (Make sure to change deg to rad in SIMULINK)

  6. Simulate the closed-loop response of the system with pitch and yaw command: θd=10 deg\theta_d= 10\space \deg and ψd=45 deg\psi_d = 45 \space \rm deg. (Make sure to change deg to rad in SIMULINK)

  7. Check whether your controller meets the desired specifications.

  8. If it fails to meet the specifications, tune QQ and/or RR to meet the specifications

  9. Save the data and plot the closed-loop system response for pitch and yaw

  10. Now, use system matrices with coupling effect and use the controller without coupling

  11. Repeat steps 4-6

  12. The closed-loop response in this step does not have to meet the desired specifications

  13. Now, design Q,RQ,R , and KK with the coupling effect

  14. Build the SIMULINK model of the system

  15. Repeat steps 4-6

  16. Check whether your controller meets the desired specifications.

  17. If it fails to meet the specifications, tune QQ and/or RR to meet the specifications

  18. Save the data and plot the closed-loop system response for pitch and yaw

Things to check

Analysis

  1. What happened when you neglect the coupling effect?

  2. Is there any systematic way to design QQ and RR ?

Controller Implementation

In this section, the state-feedback control is implemented on the Quanser Aero Experiment using the q_aero_2dof_lqr_control SIMULINK diagram shown in Figure 12 with QUARC.

Download the file into the quanser_aero folder that was used for Week 1.

Fig. 12: SIMULINK model used to run LQR controller

Desired Closed-Loop Response Specifications

  1. Steady-state error: pitch esse_{\rm ss} ≤ 2 deg\deg, yaw esse_{\rm ss} ≤ 2 deg\deg.

  2. Peak time: tpt_{\rm p} ≤ 2 s.

  3. Percent Overshoot: POPO ≤ 7.5%.

  4. No actuator saturation: Vψ|V_\psi| ≤ 24V and Vθ|V_\theta| ≤ 24V .

Running the closed-loop state-feedback LQR simulation

Neglecting Coupling Effect

Pitch Command Only

  1. Unlock both pitch and yaw axes to enable the full 2 DOF motion.

  2. Open q_aero_2dof_lqr_control SIMULINK file.

  3. Use the gain KK obtained in Part B. neglecting the coupling effect.

  4. Use pitch command (10 deg) only by changing Amp_y to zero.

  5. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  6. Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

  7. Copy aerolqrrsp.mat to your own folder and rename it as nocouple_pitch_only.

  8. Examine the obtained closed-loop response and see if it matches the desired specifications.

Yaw Command Only

  1. Use a yaw command (45 deg) only by changing Amp_p to zero.

  2. Run SIMULINK

  3. Copy aero_lqr_rsp.mat to your own folder and rename it as nocouple_yaw_only.

  4. Examine the obtained closed-loop response and see if it matches the desired specifications

Both Yaw and Pitch

  1. Use both pitch and yaw command

  2. Run SIMULINK

  3. Copy aerolqrrsp.mat to your own folder and rename it as nocouple_pitch_yaw.

  4. Examine the obtained closed-loop response and see if it matches the desired specifications

With Coupling Effect

  1. Use the gain KKobtained in Part B. with the coupling effect.

  2. Repeat above Pitch Only, Yaw Only and both Yaw and Pitch runs and rename the files as couple_####_###.

  3. Close the Simulink. DO NOT SAVE THE CHANGE!

Analysis Question

  1. Did your controller successfully meet the specs? If not, why?

  2. How does the coupling affect the performance of the controller?

  3. How can we improve the controller?

Last updated

Was this helpful?