On the following drawing, a platform is hung from the ceiling not exactly from its centre of gravity. Because of this it can't sustain an arbitrary orientation for long; I want to increase its stiffness with the use of 3 orthogonal fast spinning flywheels, but before building those flywheels I need to know how big they need to be by making a dynamic model... enter image description here

... And I have been unable to model the gyroscopic effect [Edit: end removed for clarity].


How can I model the 3 flywheels reaction to (themselves and) the gravity torque, be it through a rate increment or a torque (to inject in the plant model)?

Implementing Lelesquiz's answer

Top level equations: Euler-Lagrange

The goal is to solve for each timestep for the angles $(\phi, \theta, \psi)$ using the equations, in inertial frame: $$\frac{d}{dt}\left(\frac{\partial L}{\partial \dot{\phi}}\right)-\frac{\partial L}{\partial \phi}= (\boldsymbol{M_g}-\sum_{k=1}^3 \boldsymbol{M_{wk}})\cdot \frac{\partial \boldsymbol{\omega_b}}{\partial \dot{\phi}}$$ $$\frac{d}{dt}\left(\frac{\partial L}{\partial \dot{\theta}}\right)-\frac{\partial L}{\partial \theta}= (\boldsymbol{M_g}-\sum_{k=1}^3 \boldsymbol{M_{wk}})\cdot \frac{\partial \boldsymbol{\omega_b}}{\partial \dot{\theta}}$$ $$\frac{d}{dt}\left(\frac{\partial L}{\partial \dot{\psi}}\right)-\frac{\partial L}{\partial \psi}= (\boldsymbol{M_g}-\sum_{k=1}^3 \boldsymbol{M_{wk}})\cdot \frac{\partial \boldsymbol{\omega_b}}{\partial \dot{\psi}}$$ Where $M_g$ is the gravity torque, $M_{wk}$ is the motor torque applied on the flywheel k (opposite of what's applied on the platform), and $\omega_b$ is the platform rate vector in inertial frame. 3 other equations based on $\alpha_k$, the angles of the flywheels, should have been added to completely characterize the system but the rates of the wheels are inputs, measured directly. The torques on the wheels are inputs as well (and the command of the closed loop system).

Knowing that the lagrangian $L=T-U$ in the inertial frame.

Kinetic energy T

$$ T(\phi, \theta, \psi, \dot{\phi}, \dot{\theta}, \dot{\psi}) = \frac{1}{2} \sum_{k=1}^3 \left(\boldsymbol{N_{k,Ri}^T}\boldsymbol{[I_{wO,Ri}]}\boldsymbol{N_{k,Ri}} \right) + \frac{1}{2} \left( m_{b} \boldsymbol{v_{b,Ri}}^T\boldsymbol{v_{b,Ri}}+\boldsymbol{\omega_{b,Ri}^T} \boldsymbol{[I_{bG,Ri}]} \boldsymbol{\omega_{b,Ri}} \right)$$ Where $m_b$ is the mass of the system (with wheels on), $\boldsymbol{v_{b}}$ the velocity vector of the center of gravity of the system, $\boldsymbol{\omega_{b}}$ the system's rate vector (wheels not spinning) and $\boldsymbol{[I_{bG}]}$ the inertia matrix of the system about its center of gravity (which needs to be transported from the guimbal centre 0), $[I_{wO}]$ the inertia matrix of the flywheels about their axis, and $\boldsymbol{N_{k}}$ the rate vector of the flywheels in the inertial frame. $$\begin{array}{lc}\boldsymbol{[I_{wO,Ri}]}=\boldsymbol{[R_{ib}]}\left[\begin{matrix}J_w & 0 & 0\\ 0 & J_w &0\\0 & 0& J_w\end{matrix}\right] \boldsymbol{[R_{bi}]} \end{array}$$ $$\boldsymbol{v_{b}}=\boldsymbol{\omega_{b,Ri}}\times\boldsymbol{\Delta_{b,Ri}}$$ $$\begin{array}{lc} \boldsymbol{[I_{bG,Ri}]}= \boldsymbol{[R_{ib}]}\boldsymbol{[I_{bO,Rb}]}\boldsymbol{[R_{bi}]}+m_b& \left(\begin{matrix} \Delta_{by,Ri}^2+\Delta_{bz,Ri}^2 & -\Delta_{bx,Ri}\Delta_{by,Ri} & -\Delta_{bx,Ri}\Delta_{bz,Ri} \\ -\Delta_{bx,Ri}\Delta_{by,Ri} & \Delta_{bx,Ri}^2+\Delta_{bz,Ri}^2 & -\Delta_{by,Ri}\Delta_{bz,Ri} \\ -\Delta_{bx,Ri}\Delta_{bz,Ri} & -\Delta_{by,Ri}\Delta_{bz,Ri} & \Delta_{bx,Ri}^2+\Delta_{by,Ri}^2 \end{matrix}\right) \end{array}$$ $\boldsymbol{\Delta_{b,Ri}}$ being the guimbal centre - center of gravity vector of the system expressed in the inertial frame. See below "Euler angle expressions" for the transformation body-inertial $\boldsymbol{<vector>_i}=\boldsymbol{[R_{ib}]}\boldsymbol{<vector>_b}$.

Potential energy U

$$U(\phi, \theta, \psi) = -m\boldsymbol{g_{Ri}}.\boldsymbol{\Delta_{b,Ri}}$$ The minus sign comes from the fact U is minimum with the guimbal-CG vector pointing downward (dot product positive).

Euler angles expressions

The Euler angles 313 have been selected as a coordinate system, which gives the rotation matrix from inertial frame $(0 \boldsymbol{X_i Y_i Z_i})$ to body frame $(0 \boldsymbol{X_b Y_b Z_b})$: $$ \begin{array}{lc} \boldsymbol{R_{RbRi}}(\phi, \theta, \psi)= & \left[\begin{matrix} cos \psi & sin \psi & 0 \\ -sin \psi & cos \psi & 0 \\ 0 & 0 & 1 \end{matrix}\right] \left[\begin{matrix} 1 & 0 & 0 \\ 0 & cos \theta & sin \theta \\ 0 & -sin \theta & cos \theta \end{matrix}\right] \left[\begin{matrix} cos \phi & sin \phi & 0 \\ -sin \phi & cos \phi & 0 \\ 0 & 0 & 1 \end{matrix}\right] \end{array}$$ The rate vector is obtained by summing the projections on each axis of the inertial frame the $\boldsymbol{\dot{\phi},\dot{\theta},\dot{\psi}}$ vectors): $$\begin{array}{lc} \boldsymbol{w_{b,Ri}}= & \left[\begin{matrix} \dot{\theta}cos\phi+\dot{\psi} sin\theta sin\phi \\ \dot{\theta}sin\phi+\dot{\psi} sin\theta cos\phi \\ \dot{\phi}+\dot{\psi}cos\theta \end{matrix}\right]\end{array}$$


