Skip to main content
Sandbox Physics

Control & mechanics · Force limits

Cart-Pole Balance

Tilt a real three-dimensional cart-pole and release it. Watch feedback catch the pole, return the cart, and lose control when the motor cannot deliver the requested push.

Interactive modelCart-Pole Balance
Tilt from upright00
Rod angular speed00
Delivered cart force00
Requested cart force00
Cart position00
System horizontal momentum00
Signed motor work00
Maximum sampled work-balance residual00

Physics tutorial

Catch the pole, then return the cart

BackgroundUpright is an unstable equilibrium. Feedback must use the actual motion and an actuator with finite authority.

Why it mattersFollow the apparatus, the requested actuation and the mechanical work as one experiment.

Start with the essentials

Focus question
Why does a rightward lean first require a rightward push?
One-sentence intuition
Horizontal base acceleration turns the pole through the contact constraint. The controller also tracks cart position and velocity so the base returns.

Core mathematical model

Nonlinear cart-pole dynamics

(M+m)x¨+mlcos⁡θ θ¨−mlsin⁡θ θ˙2=F,lθ¨+cos⁡θ x¨=gsin⁡θ(M+m)\ddot x+ml\cos\theta\,\ddot\theta-ml\sin\theta\,\dot\theta^2=F,\qquad l\ddot\theta+\cos\theta\,\ddot x=g\sin\theta

Tilt is measured toward the right from upright. The rod is massless and the bob is a point mass.

Local full-state control

Fd=kxx+kvx˙+kθθ+kωθ˙,F=clip⁡(Fd,−Fmax⁡,Fmax⁡)F_d=k_xx+k_v\dot x+k_\theta\theta+k_\omega\dot\theta,\qquad F=\operatorname{clip}(F_d,-F_{\max},F_{\max})

Gains are recomputed from the chosen length and response rate, placing four unsaturated local poles at the negative response rate. All gain signs follow this upright angle convention.

Mechanical work audit

E=12(M+m)x˙2+mlx˙θ˙cos⁡θ+12ml2θ˙2+mgl(cos⁡θ−1),E˙=Fx˙E=\tfrac12(M+m)\dot x^2+ml\dot x\dot\theta\cos\theta+\tfrac12ml^2\dot\theta^2+mgl(\cos\theta-1),\qquad\dot E=F\dot x

The coupling term is essential. Potential is zero at upright; energy change, not its arbitrary offset, is compared with signed motor work.

Common difficulties

Feedback is not unlimited

Typical misconceptionTurning feedback on guarantees recovery from every release.

Better mental modelCompare the limit presets. These are local balancing controllers with finite drive capacity, not swing-up algorithms.

A stable pole still needs base control

Typical misconceptionAngle feedback alone returns the cart to its start.

Better mental modelThe force law uses cart position and velocity as well as pole tilt and angular velocity.

Run the experiment

  1. 01

    Release

    Drag the gold initial-tilt handle, then play.

    What to observe: Follow the rod and signed motor demand.
  2. 02

    Find the limit

    Choose Too little force, then raise the force limit.

    What to observe: Look for separation between requested and delivered actuation.
  3. 03

    Audit the energy

    Go to the end and export the record. Compare standard and fine integration.

    What to observe: Mechanical energy change follows signed motor work.

Primary theory: MIT · Cart-Pole · ETH Zürich · 1D reaction-wheel model, Section II

FeedbackSomething broken, confusing, or missing on this page?Tell us
What kind of feedback?

Sent with this page’s address, its Lab ID, the site language and your device type. Please leave out personal details. Feedback is kept for up to 12 months.Privacy policy