The equations of motion for a cart-pole (inverted pendulum) system are given as



However, I want to model a two wheeled segway-like robot with motion constrained to only forward and backward actions (effectively restricting motion in 1D). I initially thought that I could model such a constrained segway robot by modeling a cart-pole system with a massless cart (M=0). Is this the right approach to model the dynamics of a 1D segway robot? Or is there a better model for the dynamics of such a robot in 1D?


1 Answer 1


Let's start by defining some of the quantities in the equations you gave:

  • $I$ Inertia of the pendulum about its center of gravity
  • $M$ Mass of the cart
  • $m$ Mass of the pendulum
  • $l$ Distance between pendulum CG and its pivot
  • $x$ Displacement of the cart
  • $\theta$ Angle between a vertical axis and the pendulum
  • $F$ Driving force acting on the cart
  • $g$ Acceleration due to gravity

Note that I chose a different sign convention for gravity than in the original question. In my answer, $g$ has a positive value, while in the original question $g$ must be negative.

Now let's compare this system and to a "segway-like" balancing robot. The balancing robot's wheels are analogous to the cart, but in addition to translating, they also rotate. This rotation means that for a given mass $M$, the balancing robot will require more energy to accelerate, since it needs to translate and also rotate. So instead of zero cart mass, we expect an additional term that corresponds to this additional required effort.

Another difference is that instead of a linear force acting on the cart, we have a moment applied to the wheels, and an equal and opposite moment applied to the pendulum.

To derive the equations for the balancing robot, we need an additional two quantities, and we'll use $T\!\left( t \right)$ for the driving torque in place of $F$:

  • $r$ Radius of the wheels
  • $I_D$ Inertia of the rotating components in the drivetrain

And we end up with $$ \left(I + m l^2\right) \ddot{\theta} - m g l \sin \left( \theta \right) + m l \ddot{x} \cos \left( \theta \right) = - T\!\left( t \right) $$ $$ \left( \frac{I_D}{r^2} + M + m \right) \ddot{x} + m l \ddot{\theta} \cos \left( \theta \right) - m l \dot{\theta}^2 \sin \left( \theta \right) = \frac{T\!\left( t \right)}{r} $$


Since the real system isn't as simple as two bodies connected with a revolute joint, here is some guidance on where to "count" the mass and inertia of system components.

If we can assume we've already decided to model the system as two bodies (i.e. wheels/drivetrain and pendulum), then for each component, you need to ask "with which body does this component move?" Let's say there are two wheels which are secured to the pendulum by bearings. Let's also say that the wheels are driven by motors acting through gearboxes and there are couplings connecting the motors and wheels to the gearboxes (we'll call the couplings between the wheels and gearboxes "low-speed" and the couplings between the motors and gearboxes "high-speed").

It's fairly obvious that the wheels and low-speed couplings move as a unit. And it doesn't take much more thought to see that the inner race of the bearings, the internals of the gearbox and the motor rotors all move with the wheels as well. In your question, you constrain the robot to linear travel, so we will assume that the two wheels move as a unit, too. When there is a gearbox involved, the inertia of the motor and high-speed coupling (and sometimes the gearbox, depending on the convention used on the datasheet -- read carefully!) needs to be reflected to the opposite side of the gearbox. The relationship is given by

$$ I_{low-speed} = R^2 I_{high-speed} $$

So the drivetrain inertia would look something like this:

$$ I_D = 2 \left( I_{wheel} + I_{low-speed coupling} + I_{gearbox} + R^2 \left( I_{high-speed coupling} + I_{motor} \right) \right) $$

I would treat the mass similarly. The gearbox housing, motor stator and outer race of the bearing move with the pendulum, so their masses should add to $m$, while the wheels, all four couplings, gearbox internals and motor rotors should add to $M$. In practice, I've never seen the mass of the gearbox internals on a datasheet, and I doubt that it's significant anyway. But it is likely that the mass and inertia of the motors and at least the high-speed couplings are important, if not also the low-speed couplings. For bearings, I usually assign half of the mass and inertia to each body and assume that it's close enough.

It's also worth mentioning that we have kind of a funny case where both the gearbox housing and the output shaft can be moved while keeping the other stationary. The motor will rotate in response to both of these motions. I haven't put much thought into the "correct" way to account for this effect (possibly adding a small additional term to the pendulum inertia?), but with my engineering hat on, I would feel comfortable neglecting this effect and assuming the controller will compensate anyway.

  • $\begingroup$ I'm implicitly assuming g to be negative, so I think the original equations that I posted are valid. $\endgroup$
    – Paul
    Mar 7, 2017 at 15:30
  • $\begingroup$ @Paul Fair enough - we chose different sign conventions. I'll update my answer. $\endgroup$
    – Kerry
    Mar 7, 2017 at 15:38
  • $\begingroup$ Also, I think "I" is the moment of inertial around its center of mass, not the pivot point in contact with the cart. $\endgroup$
    – Paul
    Mar 7, 2017 at 15:58
  • $\begingroup$ Also correct - one more edit coming... $\endgroup$
    – Kerry
    Mar 7, 2017 at 16:28
  • $\begingroup$ So, even though there is no cart, could we still model the mass 'M' as the total mass of the wheels (and perhaps motors)? Also, how does one account for the entire drivetrain to estimate $I_D$? What exactly goes into computing $I_D$? I think the moment of inertia of the wheels is one part of it, but what else goes into it? $\endgroup$
    – Paul
    Mar 7, 2017 at 16:35

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.