pid-rs icon indicating copy to clipboard operation
pid-rs copied to clipboard

Add support for variable time deltas

Open mtilda opened this issue 8 months ago • 3 comments

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.

mtilda avatar Mar 27 '25 15:03 mtilda

Checkout https://github.com/mtilda/pid-rs/pull/2 to see how we might add a feature flag.

mtilda avatar Mar 27 '25 17:03 mtilda

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?

braincore avatar Mar 27 '25 20:03 braincore

This would be a super-nice addition to the crate! Hoping this can be merged soon, thanks for your work!

michael-p avatar Apr 25 '25 11:04 michael-p