Control Algorithms
Take over the motors. Hold a joint against gravity with PID, cancel the arm's dynamics with computed torque, then balance a cart-pole with LQR and move it within its limits with MPC.
Start the lesson0/4 steps done
What you'll learn
- PID with anti-windup
- Computed-torque control
- LQR by Riccati iteration
- Model predictive control with input limits
Before you start
You should be comfortable with basic Python: variables, loops and functions. We'll introduce the robotics and the maths as you go. The first visit downloads the physics engine and Python, about 20 MB, and later visits load from your browser's cache.
Steps
- 1PID controlHold a torque-driven shoulder on target against gravity with P, I and D terms, and keep the integral from winding up.PIDIntegral windupTorque controlOpen
- 2Computed-torque controlCancel the arm's dynamics with its own model, so a fast sweep tracks to a fraction of a degree while PD lags by degrees.Inverse dynamicsFeed-forwardFeedback linearizationPro
- 3LQRIterate the Riccati equation to the optimal feedback gain, then balance a cart-pole with it.Riccati equationOptimal controlState and effort weightsPro
- 4Model predictive controlPlan the next 0.4 s with the motor's limit built in, apply the first push, and plan again: the cart moves 15 cm with a 0.8 N motor where LQR crashes.Receding horizonCondensed QPProjected gradientPro