arrow-left

All pages
gitbookPowered by GitBook
1 of 3

Loading...

Loading...

Loading...

A & B. Modeling and Control Design (Week 1)

hashtag
Objective

The purpose of this experiment is to design a controller that maintains the direction of a gyroscope under base excitation. The controller can also be used to rotate the gyro platform to a desired orientation using the gyroscopic principle.

hashtag
Introduction

Gyroscopes have become of great practical interest as they are used in control and guidance systems for air, sea, and space vehicles. One of their biggest advantages is that they can generate a large output (orientation change of an entire spacecraft) using a small input (torque input tilting a rotating disk) through torque amplification.

hashtag
Description of Quanser Gyroscope system

The Quanser 3 DOF Gyroscope system (see Figure 1) can be actuated about all of its frames using the mounted motors while encoders measure the angle about each axis. In addition, the rotor itself is actuated and measured in the same manner.

The gyroscope setup is shown in Figure 2, and its components are provided in a table in Figure 3. The outer rectangular gray frame, the outer red gimbal and the inner blue gimbal are designed such that they can be individually fixed in place upon desire. This allows the users to perform a variety of different experiments using the device.

In this experiment, the gyroscopic effect will be employed to control the angle of the gray frame by applying the control command about the blue gimbal. The red outer gimbal will be fixed. In order to do this, the rotor has to have acquired enough angular momentum (RPM) for the gyroscopic effect to take place. Therefore, a controller is required to control the angular speed of the disk while another is required to control the blue gimbal angle.

In the next sections, we will develop a model of the gyroscope device from first principles in order to obtain a transfer function of the plant, which we will later use in a control scheme.

hashtag
A. Modeling

The angular position about the outer gray frame (Body A), i.e., the yaw angle , is controlled by changing the angular position, the roll angle , of the blue gimbal (Body C), with the torque generated by motor 2, (see Figure 4). The red gimbal/y-axis (Body B) is locked in our experiment.

The rotational dynamics of rigid bodies can be modeled using the Newton-Euler equation, which states that the rate of change of angular momentum of a rigid body about its mass center equals the total external moment applied about its mass center. Using the Newton-Euler equation, one can derive the equations for rotational motion of individual gimbals and the outer frame. The resulting equations will be non-linear. They are linearized with the disk spinning at a constant high speed with the gyroscope system at rest, i.e., roll , pitch and yaw equal zero. In our experiment, we will lock the the rotation of the red gimbal, i.e., , for all the time. Further, we will align the disk spin axis along the y-axis (see Figure 4).

The resulting linearized equations of motion when the red gimbal is locked, i.e., , and after neglecting the small amount of bearing friction associated with gimbal and frame rotations can be obtained as

where is the change in disc speed from its steady state value of , is the disc mass moment of inertia about its spin axis, is the mass moment of inertia of the disk and motor 1 plus the blue gimbal and motor 2 about the x-axis (roll axis), is the mass moment of inertia of the entire system, i.e., including the disk, red and blue gimbals, motors 1 and 2 and the outer gray frame about the z-axis.

Equation (1) is for the disc spinning about its own axis. Equation (2) is for the motion about the roll/blue x-axis that is driven by the torque applied from motor 2 and the gyroscopic reaction torque. Equation (3) is for the motion about the yaw/gray frame that is driven exclusively by the gyroscopic reaction torque.

The Quanser 3 DOF Gyroscope is driven by a current-controller amplifier. The relation between the torque outputs of motors 1 and 2 and their respective current inputs are

where is the current-to-torque constant of the motor, is the current applied to motor 1, and is the current applied to motor 2.

The disc is rotated at a fixed, steady-state speed of . Given this and applying Laplace transforms to Equations (1) to (3) we arrive at the following transfer function models:

A state-space model representation of Equations (2-3) with the state vector as can be written as

The gyroscope system parameters are provided in Table 1:

Parameter Name
Parameter Symbol
Value
Unit

hashtag
B. Control Design

The objective is to design a controller for regulation and control of the outer frame (gray frame) angular position using the inner gimbal (blue gimbal) torque . This mimics the following problem: Given a spacecraft with a momentum gyro, we would like to regulate and control the spacecraft yaw angle using the tilting of a high-speed spinning disk mounted in the spacecraft. In this lab, the rotation about the z-axis, , is controlled by torque applied about the x-axis through motor 2.