The kinetic energy of the wheels is independent on the Euler angles, so the rates of the wheels have no effect, which is wrong! Since it's absolutely normal that no matter the rotation matrix the norm of the wheels rates vector does not change, the kinetic energy expression or even the top level equations must be wrong.

  • $\begingroup$ Could you explain the expression $\mathbf \omega_p = I^{-1} \int^t_0 (\mathbf{\tau_1}+\mathbf{\tau_2}+\mathbf{\tau_3}+\mathbf{\tau_g}) dt$? What is the role of $I^{-1}$, which I take to be the inverse of the inertia tensor of the platform? What is precisely the meaning of $\text{angles} = \int_0^t \mathbf{\omega_p} dt$? $\endgroup$ May 27, 2014 at 19:31
  • $\begingroup$ How did you get the left sides of your first set of equations $$\mathbf{\tau_2} + \mathbf{\tau_3} +\mathbf{\tau_g} \\ \vdots \qquad \qquad \qquad ?$$ $\endgroup$ May 27, 2014 at 19:39
  • $\begingroup$ I'm only simulating the plant, which from given torques at each timestep integrates them affected by the inverse of the platform inertia to give the angular rates of the platform, and then integrates the latter to give the angles of the platform in the inertial frame. I've updated my post with more details. The left side of the equations for the gyroscopes are the external torques as seen from each of the wheels: the other wheels' and the gravity's. $\endgroup$ May 27, 2014 at 22:10
  • 1
    $\begingroup$ Have you included the gravity forces in the total torque about the center of mass? $\endgroup$ Jun 6, 2014 at 12:49
  • 1
    $\begingroup$ By the way, like I said, this is not a trivial problem. Go slowly. For one thing, don't simply take Lelesquiz's equation, because for one thing there should be 5 variables involved: one angle for every gyroscope and two angles for the orientation of the platform. And also be aware that L=T-V, not the sum of T and V. $\endgroup$
    – Zorawar
    Jun 10, 2014 at 18:08

