> For the complete documentation index, see [llms.txt](https://gtae.gitbook.io/ae4610/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gtae.gitbook.io/ae4610/archive/rotary-gyro/rotary-gyro.md).

# Rotary Gyro

## Introduction

The objective of this experiment is to design a controller that maintains the direction of the gyroscope module while the top base plate is rotated relative to the bottom base plate. While the disk spins, the SRV02 is used to apply the correct amount of counter torque and maintain the gyroscope heading in the event of disturbances (i.e., rotation of the bottom support plate).

<figure><img src="/files/L6yXAsR6QKo8uQasGXY3" alt=""><figcaption><p>Figure 0.1: Rotary Gyro Experiment</p></figcaption></figure>

Gyroscopes are used in many different platforms, e.g., airplanes, large marine ships, submarines, and satellites.

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. To do so, however, we need some preliminaries on angular momentum and the gyroscopic effect.

## Part 0: Preliminaries

### Angular Momentum

Let's consider an rigid body $$B$$ of mass $$m$$, moving with any general motion in space. Assume that the axes x-y-z are attached to the body with origin at its center of mass $$G$$. Now, let $$\mathrm{d}m$$ be a mass element of the body situated by position vector $$\bm{\rho}$$ with respect to the center of mass $$G$$.&#x20;

<figure><img src="/files/9HvVDkhMNvuJ7Mi57kBf" alt=""><figcaption><p>Figure 0.2: Angular Momentum</p></figcaption></figure>

Given the body's linear velocity $$\bm{v}$$ (i.e., the velocity of its center of mass) and its angular velocity $$\bm{\omega}$$, the total angular momentum of the body with respect to the center of mass $$G$$ is given as

$$
\bm{L} = \bm{v}\times \int\_B \bm{\rho}\mathrm{d}m + \int\_{B} \bm{\rho} \times \left(\bm{\omega}\times\bm{\rho}\right)\mathrm{d}m.
$$

The first term is $$\bm{0}$$ since the integral $$\int\_B \bm{\rho}, \mathrm{d}m = \bm{0}$$ by definition of the center of mass. By using the triple product rule for the cross product in the second term, it can be shown that&#x20;

$$
\bm{L} = \int\_{B} \bm{\rho} \times \left(\bm{\omega}\times\bm{\rho}\right)\mathrm{d}m =  \int\_{B} (\bm{\rho}^\top \bm{\rho} \mathrm{I}\_3 -\bm{\rho}\bm{\rho}^\top) \mathrm{d}m , \bm{\omega} = \bm{J}\bm{\omega}
$$

where $$J$$ is the $$3\times3$$ inertia tensor of the body about the center of mass $$G$$.

### Time Rate of Change of Angular Momentum

Now, since the body's reference frame is rotating, the derivative of the total angular momentum about the center of mass $$G$$ can be written as

$$
\frac{\mathrm{d}}{\mathrm{d}t} \left(\bm{L}\right) = \dot{\bm{L}} + \bm{\omega} \times \bm{L}
$$

where $$\dot{\bm{L}}$$ is the time derivative of the angular momentum as seen in the rotating x-y-z frame. We can view the term $$\dot{\bm{L}}$$ as the part due to the change in magnitude of $$\bm{L}$$ and the second term $$\bm{\omega}\times\bm{L}$$as the part due to the change in direction of $$\bm{L}$$. By virtue of the Newton-Euler equation, we have&#x20;

$$
\bm{\tau} = \frac{\mathrm{d}}{\mathrm{d}t}\left(\bm{L}\right) = \dot{\bm{L}} + \bm{\omega} \times \bm{L}
$$

and we notice that either a change in magnitude of the angular moment or a change in direction of the angular momentum generates a torque. Inversely, a torque can generate a change in either magnitude or direction of the angular momentum, depending about which axis it is applied.

### Gimbaling Gyroscope

Assume now that the total angular momentum of the gimbaling gyroscope is given by&#x20;

$$
\bm{L} = (\bm{J}\_g + \bm{J}\_f) \bm{\omega}\_g + \bm{J}\_f \bm{\omega}\_f
$$

where $$\bm{\omega}\_g$$ is the angular velocity of the gyro module and $$\bm{\omega}\_f$$​ is the angular velocity of the flywheel, $$\bm{J}\_g$$ is the inertia tensor of the gyro module - without the flywheel - and $$\bm{J}\_f$$​ is the inertia tensor of the flywheel.&#x20;

<figure><img src="/files/bYuI9b7Nrop0xkpeDWAe" alt=""><figcaption><p>Figure 0.3: Coordinate Frame and Angle Definitions</p></figcaption></figure>

Assuming that the deflection of the flywheel gimbal axis is small and slow, we now have that, when expressed in the rotating frame of the flywheel gimbal coordinates,

$$
\bm{\omega}\_g = \begin{bmatrix}0\ 0 \ \omega\_b + \dot{\theta}\_l\end{bmatrix}
$$

and

$$
\bm{\omega}\_f = \begin{bmatrix}\omega\_f \ 0 \ 0\end{bmatrix}.
$$

Further assuming that the rotary base motor has achieved steady-state ($$\dot{\theta}\_l = 0$$, $$\ddot{\theta}\_l = 0$$), and that the flywheel's velocity is constant (i.e. $$\dot{\omega}\_f =  0$$), we have that

$$
\bm{\tau} = (\bm{J}\_g + \bm{J}\_f)\dot{\bm{\omega}}\_g + \bm{\omega}\_g\times (\bm{J}\_g + \bm{J}\_f)\bm{\omega}\_g + \bm{\omega}\_g \times \bm{J}\_f \bm{\omega\_f}
$$

Assuming that the gimbal frame is aligned with the principal axes of he gyro module assembly and ignoring the contribution of the wheel inertia to the principal moment of inertia about the vertical axis of the gyro module, then the second term is 0, and we are left with the equations

$$
\tau\_2 = \omega\_bJ\_f\omega\_f
$$

$$
\tau\_3 = J\_g \dot{\omega}\_b
$$

$$\tau\_2$$ corresponds to the torque due to the gyroscopic effect and will be hereon denoted as $$\tau\_g$$​. We will further neglect the second equation pertaining to the vertical axis torque by assuming that $$\dot{\omega}\_b\approx 0$$ is typically small.

## Part 1: Modeling

### 1.1 Servo Model

The Servo Base Unit (SRV02) open-loop transfer function is given by&#x20;

$$
P(s) = \frac{\Theta\_l(s)}{V\_m(s)}=\frac{K}{s(\tau s + 1)}\qquad\qquad \tag{1.1}
$$

where $$\Theta\_l(s) = \mathcal{L}\[\theta\_l(t)]$$ is the load gear position and​$$V\_m(s) = \mathcal{L}\[v\_m(t)]$$ is the applied motor voltage. The system steady-state gain and time constant are given by:

$$
K=1.53, \mathrm{rad/s/V}
$$

​and&#x20;

$$
\tau = 0.0486 , \mathrm{s}.
$$

### 1.2 Gyroscope Gain

Consider the simplified model shown in Figure 1.1.&#x20;

<figure><img src="/files/5lEuS41ZZyfkcD4m0kQu" alt=""><figcaption><p>Figure 1.1: Simplified rotary gyroscope model.</p></figcaption></figure>

The inertial disc, flywheel, spins at a relatively constant velocity, $$\omega\_f$$. When the base rotates at a speed of $$\omega\_b$$, the resulting gyroscopic torque about the sensitive axis is​

$$
\tau\_g=\omega\_b L\_f\qquad \qquad \tag{1.2}
$$

where $$L\_f=J\_f\omega\_f$$​​is the angular momentum of the flywheel and $$J\_f$$​ is its moment of inertia. The springs mounted on the gyroscope counteract the gyroscopic torque, $$\tau\_g$$​, by the following amount

$$
\tau\_s = K\_r \alpha \qquad \qquad \tag{1.3}
$$

​where $$K\_r$$​is the rotational stiffness of the springs.

Given that the spring torque equals the gyroscopic torque, $$\tau\_s = \tau\_g$$​, we can equate equations (1.2) and (1.3) to obtain the expression

$$
K\_r \alpha = \omega\_b J\_f \omega\_f. \qquad \qquad \tag{1.4}
$$

Assume that the base speed is proportional to the deflection angle through the gain $$G\_g$$​, then

$$
\omega\_b = G\_g \alpha. \qquad \qquad \tag{1.5}
$$

By examining equations (1.4) and (1.5), we find the gyroscopic sensitivity gain is given by

$$
G\_g = \frac{\omega\_b}{\alpha} = \frac{K\_r}{J\_f \omega\_f}. \qquad \qquad \tag{1.6}
$$

Thus, the deflection angle $$\alpha$$ can be used to measure $$\omega\_b$$, the rotation rate of the platform relative to the base, without a direct measurement.​ NOTE: the dynamics in the sensitive axis (i.e., deflection axis) are ignored. A more complete model would include these dynamics as the transfer function $$\alpha (s) / \omega\_b (s)$$​.

### 1.3 Joint Stiffness&#x20;

The two springs affecting the sensitive axis are shown in Figure 1.2. The stiffness at the axis of rotation is derived in the following fashion. Assume the springs have a spring constant $$K\_s$$​and an un-stretched length $$L\_u$$​. The length of the springs at the normal position, i.e. $$\alpha = 0$$​, is given by $$L$$​. If the axis is rotated by an angle $$\alpha$$​, then the two forces about the sensitive axis are given by (for a small $$\alpha$$​)&#x20;

$$
F\_1 = K\_s \Delta L\_1 = K\_s (L-L\_u - \alpha R)
$$

​and

$$
F\_2 = K\_s \Delta L\_2 = K\_s (L-L\_u + \alpha R)
$$

<figure><img src="/files/yDqkQeWpcwZaHf1m6AU3" alt=""><figcaption><p>Figure 1.2: Forces due to springs.</p></figcaption></figure>

The spring torque about the pivot due to the two forces is

$$
\tau\_s = R(F\_2 - F\_1) = 2 R^2 K\_s \alpha
$$

​The rotational stiffness is given by

$$
K\_r = \frac{\tau\_s}{\alpha} = 2 R^2 K\_s. \qquad \qquad \tag{1.7}
$$

## Part 2: Control design

### 2.1 Desired Position Control

The block diagram shown in Figure 2.1 is a general unity feedback compensator with compensator (controller) $$C(s)$$ and a transfer function representing the plant​, $$P(s)$$. The measured output $$Y(s)$$ , is supposed to track the reference $$R(s)$$ and the tracking has to match certain desired specifications.

<figure><img src="/files/3LhSRRIZNPTBCLAFX6fw" alt=""><figcaption><p>Figure 2.1: Unity Feedback System. </p></figcaption></figure>

The output of the system can be written as

$$
Y(s) = C(s)P(s)(R(s) - Y(s)).
$$

By solving for $$Y(s)$$​ we get the closed-loop transfer function

$$
\frac{Y(s)}{R(s)} = \frac{C(s)P(s)}{1 + C(s) P(s)}.
$$

​When a second-order system is placed in series with a proportional compensator in the feedback loop as in Figure 1.2, the resulting closed-loop transfer function can be expressed as

$$
\frac{Y(s)}{C(s)} = \frac{\omega\_n^2}{s^2+2\zeta\omega\_n s+\omega\_n^2}, \qquad \qquad \tag{2.1}
$$

where $$\omega\_n$$​ is the natural frequency and $$\zeta$$​ is the damping ratio. This is called the standard second order transfer function. Its response properties depend on the values of $$\omega\_n$$​ and $$\zeta$$​.

### 2.2 Control Specifications

The desired time-domain specifications for stabilizing the gyroscope are:

$$
\omega\_n = 6\pi ,\mathrm{rad/s} \qquad \qquad \tag{2.2}
$$

or 3Hz, and

$$
\zeta = 0.7. \qquad \qquad \tag{2.3}
$$

### 2.3 Gyro PD Controller

To stabilize the heading of the gyroscope, we will develop a Proportional-Derivative (PD) controller depicted in Figure 2.2.

<figure><img src="/files/dIp4JgDLKt5Mk8JerX17" alt=""><figcaption><p>Figure 2.2: Gyroscope PD Control Block Diagram</p></figcaption></figure>

Assuming that the support plate (and servo) rotates relative to the base by the angle $$\gamma$$(not measured)​ and that the gyro module rotates relative to the servo module by the angle $$\theta\_l$$(measured)​, the total rotation angle of the gyro module relative to the base plate can be expressed by&#x20;

$$
\eta = \gamma + \theta\_l \qquad \qquad \tag{2.4}
$$

​We want to design a controller that maintains the gyro heading, i.e. keeps $$\eta = 0$$​, independent of $$\gamma$$​ and we can only use the measurement from the gyro sensor, $$\alpha$$​. In other terms, we want to stabilize the system such that $$\dot{\eta}\rightarrow 0$$​. Differentiating equation (2.4) gives

$$
\dot{\eta} = \dot{\gamma} + \dot{\theta}\_l
$$

​Given that $$\dot{\eta} = \omega\_b$$​ and the gyro gain definition in equation (1.5), this becomes

$$
G\_g \alpha = \dot{\gamma} + \dot{\theta}\_l
$$

Taking the Laplace and solving for $$\alpha(s)/s$$​, we get

$$
\frac{\alpha(s)}{s} = \frac{1}{G\_g} ( \gamma(s) + \Theta\_l (s))
$$

Introducing the new variable $$\epsilon (s)$$​ such that

$$
\epsilon (s) = \frac{\alpha(s)}{s}
$$

which is the integral of the deflection angle, the gyro transfer function can be changed into the form

$$
\epsilon(s) = \frac{1}{G\_g} (\gamma(s) + \Theta\_l(s))
$$

Add the SRV02 dynamics given in Section 1.1 into $$\Theta\_l(s)$$​ to introduce our control variable $$V\_m(s)$$ to get

$$
\epsilon (s) = \frac{1}{G\_g}\left(\gamma(s) + \frac{K}{s(s\tau + 1) }V\_m(s)\right)\qquad \qquad \tag{2.5}
$$

Adding the PD control

$$
V\_m(s) = - (k\_p + k\_d s)\epsilon (s)
$$

​and solving for $$\epsilon(s) / \gamma(s)$$we obtain the closed-loop transfer function

$$
\frac{\epsilon (s)}{\gamma (s)} = \frac{s(s\tau +1)}{G\_g \tau s^2 + (K k\_d + G\_g)s + K k\_p}.\qquad \qquad \tag{2.6}
$$

​

### Pre-lab Questions

1. Find the steady-state speed of the flywheel, $$\omega\_f$$​, given the motor equation

$$
v\_{g,m}= i\_{g,m}R\_{g,m} + k\_{g,m}\omega\_f
$$

​where $$i\_{g,m} = 0.23 ,\mathrm{A}$$  is the nominal current, $$v\_{g,m} = 12 , \mathrm{V}$$​ is the nominal voltage, $$R\_{g,m}=5.3 , \mathrm{\Omega}$$​ is the motor resistance, and $$k\_{g,m} = 0.0235 , \mathrm{V\cdot s/rad}$$​ is the back-emf constant.&#x20;

2\. Find the value of the gyroscope sensitivity gain, $$G\_g$$. The flywheel moment of inertia is $$J\_f=\frac{1}{2}m\_fr\_f^2=0.00103 ,\mathrm{Nms^2/rad}$$. The radius and spring stiffness parameters, are respectively $$R = 0.0254 , \mathrm{m}$$ and $$K\_s = 1908.9 , \mathrm{N/m}$$.

3\. The closed-loop transfer function was found in equation (2.6). Find the PD control gains, $$k\_p$$​ and $$k\_d$$​, in terms of $$\omega\_n$$and $$\zeta$$. (**HINT**: Remember the standard second-order system equation).

4\. Based on the nominal SRV02 model parameters, $$K$$ and $$\tau$$​ given in Section 1.1, calculate the control gains needed to satisfy the time-domain response requirements given in Section 2.2.

## Part 3: Experiment Procedure

### 3.1 Control Implementation

In this section, the gyroscopic control developed in Section 2.3 is implemented on the actual system. 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 *q\_gyro* Simulink diagram shown in Figure 3.1 is used to run the PD control on the Quanser Rotary Gyroscope system. The SRV02 Gyroscope subsystem contains QUARC blocks that interface with the DC motor and sensors of the system.

<figure><img src="/files/pQPQLbQEv9jL9RMEdCSs" alt=""><figcaption><p>Figure 3.1: q_gyro Simulink Diagram</p></figcaption></figure>

0\. Download the experiment files:

{% file src="/files/5qIHW0TB7comuW95BCUH" %}

1. Verify that the amplifier is turned ON and the disc is rotating. Ask TA if there's an issue.
2. Run the setup\_gyro.m script
3. Open the q\_gyro simulink diagram.
4. Make sure the Manual Switch is set to downward position to enable the PD control.
5. To build the model, click the down arrow on **Monitor & Tune** under the Hardware tab and then click **Build** **for monitoring** ![](/files/F2dOEp0PbFGdcI8vs0cM). This generates the controller code.
6. Press **Connect** <img src="/files/uORNyY7T0XmLTYaSZyVj" alt="" data-size="line"> button under Monitor & Tune and Press **Start** <img src="/files/OTdtk1LFdBfwxlcgsJX8" alt="" data-size="line">.
7. While the system is running, manually rotate the bottom base plate about 45 degrees. The GYRO module should be maintaining its heading. Verify your response by viewing the scopes in your experiment and comparing against the provided scope examples.
8. Stop the controller once you have obtained a representative response.
9. Plot the responses from the *theta* (deg), *alpha* (deg), and *Vm* (V) scopes in a MATLAB figure. The response data is saved in variables *data\_theta , data\_alpha, data\_vm.*
10. Start the controller again, but this time with the Manual Switch set in the upward position, which turns off the PD controller.
11. Rotate the bottom base plate by the same amount as previously done, in an attempt to reproduce the motion as previously executed.
12. Plot the responses.
13. Examine how the GYRO module responds when you rotate the base plate. Does this make sense? Explain the result when the PD control is ON and OFF. Based on your observations, explain what the PD control is actually doing and how it relates to gyroscopes.

## Directives for Report

1. Briefly describe the main goal of the experiment
2. Briefly describe the experimental procedure in steps 7 and 9 of section 3.
3. Briefly describe the experimental procedure in step 11 and 12 of section 3.
4. Provide results of plots for step 9 and step 12 of section 3.
5. Explain the effect of having the PD control on and off.
6. Briefly explain how does this relate to an actual gyroscope system?


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gtae.gitbook.io/ae4610/archive/rotary-gyro/rotary-gyro.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
