Skip to content

Class Pid

ClassList > Pid

Pid in a standard form taking into account saturation.More...

  • #include <pid.h>

Inherits the following classes: Controller

Public Functions

Type Name
Pid ()
virtual void calculate (void) override
calculate a new command value according to a reference fixed using setReference method and a measuremnt fixed usingsetMeasurement .
virtual int8_t init (PidParams params) override
initialize the standard pid
virtual void reset () override
reset internal states and the last command of the controller.
void reset (float32_t output)

Public Functions inherited from Controller

See Controller

Type Name
virtual void calculate (void) = 0
calculate a new command value according to a reference fixed using setReference method and a measuremnt fixed usingsetMeasurement .
virtual outputs_T calculateWithReturn (refs_T yref, meas_T y)
calculate a new command value according the argument values
virtual outputs_T getOutput ()
retrieve the last command value calculated.
virtual int8_t init (params_T parameters) = 0
initialize the controller.
virtual void reset (void) = 0
reset internal states and the last command of the controller.
virtual outputs_T saturate (outputs_T u)
limit the argument u betweenupper_bound andlower_bound it is called by thecalculate method.
virtual void setMeasurement (meas_T measure)
capture a new measurement.
virtual void setReference (refs_T reference)
capture a new reference.

Protected Attributes inherited from Controller

See Controller

Type Name
float32_t _Ts
outputs_T _lower_bound
meas_T _measure
outputs_T _output
refs_T _reference
outputs_T _upper_bound

Detailed Description

out = Kp * (error + 1 / Ti * error / s + 1 / (1 + Td / N * s) * Td * s * error )

It uses backward euler integration method.

Example of use:

Pid mypid; PidParams params(Ts, Kp, Ti, Td, N, lower_bound, upper_bound); mypid.init(params); mypid.setMeasurement(y); mypid.setReference(yref); mypid.calculate(); mypid.getOutput();

Public Functions Documentation

function Pid

inline Pid::Pid () 

function calculate

calculate a new command value according to a reference fixed using setReference method and a measuremnt fixed usingsetMeasurement .

virtual void Pid::calculate (
    void
) override

The new command value can be captured using the get_output method.

Implements Controller::calculate


function init

initialize the standard pid

virtual int8_t Pid::init (
    PidParams params
) override

Parameters:

  • params is a PidParams structure with all the parameters of the Pid.

Returns:

0 if ok else -EINVAL

Implements Controller::init


function reset [1/2]

virtual void Pid::reset () override

Implements Controller::reset


function reset [2/2]

void Pid::reset (
    float32_t output
) 


The documentation for this class was generated from the following file docs/controlLibrary/src/pid.h