hashtag
Controller Specifications:

Specification 1: All closed-loop poles must be in the left half of the complex plane.

Specification 2: The peak time in response to a step command must be less than 0.45 seconds.

Specification 3: The 2% settling time to a step command input must be less than 0.50 seconds.

Specification 4: Control current must not saturate (see Table 1 for max current input).

Specification 5: For the outer loop, and .

In order to meet the given controller specifications, we will make use of a technique known as successive loop closures. We will first design an inner loop rate feedback, i.e., feedback of , to damp the rotation of the inner blue gimbal. Subsequently, an outer loop PD controller is used to control the outer frame (gray frame) rotation . The selected control logic is summarized in Figure 5.

The transfer functions and are previously obtained in the modeling section as Equations (7) and (8). In the following section, we will form the overall transfer function and do controller design.

hashtag
Controller Design Procedure:

  1. Open the script gyro_sim_week1.mlx and run the first section to initialize symbolic system parameters.

  2. At the second section of the script, generate the transfer functions and using the given parameters. Note that has a negative sign in the numerator.

  3. Obtain the overall transfer function from to , which will be your plant (see Figure 5) for the outer loop PD controller design. Remember to close the loop for .

circle-info

To check if your Simulink response meets Specification 2 and Specification 3, you can do one of the following approaches:

  • Place markers on the plot to manually check for peak time and 2% settling time.

  • Use stepinfo() command in MATLAB window to obtain the peak time and 2% settling time.

hashtag
Results and Questions for Report

hashtag
Modeling

hashtag
Results

  1. General principle used to obtain equations of motion for the gyroscope.

  2. The three time-domain linearized equations of motion for the experiment.

  3. (both symbolic and numerical forms).

hashtag
Control Design

hashtag
Results

  1. Brief description of control design objective.

  2. The closed-loop transfer function for using rate feedback.

  3. , the transfer function from to (both symbolic and numerical forms).

hashtag
Questions

  1. How is the default Control System Designer control architecture different from the one used in this experiment? In your explanation, mention how the locations of the PD controller gains in Figure 5 are different from a traditional PD controller.

  2. Briefly explain the need for the inner loop rate () feedback.

Lab 2: 3 DOF Gyroscope

MOI about x-axis/blue gimbal (disc rotor + blue gimbal)

0.00388552

kgm^2

MOI about y-axis/red gimbal (disc rotor + blue gimbal + red gimbal)

0.02344554

kgm^2

MOI about z-axis/gray gimbal, i.e., disc and blue, red, gray frames

0.06632120

kgm^2

Gimbal motor current-torque constant

0.115

Nm/A

Disc motor current-torque constant

0.0704

Nm/A

Max current

3

A

Max torque

0.3450

Nm

Disk rotor steady-state speed

78.5398

rad/s