1 Answer 1


Since in my last post I made a lot of mistakes, I'll try to improve that answer starting from scratch.

First of all: lagrangian coordinates. It first seemed clear that two coordinates suffice in describing the body orientation. Of course this is false, since in order to describe every possible orientation one needs three coordinates. We'll call them $(\theta, \phi, \psi)$.

Any more coordinates? I don't think so. The only external forces acting of the body are the rope tension and gravity. They are both directed along the vertical, so no oscillations should develop.

Next: rotation description. Refer to this link. You could pick Euler angles or Tait-Bryan, your choice. Given the angles, you then compute the rotation matrix. With the matrix you can compute any vector rotation regarding the body. Will call this $R(\theta (t), \phi (t), \psi (t)) = R(t)$.

Body description: your model depends on many quantities. They essentially are

  • Initial body orientation and initial angular velocity
  • Initial relative positions of the three gyroscopes
  • Initial orientations of the gyroscopes and angular velocities
  • Initial center of gravity position
  • $\theta(t), \phi(t), \psi(t)$

Given any of these vectors $\vec{x}_0$, you can compute the corresponding vector at time $t$ as $\vec{x}(t) = R(t) \cdot \vec{x}_0 = R(\theta, \phi, \psi) \cdot \vec{x}_0 = \vec{x}(\theta, \phi, \psi)$.

What's next? Compute the kinetic energy of the body. It is given by

$$ T(\theta, \phi, \psi, \dot{\theta}, \dot{\phi}, \dot{\psi}) = \frac{1}{2} I_1 \omega_1^2(\theta, \phi, \psi) + \frac{1}{2} I_2 \omega_2^2(\theta, \phi, \psi) +\frac{1}{2} I_3 \omega_3^2(\theta, \phi, \psi) + \frac{1}{2} I_{TOT} \omega_{body}^2(\theta, \phi, \psi, \dot{\theta}, \dot{\phi}, \dot{\psi}) $$.

Again note that the gyroscopes' angular velocities are constant in magnitude (if you admin no friction and only forces normal to the axis, but they rotate with the body: their relative angle to the body has remain fixed.

Finally compute the potential energy as $$ U(\theta, \phi, \psi) = mgh(\theta, \phi, \psi)$$

The total lagrangian is

$L = T-U$.

Now you should be able to apply the Euler Lagrange equations and solve numerically. Good luck! You might need to help yourself with mathematica or any other sort of algebra package in order not to damage your brain with the derivatives and scalar products.

  • $\begingroup$ The three angles $\theta, \phi, \psi$ describe the state of the body, but you'll also need angles $\alpha_i$ for the orientations of the discs of the gyroscope $i$ wrt to the body as well won't you? The gyroscopes rotate freely from the body. $\endgroup$
    – Zorawar
    Jun 11, 2014 at 19:40
  • $\begingroup$ Don't do they rotate with constant angular speed? $\endgroup$
    – Lelesquiz
    Jun 11, 2014 at 21:20
  • 1
    $\begingroup$ @Lelesquiz: sure, but what is that (constant) angular velocity? Its not simply $\dot\theta$, $\dot\phi,$ or $\dot\psi$ since they are the motions of the platform. The platform may be motionless and the gyroscopes will still rotate, so you will necessary need another coordinate. Remember that the coordinates specify a state of the system. If you have only $\theta, \phi, \psi$ you can't distinguish the positions of the gyroscope as it rotates. $\endgroup$
    – Zorawar
    Jun 12, 2014 at 3:46
  • 1
    $\begingroup$ In case of variable speed it is quite different: since the system itself cannot change the gyros' speed, something "external" is driving them. That is, the electric motors that control them add or subtract kinetic energy from the system. Then you have to change the Euler-Lagrange equations in order to account for the external virtual works. See i.e. en.wikipedia.org/wiki/Virtual_work, especially en.wikipedia.org/wiki/Virtual_work#Couples and en.wikipedia.org/wiki/… $\endgroup$
    – Lelesquiz
    Jun 17, 2014 at 23:17
  • 1
    $\begingroup$ Now you might be onto something...Just be sure to put the right expression of $\omega_i$, $i=1,2,3$ as function of $\psi, \phi, \theta, \alpha_1, \alpha_2, \alpha_3$. Also check that minus sign in front of U$. Then I would personally test the simulation starting with the simplest case (everything stopped, with the system in the barycenter), going to more and more complicated situations. $\endgroup$
    – Lelesquiz
    Jun 27, 2014 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.