SimpleFOClibrary 2.4.0
Loading...
Searching...
No Matches
PIDController Class Reference

#include <pid.h>

Public Member Functions

 PIDController (float P, float I, float D, float ramp=NOT_SET, float limit=NOT_SET, float sampling_time=NOT_SET)
 
 ~PIDController ()=default
 
float operator() (float error)
 
void reset ()
 

Public Attributes

float P
 Proportional gain.
 
float I
 Integral gain.
 
float D
 Derivative gain.
 
float output_ramp
 Maximum speed of change of the output value.
 
float limit
 Maximum output value.
 
float Ts
 Fixed sampling time (optional default NOT_SET)
 

Protected Attributes

float error_prev
 last tracking error value
 
float output_prev
 last pid output value
 
float integral_prev
 last integral component value
 
unsigned long timestamp_prev
 Last execution timestamp.
 

Detailed Description

PID controller class

Definition at line 11 of file pid.h.

Constructor & Destructor Documentation

◆ PIDController()

PIDController::PIDController ( float  P,
float  I,
float  D,
float  ramp = NOT_SET,
float  limit = NOT_SET,
float  sampling_time = NOT_SET 
)
Parameters
P- Proportional gain
I- Integral gain
D- Derivative gain
ramp- Maximum speed of change of the output value
limit- Maximum output value
sampling_time- sampling time
Note
If sampling time is not set the filter will measure the elapsed time between each call. If yes it will consider it fixed.
Sampling time can be changed dynamically as well by modifying the variable Ts in runtime.

Definition at line 3 of file pid.cpp.

Here is the call graph for this function:

◆ ~PIDController()

PIDController::~PIDController ( )
default

Member Function Documentation

◆ operator()()

Definition at line 18 of file pid.cpp.

Here is the call graph for this function:

◆ reset()

void PIDController::reset ( )

Definition at line 66 of file pid.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ D

float PIDController::D

Derivative gain.

Definition at line 36 of file pid.h.

◆ error_prev

float PIDController::error_prev
protected

last tracking error value

Definition at line 42 of file pid.h.

◆ I

float PIDController::I

Integral gain.

Definition at line 35 of file pid.h.

◆ integral_prev

float PIDController::integral_prev
protected

last integral component value

Definition at line 44 of file pid.h.

◆ limit

float PIDController::limit

Maximum output value.

Definition at line 38 of file pid.h.

◆ output_prev

float PIDController::output_prev
protected

last pid output value

Definition at line 43 of file pid.h.

◆ output_ramp

float PIDController::output_ramp

Maximum speed of change of the output value.

Definition at line 37 of file pid.h.

◆ P

float PIDController::P

Proportional gain.

Definition at line 34 of file pid.h.

◆ timestamp_prev

unsigned long PIDController::timestamp_prev
protected

Last execution timestamp.

Definition at line 45 of file pid.h.

◆ Ts

float PIDController::Ts

Fixed sampling time (optional default NOT_SET)

Definition at line 39 of file pid.h.


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