Here’s an interesting segue:

Segway boss dies after riding one off a cliff

Poor guy 😦

IWP Lagrangian

26 September 2010

One of many methods of controller design starts off by modeling the dynamics of the physical system. This helps understand the system, check for controllability and observability, choose the control topology, specify and optimize the controller response, check for stability, and simulate the system under different conditions.

A nice and intuitive approach is to find the equations of motion; a mathematical description for the behavior of the system as a function of time. The Euler-Lagrange equation provides a convenient description of the equations of motion because the Lagrangian approach allows the direct use of generalized coordinates. Solving this equation for local minima or maxima means finding the stationary points of the model. For the IWP, this means controlling to \theta{}_1=\dot{\theta{}_1}=\dot{\theta{}_2}=0, while \theta{}_2 is a cyclic coordinate whose steady state value plays no role in the stability of the IWP, so can be left uncontrolled.

The Lagrangian is what must be derived and substituted into the Euler-Lagrange equation to give the equations of motion. The Lagrangian, L, is defined as the total kinetic energy, T, minus the total potential energy, V:

L=T-V.

With the chosen coordinate system, we can calculate the above knowing that:

rotational kinetic energy = \frac{1}{2} \cdot I \cdot \omega{}^2,
potential energy = m \cdot g \cdot h,
and rotational inertia about a point, of a point-mass at radius, r = m \cdot r^2.

Here goes…

Kinetic energy of the wheel caused by I_{WC} and its total angular velocity, \dot{\theta{}_1}+\dot{\theta{}_2}, is

\frac{1}{2}I_{WC}(\dot{\theta{}_1}+\dot{\theta{}_2})^2, (1)

while kinetic energy of the wheel caused by M at point WC and its angular velocity, \dot{\theta{}_1}, about PB is

\frac{1}{2}(ML^2)\dot{\theta{}_1}^2. (2)

Kinetic energy of the pendulum caused by I_{PC} and its angular velocity, \dot{\theta{}_1}, about PC is

\frac{1}{2}I_{PC}\dot{\theta{}_1}^2, (3)

while kinetic energy of the pendulum caused by m at point PC and its angular velocity, \dot{\theta{}_1}, about PB is

\frac{1}{2}(ml^2)\dot{\theta{}_1}^2. (4)

Since the angular velocities of the pendulum about PC and PB are equal, equations (3) and (4) can be simplified to one term describing the total kinetic energy contribution of the pendulum due to the inertia of the pendulum about {PB}, and its angular velocity, \dot{\theta{}_1}, about PB

\frac{1}{2}I_{PB}\dot{\theta{}_1}^2, (5)

Combining (1), (2), and (5) gives total kinetic energy of the system

\begin{array} {lcl} T & = & \frac{1}{2}(ML^2)\dot{\theta{}_1}^2+\frac{1}{2}I_{WC}(\dot{\theta{}_1}+\dot{\theta{}_2})^2+\frac{1}{2}I_{PB}\dot{\theta{}_1}^2, \\ & = & \frac{1}{2}(ML^2+I_{PB})\dot{\theta{}_1}^2+\frac{1}{2}I_{WC}(\dot{\theta{}_1}+\dot{\theta{}_2})^2. \end{array} (6)

The potential energy of the wheel due to gravity, g, is

M L g \cos \theta{}_1, (7)

and the potential energy of the pendulum due to gravity, g, is

m l g \cos \theta{}_1. (8)

Combining (7) and (8) gives total potential energy of the system

V = m l g \cos \theta{}_1 + M L g \cos \theta{}_1. (9)

We can now summarize the system dynamics by substituting (6) and (9) into the Lagrangian. By absorbing some constants for the sake of brevity, we arrive at

\begin{array} {lcl} L & = & \frac{1}{2}(ML^2+I_{PB})\dot{\theta{}_1}^2+\frac{1}{2}I_{WC}(\dot{\theta{}_1}+\dot{\theta{}_2})^2 \\ & & - m l g \cos \theta{}_1 - M L g \cos \theta{}_1 \\ & = & \frac{1}{2}a\dot{\theta{}_1}^2+\frac{1}{2}I_{WC}(\dot{\theta{}_1}+\dot{\theta{}_2})^2 - b g \cos \theta{}_1, \end{array}

where

\begin{array} {lcl} a & = & ML^2+I_{PB} \\ b & = & m l + M L. \end{array}

More to come in the next post 😉

IWP parameters

23 September 2010

Starting off the second of a series of posts about my IWP project, I discover that wordpress.com have support for \LaTeX. Woot! This means that I’ll be able to present my equations in the format they were intended. It also means I have no excuse not to start off with some maths 😉

To keep things consistent, I will stick to the parameters defined below:

Where:

\begin{array}{lcl} \theta{}_1 & = & \mbox{Pendulum angle with respect to vertical axis,} \\ \theta{}_2 & = & \mbox{Wheel angle with respect to pendulum axis,} \\ m & = & \mbox{Mass of pendulum,} \\ M & = & \mbox{Mass of Wheel,} \\ l & = & \mbox{Length from pendulum base (PB) to pendulum center of mass (PC),} \\ L & = & \mbox{Length from pendulum base (PB) to wheel center of mass (WC),} \\ I_{PC} &=& \mbox{Rotational Inertia of pendulum about pendulum center of mass (PC),} \\ I_{PB} &=& \mbox{Rotational Inertia of pendulum about pendulum base (PB),} \\ I_{WC} &=& \mbox{Rotational Inertia of wheel about wheel centre of mass (WC),} \\ g &=& \mbox{Constant of gravitational acceleration.} \end{array}

Assumptions: The pendulum, reduced to a line representation in the above illustration, will in actuality comprise of the chassis plus all rigidly attached masses, which might include the motor enclosure, printed circuit boards and/or batteries etc. Accordingly, the center of mass and the moments of inertia of the pendulum should be calculated with this in mind. The same thing applies to the wheel, which might include the rotor mass and inertia.

I will dedicate the next post to calculating the system Lagrangian using the parameters above. Until then, goodbye..

Inertia Wheel Pendulum

22 September 2010

The Inertia Wheel Pendulum (IWP) is an underactuated mechanical system, meaning it has fewer actuators than degrees of freedom. The number of degrees of freedom is defined by the number of independent generalized coordinates of the system. For the IWP, it is convenient to use polar coordinates to represent the angle and rate of the pendulum about the pendulum base, and the angle and rate of the inertia wheel about the centre of the wheel.

The wheel is actuated by a motor, while the pendulum coordinates remain underactuated, however, the pendulum can be controlled by the action of the wheel through dynamic coupling. In the case of the IWP, this means the single motor can be used to control the angular position and rate of the pendulum as well as that of the wheel.

A simple model of the IWP has two equilibrium points, assuming the base of the pendulum to be anchored at a point that enables it to rotate, unconstrained, through 360°. The downward pointing position is the passively stable equilibrium point; the “relaxed” state the system would settle at if no power was applied to the motor. The upward pointing position is passively unstable but can be stabilized by closed-loop regulation of the motor torque and generalized coordinates.

While getting an IWP to point down is easy, thanking gravity, getting one to balance upright is a little more challenging. This ex post facto series of blog entries will touch on some of the theory behind the IWP and the steps I took to design and construct a working prototype. Stay tuned for more!