pid-go
pid-go copied to clipboard
Ignore NaN and Inf Values in PID controler Inputs
Description
This merge request introduces checks to handle NaN and Inf values in the ControllerInput struct given in the update function. If either the ReferenceSignal or ActualSignal contains invalid NaN or Inf values, the update process will safely terminate without affecting the controller's state. It ensure that invalid inputs do not propagate through the system.
More question about your module
- Is there a specific reason why you fill
SamplingIntervalexternally instead of calculating it as an internal variable? Are you using it with an external time source? - I think it might be beneficial to define a Timeout in the controller : If the time since the last update exceeds the Timeout, the controller would skip adding the Integral term. Would you be interested in this? If so, I can create a pr.