# Optimal location of the center of mass for an inverted pendulum

I'm building an inverted pendulum to be controlled by DC motors, but I've run across a conundrum. Personal life experience tells me that it's better to have a lower center of mass to maintain balance. On the other hand, the greater the moment of inertia (e.g. the higher the center of mass), the easier it is to maintain balance as well.

These two views both seem plausible, and yet also seem contradictory. For an inverted pendulum, is there an optimal balance between the two perspectives? Or is one absolutely right while the other absolutely wrong? If one is wrong, then where is the error in my thinking?

The two views are not contradictory; they apply to two different situations, which you are treating as a single one.

Your personal experience about having a low center of mass applies to situations where there is a stable position -- a local minimum height for the center of mass. For example, if you have a vase on a shelf, the height of the vase's center of mass (in relation to the width of its base) determines how far it can wobble from side to side without tipping over. Shown here with trucks:

The wobbling of a vase represents the tendency of the vase's center of mass to return to that local minimum height. If it tips over too far, the center of mass will find a different (and undesirable) minimum height.

The inverted pendulum situation has no "stable" position -- no local minimum for the center of mass. This shouldn't be surprising, because it rests on a single point.

So in the vase example, once the vase begins its inevitable fall, the height of the vase's center of mass affects how much time it will take to complete that movement. In the case of the inverted pendulum, this affects how much time you have to correct for that undesired outcome.

So if either one of these is the "absolutely wrong" way to look at an inverted pendulum, it's the "resting in a stable position" situation.

Lower centers of mass are more stable, but an inverted pendulum is inherently unstable; any perturbation will set it off.

The height to center of mass depends on how much track you have available, your reaction time, how you're measuring displacement/force, etc.

## :EDIT:

To elaborate on my statement above, say you're estimating pendulum position by the reaction force on the carriage, where the force on the carriage is

$$F_{\mbox{reaction}} = (mg)L\sin{\theta}$$

Well, in that instance, if the reaction force is constant (say you're evaluating the minimum detectable force), then the angle associated with that force declines as the pendulum length $L$ increases.

Similarly, if you've got a rotary/angular encoder that has some minimum detectable angle, then the reaction force that puts on your carriage increases as the pendulum length increases.

In addition to the minimum detectable cases, consider the kinetic energy of the pendulum. This is an inverted pendulum, so the portion of the potential energy that is converted to kinetic energy is given by:

$$\mbox{KE} = \mbox{PE}_{\mbox{initial}} - \mbox{PE}_{\mbox{final}} \\ \mbox{KE} = mgL - mgL\cos{\theta} \\ \mbox{KE} = (mg)*L(1-\cos{\theta}) \\$$

(All of this assumes $\theta=0$ when the pendulum is vertical, by the way, just in case there's any confusion)

So, here again, for a constant $\theta$, the longer the pendulum length is the more kinetic energy the pendulum has. Assuming that you are again considering the minimum detectable case, this means that the longer the pendulum length is, the more kinetic energy the system has before you get a chance to respond.

So now, in addition to the fact that you're traversing more track ($\Delta x = L\sin{\theta} \approx L\theta$), the pendulum also has a higher starting kinetic energy, which means now you have to take a larger control action to damp the motion and return to steady state.

So, in summary:

1. If you're measuring the angle of the pendulum directly, a shorter pendulum length would be preferred because it minimizes the kinetic energy of the pendulum by the time you detect motion.
2. If you're estimating the angle of the pendulum by measuring reaction force on the carriage, a longer pendulum length would be preferred because this corresponds to a smaller angle, which in turn corresponds to lower initial kinetic energy.

I made a short spreadsheet to generate some plots to show the differences:

• So, a lower center of mass makes it more difficult to move away from equilibrium (assuming you already started out there), but a higher center of mass makes it easier to move back to the equilibrium? – Paul Feb 3 '16 at 4:18
• Also, the dependence of the optimal CoM height on reaction time and track availability make sense, but what do you mean when you say that it also depends on "how you're measuring displacement/force, etc." Could you elaborate on that a bit more? – Paul Feb 3 '16 at 4:21
• @Paul - Please see my updated response. Sorry for the brevity in the initial response; it was late and I was on my phone. – Chuck Feb 3 '16 at 14:34
• If I'm using an accelerometer to measure the angle, which category would this fall under? Direct angle or reaction force? – Paul Feb 3 '16 at 19:15
• I don't know where your accelerometer is; on the top and I'd say angle, on the carriage and I'd say force. – Chuck Feb 4 '16 at 0:34

You can answer this by considering the equations of motion of an inverted pendulum: $$\ddot{\Theta} = \frac{g}{l} \sin(\Theta)$$

If you agree that the easiest system to control is that which has the smallest $\ddot \Theta$ for you to compensate, then you have three options:

1. Control the pendulum on the moon to lower $g$

2. Keep the pendulum close to $\Theta = 0$, because $\sin(\Theta) \rightarrow \Theta$ for small values of $\Theta$.

3. Make $l$ as large as possible. $l$ is the distance to the center of mass along the link.

• While this is a good physics-centric answer, it ignores all the feedback aspects of this problem. This is the motion, but as it drifts and the system attempts to compensate, it will become more difficult to correct the position the further you get from vertical. From a feedback perspective, you would want the mass of the pendulum to be as low as possible (and CM being close to the fulcrum would help too) – MechanicalMan Feb 3 '16 at 3:25
• Oppenheim wrote a great book Signals and Systems. Look at 26.13 and 26.14 from here: ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/… This example includes proportional and derivative control, and shows that the distance of the poles from the origin of the s plane varies indirectly with $l$. I am ignoring practical aspects such as impedance matching, speed of controller response, etc., but I don't think adding feedback without any of those limitations changes my answer. – SteveO Feb 3 '16 at 3:39
• Interesting. I'll be sure to give that one a read. Perhaps you should edit your answer to include the control aspect of your answer. I suspect that is what Ian is really looking for, not just a physics answer (that is what I was trying to convey with my first comment) – MechanicalMan Feb 3 '16 at 15:06

Since your control input to the system acts only on the cart, then you can influence the pendulum angle only due to the coupling between the cart motion and the pendulum motion. If you were to put the pendulum CG at the pivot, there is no coupling between the cart and the pendulum, and the pendulum angle is no longer controllable. This can be verified by checking the system's controllability matrix.

On paper, having a non-zero $l$ is good enough - the system is controllable as soon as the CG is not on the pivot axis. In practice, however, you need to be able to control the pendulum angle when a reasonable amount of force is applied to the cart (what is reasonable depends on your preferences and budget). When the pendulum is vertical ($\theta$ = 0), the pendulum acceleration is proportional to the cart acceleration:

$$\ddot{\theta} I = -\ddot{x} m l$$

If your goal is just to stabilize the pendulum, it may be desirable to have a large $m l$ and a small $I$ - so your control inputs more directly affect the pendulum angle. If you have constraints on force (and power), cart displacement, etc. or if you have other goals then you may have to choose these parameters differently.

As pointed out in other answers, some systems are more stable when the CG is lower. An inverted pendulum, however, is unstable (or for $\theta = 0$, marginally stable) for all (non-zero) values of $l$, so this theory doesn't apply. In general, it is desirable to have a large $l$ and small $I$ because it makes it easier to control the pendulum.