|
libstp
Robotics library for Botball
|
Closed unity-feedback loop: controller in series with plant. Port of ControlLoop.ts. More...
#include <control_loop.hpp>
Public Member Functions | |
| ControlLoop (ControlElement &controller, ControlElement &controlPath) | |
| double | u () const |
| double | yMin () const |
| double | yMax () const |
| double | amplitude () const |
| std::string | getType () const override |
| Short type tag, e.g. "P", "PT1", "ControlLoop". | |
| double | getLowestTimeConstant () const override |
| Lowest time constant of the element, or -1 if it has none. | |
| void | initialize (double dt) override |
Reset internal state for a simulation run at sample time dt. | |
| double | calculate (double w, double dt) override |
Advance one sample: feed input u, return output. | |
| int | optimizeGetNumParameters () const override |
| Number of tunable parameters this element consumes. | |
| void | optimizeSetParameters (const std::vector< double > ¶ms, int startIdx) override |
Load parameters from params starting at startIdx. | |
| Public Member Functions inherited from libstp::autotune::control::ControlElement | |
| virtual | ~ControlElement ()=default |
Closed unity-feedback loop: controller in series with plant. Port of ControlLoop.ts.
Each step computes error e = w - y_prev, drives it through the controller to get the manipulated variable u, then through the plant to get the output y. Tracks the most recent local min/max of y (yMin/yMax) for amplitude/overshoot analysis. Does NOT own the controller/plant — they are borrowed references, matching the TypeScript constructor semantics.
Definition at line 21 of file control_loop.hpp.
| libstp::autotune::control::ControlLoop::ControlLoop | ( | ControlElement & | controller, |
| ControlElement & | controlPath ) |
|
inlinenodiscard |
Definition at line 29 of file control_loop.hpp.
|
overridevirtual |
Advance one sample: feed input u, return output.
Implements libstp::autotune::control::ControlElement.
|
nodiscardoverridevirtual |
Lowest time constant of the element, or -1 if it has none.
Implements libstp::autotune::control::ControlElement.
|
inlinenodiscardoverridevirtual |
Short type tag, e.g. "P", "PT1", "ControlLoop".
Implements libstp::autotune::control::ControlElement.
Definition at line 31 of file control_loop.hpp.
|
overridevirtual |
Reset internal state for a simulation run at sample time dt.
Implements libstp::autotune::control::ControlElement.
|
nodiscardoverridevirtual |
Number of tunable parameters this element consumes.
Implements libstp::autotune::control::ControlElement.
|
overridevirtual |
Load parameters from params starting at startIdx.
Implements libstp::autotune::control::ControlElement.
|
inlinenodiscard |
Definition at line 26 of file control_loop.hpp.
|
inlinenodiscard |
Definition at line 28 of file control_loop.hpp.
|
inlinenodiscard |
Definition at line 27 of file control_loop.hpp.