Cart & inverted pendulum

The cart–inverted-pendulum is the benchmark plant for teaching manual balancing and linear–quadratic control. This page integrates the planar coupled equations with an adjustable horizontal force F. Accelerations are obtained each sub-step by solving the 2×2 linear system from ΣF and Στ about the pendulum pivot on the cart. There is no sensor noise, no motor saturation model, and no automatic LQR — only your choice of F.

Who it's for: Controls courses and advanced undergrad mechanics labs.

Key terms

  • Inverted pendulum
  • Cart-pole
  • Underactuated system
  • Nonlinear coupling
  • Manual control

How it works

Planar cart of mass M with a point mass m on a rigid rod of length L. You apply horizontal force F; accelerations are solved from the coupled linear system each sub-step, then positions are updated (explicit Euler). Try balancing θ ≈ 0 with gentle nudges — LQR is left as an extension.

Frequently asked questions

Why does the description no longer claim symplectic integration?
The implementation uses an explicit update with accelerations from the instantaneous configuration; it is simple and robust for play, not a symplectic splitting integrator.
Can I stabilize θ = 0 with constant F?
Not globally; the inverted equilibrium is unstable without feedback that reacts to θ and θ̇ (or a swing-up strategy).