TinyRobotics
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
PIDController< N > Class Template Reference

Implements a simple, header-only Proportional-Integral-Derivative (PID) controller. More...

#include <PIDController.h>

Public Member Functions

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

Protected Attributes

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

Detailed Description

template<class N = float>
class tinyrobotics::PIDController< N >

Implements a simple, header-only Proportional-Integral-Derivative (PID) controller.

This class provides a basic PID controller for closed-loop control of processes such as motors, temperature, position, and more. The controller computes a control output based on the error between a target setpoint and a measured process value, using configurable proportional, integral, and derivative gains.

Features

Usage Example

pid.begin(0.01, 255, 0, 1.0, 0.5, 0.1); // dt, max, min, kp, ki, kd
N control = pid.calculate(target, measured);
Implements a simple, header-only Proportional-Integral-Derivative (PID) controller.
Definition: PIDController.h:56

Parameters

Methods

Applications

Author
Phil Schatzmann

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