-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose integral to enable user-space hacking #133
base: master
Are you sure you want to change the base?
Conversation
Here's an easier-to-fiddle with simulation example: https://wokwi.com/projects/359088752027305985 The Auto/Manual, Minus/Plus and "Manual/Output=0/Auto" trick controls used in this simulation are all available with the stock PID_v1 code. This sim only adds exposing the outputSum internal variable to the UI.
|
Here's an example of using user-space hacking to implement conditional integration: https://wokwi.com/projects/362722038135838721 The key bit of code is:
|
Based on the discussion in #132 (comment)
I realized that a low impact way of handling the issues would be to just move some features out of the black box.
Moving the
PID::Initialize()
function out to public makes theSetMode(MANUAL);Output=value;SetMode(MANUAL);
trick easier to discuss and handle.Moving the
PID::outputSum
variable from private to public makes it possible to examine (or hack on) the internal integrator state.Since these functions already exist, it should be a no-cost change and enables easy understanding of what the algorithm does and easy adaptation to special uses.
A live example:
https://wokwi.com/projects/358190033668210689
This minimal-impact change would obviate #132