arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
PIDController Class Reference

A simple header only PID Controller. More...

#include <PIDController.h>

Public Member Functions

bool begin (float dt, float max, float min, float kp, float ki, float kd)
 
float calculate (float target, float measured)
 
void reset ()
 
void setDt (float dt)
 

Protected Attributes

float dt = 1.0f
 
float integral = 0.0f
 
float kd = 0.0f
 
float ki = 0.0f
 
float kp = 0.0f
 
float max = 0.0f
 
float min = 0.0f
 
float preerror = 0.0f
 

Detailed Description

A simple header only PID Controller.

Author
Phil Schatzmann

Member Function Documentation

◆ begin()

bool begin ( float  dt,
float  max,
float  min,
float  kp,
float  ki,
float  kd 
)
inline

◆ calculate()

float calculate ( float  target,
float  measured 
)
inline

◆ reset()

void reset ( )
inline

Clears the accumulated integral and derivative history without changing the configured dt/max/min/gains. Call this when the controlled process is reset/restarted so old error history doesn't leak into the new session.

◆ setDt()

void setDt ( float  dt)
inline

Overrides the loop interval time used by the next calculate() call. Useful when the actual elapsed time between calls varies at runtime.

Member Data Documentation

◆ dt

float dt = 1.0f
protected

◆ integral

float integral = 0.0f
protected

◆ kd

float kd = 0.0f
protected

◆ ki

float ki = 0.0f
protected

◆ kp

float kp = 0.0f
protected

◆ max

float max = 0.0f
protected

◆ min

float min = 0.0f
protected

◆ preerror

float preerror = 0.0f
protected

The documentation for this class was generated from the following file: