---
title: "Cart-Pole Balance Interactive Lab | Sandbox Physics"
description: "Move the base. Catch the fall. Can the motor catch the pole and return the cart?"
canonical_url: "https://sandboxphysics.com/labs/cart-pole-balance/"
language: "en"
page_type: "lab"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/labs/cart-pole-balance/"
last_modified: "2026-10-19"
---

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 simulation: open this page in a web browser to change the parameters and run the model.

Ideal point bob, massless rigid rod and frictionless unlimited rail. Local state feedback with force saturation; no swing-up, impacts, sensor noise or motor electrical model.

Physics tutorial

## Catch the pole, then return the cart

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

**Why it matters** Follow 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)\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

$$
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=\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 misconception** Turning feedback on guarantees recovery from every release.

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

#### A stable pole still needs base control

**Typical misconception** Angle feedback alone returns the cart to its start.

**Better mental model** The 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.

Physical conclusion

A local stabilizing law needs sufficient actuator authority. A saturated actuator cannot deliver an ideal control command.

Primary theory: [MIT · Cart-Pole](https://underactuated.mit.edu/acrobot.html) · [ETH Zürich · 1D reaction-wheel model, Section II](https://idsc.ethz.ch/content/dam/ethz/special-interest/mavt/dynamic-systems-n-control/idsc-dam/Research_DAndrea/Cubli/cubliCDC13.pdf)

Motion & dynamics · Starter path

## From a falling ball to an orbit

Measure gravity, split motion into components, add contact forces and collisions, then carry the same laws into orbit.

[Start here → **Free Fall & Measuring Gravity** Capture a few drops and fit the camera positions to estimate gravitational acceleration. Then add air damping and watch the fit drift from the truth. Observe · 14 min](https://sandboxphysics.com/labs/free-fall/)

1. [1 Free Fall & Measuring Gravity](https://sandboxphysics.com/labs/free-fall/)
2. [2 Projectile Flight Designer](https://sandboxphysics.com/labs/projectile-flight/)
3. [3 Inclined Plane & Friction](https://sandboxphysics.com/labs/inclined-plane/)
4. [4 One-Dimensional Collision Bench](https://sandboxphysics.com/labs/collision-bench/)
5. [5 Mass–Spring Oscillator](https://sandboxphysics.com/labs/mass-spring/)
6. [6 How Orbits Take Shape](https://sandboxphysics.com/labs/orbit/)

[View the full path →](https://sandboxphysics.com/topics/mechanics/#starter-path)
