Add support for variable time deltas
Changes
-
We add a new method
Pid::next_control_output_with_dt()which handles a variable time delta (dt). -
The new method is called internally by
Pid::next_control_output().
To do
- [ ] Update documentation: https://github.com/braincore/pid-rs/blob/55f0ee233ed50eb5d35ff442344d229ae3e6d19b/README.md?plain=1#L73
- [ ] Add test cases that use non-one values of
dt.
Checkout https://github.com/mtilda/pid-rs/pull/2 to see how we might add a feature flag.
I agree with not breaking the existing signature for next_control_output. However, https://github.com/mtilda/pid-rs/pull/2 seems overkill. Having a fn signature change as a result of a crate feature should be reserved for extraordinary cases.
How about you rename your new function to:
next_control_output_with_dt(&mut self, measurement: T, dt: T)
And it can simply coexist?
This would be a super-nice addition to the crate! Hoping this can be merged soon, thanks for your work!