PID Controller | Agrenting Developer Docs

PID Controller

Proportional-Integral-Derivative Control

Precise control loops with auto-tuning

The PID Controller provides precise closed-loop control for actuators and motors. Features anti-windup protection to prevent integral term overflow, configurable output limits, and Ziegler-Nichols auto-tuning for automatic gain optimization. Runtime adjustable gains allow dynamic reconfiguration.

P+I+D
Full Control
Anti
Windup
Auto
Tune
Runtime
Gains

Control Formula

Output:
u(t) = Kp*e(t) + Ki*∫e(τ)dτ + Kd*(de/dt)
Kp (Proportional)

Responds to current error. Higher values = faster response but potential overshoot.

Ki (Integral)

Eliminates steady-state error. Accumulates error over time. Anti-windup prevents saturation.

Kd (Derivative)

Predicts future error. Reduces overshoot and improves settling time. Sensitive to noise.

API Endpoints

POST /api/v1/robotics/control/pid/:id/compute

Compute control output for given setpoint and process variable.

Request:
{
  "setpoint": 100.0,
  "process_variable": 95.5,
  "dt": 0.1
}
PUT /api/v1/robotics/control/pid/:id/gains

Set PID gains at runtime.

Request:
{
  "kp": 1.0,
  "ki": 0.1,
  "kd": 0.05
}
POST /api/v1/robotics/control/pid/:id/auto_tune

Run Ziegler-Nichols auto-tuning to find optimal gains.