To properly integrate and derivate, the PID needs to know dt.
If the PID updates are irregular, the only way to obtain correct values is to modify ki and kd on every iteration, which is clunky.
This is not really a problem if the pid updates are run regularly, because you can bake dt in ki and kd. But even then it's annoying because you have to modify ki and kd every time you modify your regulation interval.
Of course, we don't want to break the current interface, but we could introduce something like pid.next_control_output_with_dt(measurement, dt)...
And pid.next_control_output(measurement) would become a thin wrapper with dt = 1
To properly integrate and derivate, the PID needs to know
dt.If the PID updates are irregular, the only way to obtain correct values is to modify
kiandkdon every iteration, which is clunky.This is not really a problem if the pid updates are run regularly, because you can bake
dtinkiandkd. But even then it's annoying because you have to modifykiandkdevery time you modify your regulation interval.Of course, we don't want to break the current interface, but we could introduce something like
pid.next_control_output_with_dt(measurement, dt)...And
pid.next_control_output(measurement)would become a thin wrapper withdt = 1