kevinferron.comKevin Ferron

Tuning a PID

A step response you tune with Kp, Ki and Kd, with overshoot and settling time read off the plot, torque saturation to show windup, and a preset with the gains and torque limit of Asimov’s knee in simulation.

  • PID
  • Step response
  • Windup
  • Asimov knee
target 0.5 rad, ±2% band0 s1 s2 s3 s00.7angle, rad33torque, N·m
  • joint angle
  • torque applied
  • integral term's share of it
  • closed-form response

The joint is made up: inertia 0.1 kg·m², friction 0.5 N·m·s/rad. It is sampled every 0.5 ms with derivative on the measurement.

Illustrative gains on the made-up joint.

Overshoot
4.0 %
Settling time (2%)
0.24 s
Rise time (10 to 90%)
0.09 s
Steady-state error
0.000 rad
Peak torque
30.0 N·m

With no integral, limit, load or noise this is a second-order loop: damping ratio ζ = 0.71, natural frequency 24.5 rad/s, predicted overshoot 4.0 %.

A PID controller drives a joint to a target by feeding back its error. The proportional term pushes in proportion to how far off it is. The derivative term resists how fast it is moving. The integral term adds up the error over time, so a steady push from a load, like gravity on a held joint, is cancelled instead of leaving a gap.

The plant here is a rotor with inertia and friction, sampled every half a millisecond, with derivative taken on the measurement so a step in the target does not kick the output. Without the integral term, load or limits it is almost exactly a second-order system, and the simulation is held to its closed-form response. Its inertia, friction, load and the size of the step are made up, so the response is a shape, not a measurement of any real joint.

Turn on the torque limit and give it some integral gain. The output saturates while the error is still large, the integral keeps adding up anyway, and when the joint arrives the stored integral drives it past the target. That is windup; the plot shows the integral’s share of the torque. Sensor noise shows the other trap: the derivative term amplifies it.

It matters beyond the textbook because almost every learned policy still outputs targets for a PD loop. Asimov’s walking policy emits 23 joint-position offsets, scaled by 0.25 around a default pose, and per-joint PD gains track them: stiffness 150 on the hips and knees, damping capped at 5, under torque limits.

The “Asimov knee” preset loads Kp 150 and Kd 5 with a 45 N·m torque limit, the simulation values from the policy’s contract. The inertia, friction and load stay the page’s illustrative ones, so it shows what those gains and that limit do to a joint like this, not how Asimov’s knee moves.

Exercise

Tune, saturate, then go beyond PID.

  1. Tune a PID on a simulated pendulum until it reaches a step without ringing.
  2. Add a torque limit and watch the integral wind up.
  3. Then run an LQR on a cart-pole.

Sources

  1. Modern Robotics Modern Robotics: Mechanics, Planning, and Control (K. M. Lynch, F. C. Park; Cambridge University Press). 2017; updated first edition Dec 2019; free preprint PDF, print paid; read 2026-10-22.

    • Chapters 8 and 11: dynamics and robot control
    • Chapter 11: robot control (the source the outline lists for PID, windup and derivative noise)
    • Chapters 8 and 11
  2. Policy contract public/policy/model_aug_18_1/contract.json (Menlo Research, repackaged; BSD-3-Clause). read 2026-10-22.

    • Action scale 0.25, 23 actions, PD gains
    • Stiffness 150, damping 5, torque limit 45 N·m (simulation values)
    • timing, observation, action and gain blocks
  3. Workshop discrepancies Asimov Workshop docs/DISCREPANCIES.md (entries S1-S9, J1-J5, G1-G6, A1-A7, H1-H2). read 2026-10-22.

    • S9: the PD gains under the policy
    • S9: PD gains under the policy
  4. Underactuated Robotics Underactuated Robotics, course notes (R. Tedrake, MIT). free online, © 2024; read 2026-10-22.

    • Chapters 2 and 3 and 8: pendulum, cart-pole and LQR
  5. ros2_control ros2_control getting started (Apache-2.0). read 2026-10-22.

    • ros2_control, for the real loop

Everything here is paraphrased from the sources, not quoted, and every figure is attributed to one. Prices are as of the date read and change. Anything illustrative is labelled as such. Where a source is silent, or could not be checked, the page leaves the fact out.