libstp
Robotics library for Botball
Loading...
Searching...
No Matches
libstp::autotune::control::ControlLoop Class Referencefinal

Closed unity-feedback loop: controller in series with plant. Port of ControlLoop.ts. More...

#include <control_loop.hpp>

Inheritance diagram for libstp::autotune::control::ControlLoop:
[legend]
Collaboration diagram for libstp::autotune::control::ControlLoop:
[legend]

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 > &params, int startIdx) override
 Load parameters from params starting at startIdx.
Public Member Functions inherited from libstp::autotune::control::ControlElement
virtual ~ControlElement ()=default

Detailed Description

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.

Constructor & Destructor Documentation

◆ ControlLoop()

libstp::autotune::control::ControlLoop::ControlLoop ( ControlElement & controller,
ControlElement & controlPath )

Member Function Documentation

◆ amplitude()

double libstp::autotune::control::ControlLoop::amplitude ( ) const
inlinenodiscard

Definition at line 29 of file control_loop.hpp.

◆ calculate()

double libstp::autotune::control::ControlLoop::calculate ( double u,
double dt )
overridevirtual

Advance one sample: feed input u, return output.

Implements libstp::autotune::control::ControlElement.

◆ getLowestTimeConstant()

double libstp::autotune::control::ControlLoop::getLowestTimeConstant ( ) const
nodiscardoverridevirtual

Lowest time constant of the element, or -1 if it has none.

Implements libstp::autotune::control::ControlElement.

◆ getType()

std::string libstp::autotune::control::ControlLoop::getType ( ) const
inlinenodiscardoverridevirtual

Short type tag, e.g. "P", "PT1", "ControlLoop".

Implements libstp::autotune::control::ControlElement.

Definition at line 31 of file control_loop.hpp.

◆ initialize()

void libstp::autotune::control::ControlLoop::initialize ( double dt)
overridevirtual

Reset internal state for a simulation run at sample time dt.

Implements libstp::autotune::control::ControlElement.

◆ optimizeGetNumParameters()

int libstp::autotune::control::ControlLoop::optimizeGetNumParameters ( ) const
nodiscardoverridevirtual

Number of tunable parameters this element consumes.

Implements libstp::autotune::control::ControlElement.

◆ optimizeSetParameters()

void libstp::autotune::control::ControlLoop::optimizeSetParameters ( const std::vector< double > & params,
int startIdx )
overridevirtual

Load parameters from params starting at startIdx.

Implements libstp::autotune::control::ControlElement.

◆ u()

double libstp::autotune::control::ControlLoop::u ( ) const
inlinenodiscard

Definition at line 26 of file control_loop.hpp.

◆ yMax()

double libstp::autotune::control::ControlLoop::yMax ( ) const
inlinenodiscard

Definition at line 28 of file control_loop.hpp.

◆ yMin()

double libstp::autotune::control::ControlLoop::yMin ( ) const
inlinenodiscard

Definition at line 27 of file control_loop.hpp.


The documentation for this class was generated from the following file:
  • /home/runner/work/raccoon-lib/raccoon-lib/modules/libstp-autotune/include/autotune/control/control_loop.hpp