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 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.
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.
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.
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.
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.
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.
Briefly describe the controller implementation experiments.
Plot commanded and response plots on the same axes.
Plot response.
Plot motor 2 current ( gimbal control current).
Explain the behavior of the gray axis as you disturb it.
Plot commanded, simulated, and experimental plots on the same axes.
Plot simulated and experimental responses on the same axes.
Plot motor 2 current simulated and experimental responses on the same axes.
Explain any differences between simulated and experimental responses.
Plot commanded and response plots on the same axes.
Plot response.
Plot motor 2 current.
Plot commanded and response plots on the same axes.
Plot response.
Plot motor 2 current.
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.
Which axis of the setup is fixed to the spacecraft?
Using the gyroscopic principle, what changes would you make to the gyroscope system for measuring yaw rate of the spacecraft?
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.
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.
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.
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:
Rotor mass
1.907
kg
Rotor radius
0.0762
m
MOI of disk about spin axis
0.0055
kg
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
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.
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.
Open the script gyro_sim_week1.mlx and run the first section to initialize symbolic system parameters.
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.
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 .
Select a nominal value for the inner loop rate feedback gain , for example
Based on the symbolic G function from step 3, generate a numeric transfer function from to that you will use for the controlSystemDesigner window. This function should not contain any symbols. Note: Check your 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:
Select some arbitrary negative values (within the limits of Specification 5) for both (C1 in Figure 6) and (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 and as needed to meet the given set of specifications. If needed, readjust the value of the inner loop, which is positive.
Save the controlSystemDesigner window plots, and your final gains 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 10, add the following:
A scope for the commanded input to the system.
A saturation block before to limit the torque 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 . This can be accomplished in one of two ways:
Provide a step input of an initial value of 0 and a final value of 10. This will generate a step input of .
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 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 and values (and if required) till all requirements are met. Note: Check your final gains with your TA before proceeding.
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.
General principle used to obtain equations of motion for the gyroscope.
The three time-domain linearized equations of motion for the experiment.
(both symbolic and numerical forms).
(both symbolic and numerical forms).
Brief description of control design objective.
The closed-loop transfer function for using rate feedback.
, the transfer function from to (both symbolic and numerical forms).
Gain values from controlSystemDesigner (Step 10).
Control System Designer plots (root locus 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 from Simulink (Step 15).
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.
Briefly explain the need for the inner loop rate () feedback.