PID control in real robots
CS
480: Robotics & 3D Printing Lecture, Dr. Lawlor
PID controllers have 3 gain factors:
- Kp: Proportional gain responds to the current error value.
- Ki: Integral gain responds to the history of recent
errors. This is useful to automatically correct for small
systematic biases in the control response, such as a mismatched
center of gravity. Ki=Kp/Ti (or Ti=Kp/Ki) for an
"integration time" of Ti.
- Kd: Derivative gain responds to the slope of recent
errors. It is used to stabilize the system against
overshoot, which is especially common in systems with some
inertia. Kd=Kp*Td for a "rate time" of Td.
The ardupilot user
interface actually has a graphical user
interface entry for tuning PID parameters.
If you open pronterface, you can manually interact with the
printer firmware via direct gcode commands. Most printer
firmware supports modifying PID settings.
The M301
command will show the PID parameters for the hotend.
The
M303
command will automatically tune PID for the hotend. This
can improve heat-up time, and temperature consistency. The
code for this is in Marlin/temperature.cpp:PID_autotune,
the underlying
math is here, but the
basic idea is to run an experiment to compute the time
period for the system's oscillations, Tu, and the maximum stable
proportional gain Ku, from which we can calculate the Kp, Ki,
and Kd parameters.
The M503 command
can report your printer's current motion control settings.
Stepper motor motion control is "open loop", meaning there is no
feedback error command for PID, but the velocity, acceleration, and
jerk limitations are similar to a second-order PIDD scheme.