WEBVTT

00:00:00.000 --> 00:00:05.760
Proportional control multiplies error by kP.
Let's follow one update from target to output.

00:00:05.760 --> 00:00:10.440
Watch the correction shrink
as the measurement approaches the target.

00:00:10.440 --> 00:00:16.260
The target is 1,000 ticks,
and the measurement is 600 ticks.

00:00:16.260 --> 00:00:20.220
Target minus measurement gives us
an error of 400 ticks.

00:00:20.220 --> 00:00:28.380
For this calculation, kP is 0.0005,
so the raw output is 0.2.

00:00:28.380 --> 00:00:38.520
Keep the units and sign visible. If the target is
above the measurement, the correction is positive.

00:00:38.520 --> 00:00:44.220
This gain is only sample data.
It is not a value to put on your robot.

00:00:44.220 --> 00:00:53.760
This software fixture performs
the exact sequence once per loop.

00:00:53.760 --> 00:01:02.760
It reads the encoder, calculates target minus
measurement, and multiplies by kP.

00:01:02.760 --> 00:01:09.240
It keeps the output between -0.25 and 0.25,
then writes every stage to telemetry.

00:01:09.300 --> 00:01:18.900
At 600 ticks, the error is 400,
and the output is 0.2.

00:01:18.900 --> 00:01:26.220
At 900 ticks, the error is 100,
and the output is 0.05.

00:01:26.220 --> 00:01:37.860
At 990 ticks, the error is 10,
and the output is 0.005.

00:01:37.860 --> 00:01:44.040
That shrinking correction is
the basic behavior of P control.

00:01:44.040 --> 00:01:54.300
Friction or gravity can leave a small steady error
when the correction becomes too small to move or hold.

00:01:54.540 --> 00:02:05.520
If we calculate measurement minus target,
the same point produces -400 and -0.2.

00:02:05.520 --> 00:02:08.400
The controller pushes away from the target.

00:02:08.400 --> 00:02:15.060
Do not try to tune a sign mistake
with a smaller gain.

00:02:15.060 --> 00:02:23.220
Inspect the target, measurement, coordinate convention,
encoder direction, motor direction, and error equation.

00:02:23.220 --> 00:02:35.400
Once those agree, use a low-power environment and
choose a small gain and output limit just to test.

00:02:36.240 --> 00:02:43.020
Direction errors can be among
the most dangerous things to test.

00:02:43.020 --> 00:02:46.020
Especially with larger mechanisms,
take all the proper precautions.
