Try it
- Predict what happens when gravity acts without feedforward.
- Run the default response; add 2 N of feedforward. Compare the final error.
- Challenge: use the windup preset, then enable anti-windup and compare the overshoot after the output leaves saturation.
This idealized vertical mechanism has mass 1 kg, linear drag 1 N·s/m and a constant 2 N downward gravity force. The controller runs every 0.02 s, followed by semi-implicit Euler integration. There are no travel stops, motor dynamics, friction, noise, or sensor delay. Values are not hardware tuning recommendations.
Controls
Changing a control resets the run. Space activates the focused button. The simulation pauses when this tab is hidden and starts paused if reduced motion is preferred. Use Run to start it.
Response
Blue: position; dashed black: setpoint; orange: output.
| Time (s) | Position (m) | Setpoint (m) | Output (N) |
|---|
Model and interpretation
error = setpoint − position;
integral += error × dt;
derivative = (error − previous error) / dt. Requested
force is
kP × error + kI × integral + kD × derivative + feedforward, clipped to the output limit. Conditional anti-windup stops
integration when error would push farther into saturation. The first
derivative is zero. A setpoint step may produce a derivative kick.
Overshoot is the maximum excursion beyond the setpoint in the direction of the initial step. Settling is reported only after the position remains within ±0.05 m for a full second, and can be lost later. Saturation time counts controller samples at the output limit.