Select a nominal value for the inner loop rate feedback gain kvk_vkv​, for example kv=0.2k_v=0.2kv​=0.2

  • Based on the symbolic G function from step 3, generate a numeric transfer function G(s)G(s)G(s) from rir_iri​ to ψ\psiψ that you will use for the controlSystemDesigner window. This function should not contain any symbols. Note: Check your G(s)G(s)G(s) with your TA before proceeding.

  • Initialize C = 1, then open controlSystemDesigner(G,C) in MATLAB.

  • The control architecture shown in Figure 5 is different from the default architecture that opens in controlSystemDesigner. To account for this change, on the Control System Designer window, select CONTROL SYSTEM > Edit Architecture, and select the following architecture:

    Figure 6. Gyroscope outer control loop architecture – Control System Designer
  • Select some arbitrary negative values (within the limits of Specification 5) for both kpk_pkp​ (C1 in Figure 6) and kdk_dkd​ (C2 in Figure 6). Since C2 is a pure derivative gain, you need to add a differentiator in C2, not a real zero.

  • Tune the values for kpk_pkp​ and kdk_dkd​ as needed to meet the given set of specifications. If needed, readjust the kvk_vkv​ value of the inner loop, which is positive.

  • Save the controlSystemDesigner window plots, and your final gains kp, kd, kv.k_p, \, k_d, \, k_v.kp​,kd​,kv​. Note: Check your final gains with your TA before proceeding.

  • Use Figure 5 as a guide to create the SImulink diagram for this experiment. Adjust the step size to be a fixed-step size of 0.002 under model settings.

  • To the model created in step 11, add the following:

    • A scope for the commanded input to the system.

    • A saturation block before P1(s)P_1(s)P1​(s) to limit the torque τ2\tau_2τ2​ applied to the system. Note: Since we need to satisfy Specification 4 (current saturation), we should ensure torque saturation as torque and current are linearly related (see Equation (5)).

    • A scope to the torque applied to the system, (after the saturation block).

    • A scope between and that measures the gyro angle, .

    • A scope at the final output, . Note: Check your final Simulink diagram with your TA before proceeding.

  • Run the Simulink diagram for a reference angle of ψref=10o\psi_{ref}=10^oψref​=10o. This can be accomplished in one of two ways:

    1. Provide a step input of an initial value of 0 and a final value of 10. This will generate a step input of ψref=10o\psi_{ref}=10^oψref​=10o.

    2. Provide a square wave of amplitude 5, frequency of 0.333 Hz and an offset of +5. This will generate a square wave of an upper value ψref=10o\psi_{ref}=10^oψref​=10o and a lower value of 0.

  • Verify if the Simulink diagram output is similar to the controlSystemDesigner step-input plot.

  • Check if the Simulink response satisfies all the given specifications (not on controlSystemDesigner). If not, further tune your kpk_pkp​ and kdk_dkd​ values (and kvk_vkv​ if required) till all requirements are met. Note: Check your final gains with your TA before proceeding.

  • P2(s)P_2(s)P2​(s) (both symbolic and numerical forms).
    Gain values kp, kd, kvk_p, \, k_d, \, k_vkp​,kd​,kv​ from controlSystemDesigner (Step 10).
  • Control System Designer plots (root locus and bode plots for C1 and C2 and step response plot with peak time, settling time and steady-state values indicated).

  • Simulink model (Step 12).

  • Simulink response plots (to be generated using MATLAB, not Scope).

  • Validation of control design specifications being met or not.

  • Final tuned gain values kp, kd, kvk_p, \, k_d, \, k_vkp​,kd​,kv​ from Simulink (Step 15).

  • ψ\psiψ
    ϕ\phiϕ
    τ2\tau_2τ2​
    (Ω)(\Omega)(Ω)
    (ϕ)(\phi)(ϕ)
    (θ)(\theta)(θ)
    (ψ)(\psi)(ψ)
    θ=0\theta=0θ=0
    θ=0\theta=0θ=0
    Jdω˙=τ1(1)J_d\dot{\omega}=\tau_1 \qquad \qquad \tag{1}Jd​ω˙=τ1​(1)
    Jxϕ¨=τ2+JdΩψ˙(2)J_x\ddot{\phi}=\tau_2+J_d\Omega\dot{\psi}\qquad \qquad \tag{2}Jx​ϕ¨​=τ2​+Jd​Ωψ˙​(2)
    Jzψ¨=−JdΩϕ˙(3)J_z \ddot{\psi}=-J_d\Omega\dot{\phi}\qquad \qquad \tag{3}Jz​ψ¨​=−Jd​Ωϕ˙​(3)
    ω\omegaω
    Ω\OmegaΩ
    JdJ_dJd​
    JxJ_xJx​
    JzJ_zJz​
    τ1=ktu1(4)\tau_1=k_tu_1\qquad \qquad \tag{4}τ1​=kt​u1​(4)
    τ2=ktu2(5)\tau_2=k_tu_2\qquad \qquad \tag{5}τ2​=kt​u2​(5)
    ktk_tkt​
    u1u_1u1​
    u2u_2u2​
    Ω\OmegaΩ
    ω(s)τ1(s)=1Jds(6)\frac{\omega(s)}{\tau_1 (s)}=\frac{1}{J_d s }\qquad \qquad \tag{6}τ1​(s)ω(s)​=Jd​s1​(6)
    Φ(s)τ2(s)=JzJxJzs2+Jd2Ω2=P1(s)(7)\frac{Φ(s)}{τ_2 (s)}=\frac{J_z}{J_x J_z s^2+J_d^2 Ω^2}=P_1 (s)\qquad \qquad \tag{7}τ2​(s)Φ(s)​=Jx​Jz​s2+Jd2​Ω2Jz​​=P1​(s)(7)
    Ψ(s)Φ(s)=−ΩJdJzs=P2(s)(8)\frac{Ψ(s)}{Φ(s)}=\frac{-ΩJ_d}{J_z s}=P_2 (s)\qquad \qquad \tag{8}Φ(s)Ψ(s)​=Jz​s−ΩJd​​=P2​(s)(8)
    [ϕψϕ˙ψ˙]T[\phi \quad \psi \quad \dot{\phi} \quad \dot{\psi}]^T[ϕψϕ˙​ψ˙​]T
    ddt[ϕψϕ˙ψ˙]=[00100001000JdΩ/Jx00−JdΩ/Jz0][ϕψϕ˙ψ˙]+[001/Jx0](9)\frac{d}{dt} \begin{bmatrix} \phi \\ \psi \\ \dot{\phi} \\ \dot{\psi} \\ \end{bmatrix} = \begin{bmatrix} 0& 0& 1& 0 \\ 0& 0& 0& 1 \\ 0& 0& 0& J_d\Omega/J_x \\ 0& 0& -J_d\Omega/J_z& 0 \end{bmatrix}\begin{bmatrix} \phi \\ \psi \\ \dot{\phi} \\ \dot{\psi} \\ \end{bmatrix} + \begin{bmatrix} 0 \\ 0 \\ 1/J_x \\ 0 \\ \end{bmatrix}\qquad \qquad \tag{9}dtd​​ϕψϕ˙​ψ˙​​​=​0000​0000​100−Jd​Ω/Jz​​01Jd​Ω/Jx​0​​​ϕψϕ˙​ψ˙​​​+​001/Jx​0​​(9)

    Rotor mass

    mdm_dmd​

    1.907

    kg

    Rotor radius

    rdr_drd​

    0.0762

    m

    MOI of disk about spin axis

    JdJ_dJd​

    0.0055

    ψ\psiψ
    τ2\tau_2τ2​
    ψ\psiψ
    ψ\psiψ
    10°10\degree10°
    10°10\degree10°
    ∣kp∣<6|k_p|<6∣kp​∣<6
    ∣kd∣<0.4|k_d|<0.4∣kd​∣<0.4
    ϕ˙\dot{\phi}ϕ˙​
    ψ\psiψ
    P1(s)P_1(s)P1​(s)
    P2(s)P_2(s)P2​(s)
    P1(s)P_1(s)P1​(s)
    P2(s)P_2(s)P2​(s)
    P2(s)P_2(s)P2​(s)
    rir_iri​
    ψ\psiψ
    G(s)G(s)G(s)
    P1(s)P_1(s)P1​(s)
    P1(s)P_1(s)P1​(s)
    P1(s)P_1(s)P1​(s)
    G(s)G(s)G(s)
    rir_iri​
    ψ\psiψ
    ϕ˙\dot{\phi}ϕ˙​
    file-download
    4KB
    gyro_sim_week1.mlx
    arrow-up-right-from-squareOpen
    Figure 1. Quanser 3-DOF Gyroscope
    Figure 2. Gyroscope components figure
    Figure 3. Gyroscope components table
    Figure 4. Components of Quanser 3 DOF gyroscope
    Figure 5. Gyroscope plant and control architecture
    Figure 7. Simulation plots for ψref=10o\psi_{ref}=10^oψref​=10o square wave

    kg

    C. Controller Implementation (Week 2)

    hashtag
    Objective

    In this section, the gyroscopic control developed in Part B is implemented on the actual hardware. The goal is to see if the gyro module can maintain its heading (ψ)(\psi)(ψ) when a disturbance is added by the user, i.e., the base plate is rotated.

    The controller will also enable the gyroscope to track a small step, large step and ramp-input commands.

    The q_3dgyro_reaction_torque_m2021.slx diagram shown in Figure 8 is used to implement the controller on the Quanser Gyroscope system. The 3 DOF Gyroscope system shown in Figure 9 contains the Quanser blocks that interface with their hardware.

    hashtag
    Part 1: Heading-hold experiment

    1. Orient the gyroscope discs as shown:

    2. Make sure the pitch axis/red gimbal is locked.

    3. Make sure the gray frame and blue gimbal ( and respectively) are unlocked.

    Note: Show your setup to your TA before proceeding. This will be the default orientation for all subsequent experiments.

    4. Turn on the amplifier (big box) and verify the DAQ (small box) is connected to a power source. In previous experiments the smaller DAQ boards could be powered by the computer USB connection, but this is no longer the case.

    5. Run gyro_sim_data.mlx script in MATLAB 2021 (not 2019) to initialize values.

    6. Open q_3dgyro_reaction_torque.m2021.slx in MATLAB 2021 as well.

    7. Set the and values to those found in Week 1 Part B.

    8. Set the Psi_Ref to 0. This will make the controller hold the 0-degree heading.

    9. Set Hardware > Stop Time to 20 seconds.

    10. Open all three scopes (Disc Rate, phi, psi) in a separate window.

    11. When ready with the provided ruler, press Monitor & Tune (no need to build).

    12. Watch the Disc Rate scope. When the angular velocity of the wheel reaches its maximum of ~78 rad/s, push the gray axis using the ruler at different angles/locations. Observe the behavior of the setup and notice the resistance to your disturbance by the gray axis, even though it is stationary.

    IMPORTANT: After the experiment stops, use the provided towel to slowly stop the disc from spinning. Be careful since touching the disc while it is rotating may cause injury.

    13. Check the saved data for disk rate, phi and psi, labelled as omega, phi, psi respectively. These are automatically saved as .mat files in your working directory. Rename them with "part1_" as the prefix, followed by the variable name. The data is saved as follows:

    • The variable omega has the rows saving time, commanded speed, and actual speed respectively.

    • The variable phi saves time, phi response, and phi gimbal current respectively.

    • The variable psi saves time, reference psi angle, and psi response respectively.

    hashtag
    Part 2: Small step response

    1. Make sure the disc is fully stopped from the previous experiment.

    2. Orient the gyroscope as shown in Figure 10.

    3. Set simulation Stop Time to 20 seconds.

    4. Set Psi_Ref to 0, apply the change, but keep the window open.

    5. Open all three scopes in a separate monitor.

    6. Click Monitor & Tune, and watch the Disc Rate scope.

    7. When disc rate reaches its maximum, change Psi_Ref (deg) gain to 10 degrees.

    8. Observe the gyroscope tracking the desired heading command.

    IMPORTANT: After the experiment stops, use the provided towel to slowly stop the disc from spinning. Be careful since touching the disc while it is rotating may cause injury.

    9. Refer to Part 1 Step 13 for the saved data format. Rename them with "part2_" as prefix, followed by the variable names as shown in Part 1 step 13.

    hashtag
    Part 3: Large step response

    1. Make sure the disc is fully stopped from the previous experiment.

    2. Orient the gyroscope as shown in Figure 10.

    3. Set simulation Stop Time to 20 seconds.

    4. Set Psi_Ref (deg) gain to 0, apply the change, but keep the window open.

    5. Open all three scopes in a separate monitor.

    6. Click Monitor & Tune, and watch the Disc Rate scope.

    7. When disc rate reaches its maximum, change Psi_Ref (deg) gain to 40 degrees.

    8. Observe the gyroscope tracking the desired heading command.

    IMPORTANT: After the experiment stops, use the provided towel to slowly stop the disc from spinning. Be careful since touching the disc while it is rotating may cause injury.

    9. Refer to Part 1 Step 13 for the saved data format. Rename them with "part3_" as the prefix, followed by the variable names shown in Part 1 step 13.

    hashtag
    Part 4: Ramp input response

    circle-info

    While the step response is useful for system characterization, it is seldom used for an actual in-service trajectory because it is excessively harsh (high acceleration and jerk, which is the rate of change of acceleration). A more common trajectory used for tracking applications is a ramp.

    1. Make sure the disc is fully stopped from the previous experiment.

    2. Orient the gyroscope as shown in Figure 10.

    3. Set simulation Stop Time to 20 seconds.

    4. Open the Signal Generator block, and select the “sawtooth” waveform

    5. Set Psi_Ref (deg) gain to 0, apply the change, but keep the window open.

    6. Open all three scopes in a separate monitor.

    7. Click Monitor & Tune, and watch the Disc Rate scope.

    8. When disc rate reaches its maximum, change Psi_Ref (deg) gain to 20 degrees.

    9. Observe the gyroscope tracking the desired heading command.

    IMPORTANT: After the experiment stops, use the provided towel to slowly stop the disc from spinning. Be careful since touching the disc while it is rotating may cause injury.

    10. Refer to Part 1 Step 13 for the saved data format. Rename them with "part4_" as the prefix, followed by the variable names shown in Part 1 step 13.

    hashtag
    Results for Report

    Note: Some results require simulation response. This would require running a simulation using your SIMULINK model from Part B Control Design using the same , and gain values evaluated in Part C Controller Implementation. The command input will be identical to either the square wave signal or triangle signal implemented during the experiment. The simulation command input should be identical to experimental input.

    1. Briefly describe the controller implementation experiments.

    hashtag
    Part 1: Heading hold

    1. Plot commanded and response plots on the same axes.

    2. Plot response.

    3. Plot motor 2 current ( gimbal control current).

    hashtag
    Part 2: Small step input

    1. Plot commanded, simulated, and experimental plots on the same axes.

    2. Plot simulated and experimental responses on the same axes.

    3. Plot motor 2 current simulated and experimental responses on the same axes.

    hashtag
    Part 3: Large step input

    1. Plot commanded and response plots on the same axes.

    2. Plot response.

    3. Plot motor 2 current.

    hashtag
    Part 4: Ramp input

    1. Plot commanded and response plots on the same axes.

    2. Plot response.

    3. Plot motor 2 current.

    hashtag
    Questions for Report

    1. There is some drift in the response overtime in all experiments. Despite this, the control is still able to maintain the desired yaw position. Explain using conservation of angular momentum and control theory why this is the case.

    2. Which axis of the setup is fixed to the spacecraft?

    3. Using the gyroscopic principle, what changes would you make to the gyroscope system for measuring yaw rate of the spacecraft?

    τ2\tau_2τ2​
    P1(s)P_1(s)P1​(s)
    P2(s)P_2(s)P2​(s)
    ϕ\phiϕ
    ψ\psiψ
    JxJ_xJx​
    JyJ_yJy​
    JzJ_zJz​
    ktk_tkt​
    kt,diskk_{t,disk}kt,disk​
    ImaxI_{max}Imax​
    τmax\tau_{max}τmax​
    Ω,  ωss\Omega, \,\, \omega_{ss}Ω,ωss​
    Explain the behavior of the gray axis as you disturb it.
    Explain any differences between simulated and experimental responses.
    ψ\psiψ
    ϕ\phiϕ
    kp,  kd  k_p, \,\, k_d \,\,kp​,kd​
    kvk_vkv​
    kpk_pkp​
    kdk_dkd​
    kvk_vkv​
    ψ\psiψ
    ψ\psiψ
    ϕ\phiϕ
    ϕ\phiϕ
    ψ\psiψ
    ψ\psiψ
    ψ\psiψ
    ϕ\phiϕ
    ϕ\phiϕ
    ψ\psiψ
    ψ\psiψ
    ϕ\phiϕ
    ψ\psiψ
    ψ\psiψ
    ϕ\phiϕ
    ϕ\phiϕ
    file-download
    3KB
    gyro_sim_data.mlx
    arrow-up-right-from-squareOpen
    file-download
    59KB
    q_3dgyro_reaction_torque_m2021.slx
    arrow-up-right-from-squareOpen
    Figure 8. q_3dgyro_reaction_torque_m2021 Simulink diagram
    Figure 9. 3 DOF Gyroscope Simulink subsystem
    Figure 10. Gyroscope orientation for heading-hold, facing side opposite wires