This microcontroller is a PID controller featuring clamps (P, I, D and Output) with adaptive gains.
[b] Designed for systems requiring robust stability across varying operating conditions,
while remaining flexible for any application.
It can operate as a standard parallel PID by disabling the adaptive system. [/b]
[hr]
Disabling adaptive gains
To disable adaptive gains set the following properties under [b] CLAMPS [/b] to 0:
[list]
[*] [b] KpAMin [/b], [b] KpAMax [/b],
[*] [b] KiAMin [/b], [b] KiAMax [/b],
[*] [b] KdAMin [/b], [b] KdAMax [/b].
[/list]
You may also set the properties below [b] ADAPT_GAINS [/b] and [b] ADAPT_REFS [/b] to 0 but clamping the adaptive gains is sufficient.
[hr]
Timing & adaptation
You can configure how often the PID updates under [b] PID_TIMING [/b].
[list]
[*] [b] Cycles /s = 60 [/b] → PID updates 60 times per second
(assuming your game runs at 60 ticks per second)
[*] [b] Adapt every [x] cycle = 60 [/b] → adaptive gains update every 60 PID cycles
(≈ once per second if [b] Cycles /s = 60 [/b])
[/list]
⚠ Setting [b] Adapt every [x] cycle [/b] too low may lead to inaccurate or ineffective adaptation, as the PID requires data to evaluate system behavior.
[hr]
Additional features
[list]
[*] Output and error offsets are supported.
[*] You may choose whether the Integral term uses the raw error or the offset error.
[*] The [b] Tau [/b] property under [b] BASE_GAINS [/b] is expressed in cycles and controls the Derivative low-pass filter.
[*] Set [b] Tau = 0 [/b] to disable filtering and use the raw Derivative.
[*] Debug visibility can be controlled via the [b] Tooltips/Debug [/b] property.
[*] Composite output for external display, logging and debugging.
[/list]
[hr]
Limitations
[list]
[*] This Dynamic PID does not support Manual-Auto switching.
A separate version will be released with this feature using composite or additional nodes.
[*] ⚠ Negative gains are not supported.
Base gains and adaptive offsets are internally clamped to prevent instability.
If your system requires inverted logic control, invert the PID output externally
(using an Invert block, [b] f(x) = -x [/b] or [b] f(x) = 1-x [/b] depending on your system).
[/list]
[hr]
License
Permission granted to use in your creation. Credit is required where reasonable.
Claiming this code as your own is not permitted.
Reposting this microcontroller as a standalone item is not permitted.
Updated: 2026-01-24
Contact
Steam: TheRandomGuy228
Discord: p0paul