A controller balancing a pole on a cart: sensor, controller and motor in a closed loop, too little gain that drops the pole, tuning for the shortest settling time, and overshoot that grows when the correction arrives late.
Step 1 of 7 · The loop
Step 1 of 7
The loop
A cart runs on the rail, and on it stands a pole on a hinge, like a broom balanced on your palm. Every five seconds the rig sets the pole upright and gives it a light tap, and a controller has to bring it back upright. Show the feedback is On, so you can see the loop: the encoder on the hinge measures the tilt, the controller works out a push, and the motor moves the cart. The strip chart beside the Scene draws the tilt over time, and the motor’s push.
The controller’s rule is simple: push the cart towards the side the pole leans to, with a force in proportion to the tilt. How many newtons for each degree of tilt is the Controller gain. The controller is a small program running in a loop, a hundred times a second: read the encoder, compute, send a command to the motor.
Step 2 of 7
Too little gain
An upright pole is unstable: the further it leans, the faster gravity tips it. To bring it back, the cart has to accelerate under it. At 1 N/° it manages, and on the strip chart you see the tilt jump at the tap and calm down. Predict what will happen with a much weaker push.
Step 3 of 7
Settling time
Control engineers judge a loop by how quickly it corrects an upset. The settling time is the time from the tap until the tilt stays close to upright, here within 2°. You can see it on the strip chart: the tilt line jumps at the tap, then comes back to zero and calms down.
Change the Controller gain and look for the quickest loop. After each change, wait for the next tap.
Step 4 of 7
Overshoot
As the gain grows, the cart catches the pole sooner, but something else starts to happen: the pole comes back upright and carries on to the other side. That is overshoot. At 1.5 N/°, count on the strip chart how many times the tilt line crosses zero after the tap, and predict.
Step 5 of 7
Delay
Every reading goes through filtering, computing and starting the motor, and reaches the push 50 ms late. At a Controller gain of 2.6 N/°, look at the strip chart: the swings do not die away, and the motor’s push jumps from limit to limit.
The same loop, with the same trade-off between a quick response and overshoot, keeps a room at the temperature it was set to, a car at its cruising speed and a drone level in the wind. Your body runs it too: you stand still only because your muscles correct themselves, many times a second, by what your inner ear and the soles of your feet report.
Step 6 of 7
A small tilt
In each test the cart is a little late: the pole is already tipping by the time it reacts. How far it gets depends on the gain.
Step 7 of 7
Ringing
Between a good controller and one that shakes lies a range where the pole swings a lot, but still settles.
Loading the interactive version…
Loading the interactive version…
Each step sets up the Scene for you, and a control marked “fixed” stays put for that step.
Practice · Choose
What makes the rig a closed loop, rather than a string of pushes planned in advance?
Practice · Choose
What makes the rig a closed loop, rather than a string of pushes planned in advance?
Practice · Predict, then look
At 1 N/° the cart catches the pole after every tap. What will happen after the tap when you slide Controller gain down to 0.2 N/°?
Practice · Predict, then look
At 1 N/° the cart catches the pole after every tap. What will happen after the tap when you slide Controller gain down to 0.2 N/°?
Practice · Reach the target
The settling time is the time from the tap until the tilt stays within 2° of upright. Tune the Controller gain so the pole settles 1.3–1.5 s after the tap, the quickest this rig can manage.
Practice · Reach the target
The settling time is the time from the tap until the tilt stays within 2° of upright. Tune the Controller gain so the pole settles 1.3–1.5 s after the tap, the quickest this rig can manage.
Practice · Predict, then look
At 1.5 N/°, after the tap, the pole swings across upright to the other side a few times before it calms down. What will happen to the number of times when you slide Controller gain up to 1.9 N/°?
Practice · Predict, then look
At 1.5 N/°, after the tap, the pole swings across upright to the other side a few times before it calms down. What will happen to the number of times when you slide Controller gain up to 1.9 N/°?
Practice · Choose
At 2.6 N/° the pole shakes to and fro and never settles, even though the controller pushes hard. Why?
Practice · Choose
At 2.6 N/° the pole shakes to and fro and never settles, even though the controller pushes hard. Why?
Practice · Reach the target
In each test the pole is tapped, and it tips over until the cart catches it. Tune the Controller gain so the pole tips no more than 3° at its farthest, and press Check.
Practice · Reach the target
In each test the pole is tapped, and it tips over until the cart catches it. Tune the Controller gain so the pole tips no more than 3° at its farthest, and press Check.
Practice · Reach the target
At 1 N/° the cart catches the pole and it settles quickly. At 2.6 N/° it shakes and never settles. Find a Controller gain at which it rings: crossing upright back and forth many times, but settling in the end. Press Check.
Practice · Reach the target
At 1 N/° the cart catches the pole and it settles quickly. At 2.6 N/° it shakes and never settles. Find a Controller gain at which it rings: crossing upright back and forth many times, but settling in the end. Press Check.
Lesson complete. Every practice question here is done.
