iCub-main
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
iCub::ctrl::Integrator Class Reference

A class for defining a saturated integrator based on Tustin formula: $ 1/s => T_s/2*(z+1)/(z-1) $. More...

#include <pids.h>

Public Member Functions

 Integrator (const double _Ts, const yarp::sig::Vector &y0, const yarp::sig::Matrix &_lim)
 Constructor. More...
 
 Integrator (const double _Ts, const yarp::sig::Vector &y0)
 Constructor. More...
 
 Integrator (const Integrator &I)
 Creates a new Integrator from an already existing object. More...
 
Integratoroperator= (const Integrator &I)
 Copies a Integrator object into the current one. More...
 
const yarp::sig::Vector & integrate (const yarp::sig::Vector &x)
 Executes one-step integration of input vector. More...
 
void setSaturation (bool _applySat)
 Sets the saturation status. More...
 
bool getSaturation ()
 Returns the current saturation status. More...
 
void setTs (const double _Ts)
 Sets the sample time. More...
 
void setLim (const yarp::sig::Matrix &_lim)
 Sets the output vector constraints matrix. More...
 
double getTs ()
 Returns the sample time. More...
 
const yarp::sig::Matrix & getLim ()
 Returns the constraints matrix. More...
 
void reset (const yarp::sig::Vector &y0)
 Resets the internal state and sets the output vector to the given value. More...
 
const yarp::sig::Vector & get () const
 Returns the current output vector. More...
 

Protected Member Functions

void allocate (const Integrator &I)
 
yarp::sig::Vector saturate (const yarp::sig::Vector &v)
 

Protected Attributes

unsigned int dim
 
yarp::sig::Vector y
 
yarp::sig::Vector x_old
 
yarp::sig::Matrix lim
 
double Ts
 
bool applySat
 

Detailed Description

A class for defining a saturated integrator based on Tustin formula: $ 1/s => T_s/2*(z+1)/(z-1) $.

Definition at line 47 of file pids.h.

Constructor & Destructor Documentation

◆ Integrator() [1/3]

iCub::ctrl::Integrator::Integrator ( const double  _Ts,
const yarp::sig::Vector &  y0,
const yarp::sig::Matrix &  _lim 
)

Constructor.

Parameters
_Tsis the integrator sample time.
y0is the initial value of the output vector.
_limis a Nx2 matrix describing for each row i the lower (1st column) and the upper limit (2nd column) of the ith component: _lim(i,1)<=output[i]<=_lim(i,2)
Note
The saturation here is on by default

◆ Integrator() [2/3]

iCub::ctrl::Integrator::Integrator ( const double  _Ts,
const yarp::sig::Vector &  y0 
)

Constructor.

Parameters
_Tsis the integrator sample time.
y0is the initial value of the output vector.
Note
The saturation here is off by default.

◆ Integrator() [3/3]

iCub::ctrl::Integrator::Integrator ( const Integrator I)
inline

Creates a new Integrator from an already existing object.

Parameters
Iis the Integrator to be copied.

Definition at line 89 of file pids.h.

Member Function Documentation

◆ allocate()

void Integrator::allocate ( const Integrator I)
protected

Definition at line 56 of file pids.cpp.

◆ get()

const yarp::sig::Vector& iCub::ctrl::Integrator::get ( ) const
inline

Returns the current output vector.

Returns
the current output vector.

Definition at line 154 of file pids.h.

◆ getLim()

const yarp::sig::Matrix& iCub::ctrl::Integrator::getLim ( )
inline

Returns the constraints matrix.

Returns
the constraints matrix.

Definition at line 141 of file pids.h.

◆ getSaturation()

bool iCub::ctrl::Integrator::getSaturation ( )
inline

Returns the current saturation status.

Returns
current saturation status.

Definition at line 117 of file pids.h.

◆ getTs()

double iCub::ctrl::Integrator::getTs ( )
inline

Returns the sample time.

Returns
the sample time.

Definition at line 135 of file pids.h.

◆ integrate()

const Vector & Integrator::integrate ( const yarp::sig::Vector &  x)

Executes one-step integration of input vector.

To be called each Ts seconds.

Parameters
xis the input vector to be integrated.
Returns
the current output vector.

Definition at line 115 of file pids.cpp.

◆ operator=()

Integrator& iCub::ctrl::Integrator::operator= ( const Integrator I)
inline

Copies a Integrator object into the current one.

Parameters
Iis a reference to an object of type Integrator.
Returns
a reference to the current object.

Definition at line 96 of file pids.h.

◆ reset()

void Integrator::reset ( const yarp::sig::Vector &  y0)

Resets the internal state and sets the output vector to the given value.

Parameters
y0is the new value of output vector.

Definition at line 128 of file pids.cpp.

◆ saturate()

Vector Integrator::saturate ( const yarp::sig::Vector &  v)
protected

Definition at line 67 of file pids.cpp.

◆ setLim()

void Integrator::setLim ( const yarp::sig::Matrix &  _lim)

Sets the output vector constraints matrix.

Parameters
_limis the constraints matrix.

Definition at line 104 of file pids.cpp.

◆ setSaturation()

void Integrator::setSaturation ( bool  _applySat)

Sets the saturation status.

Parameters
_applySatif true then the saturation is applied (initialized as true).

Definition at line 87 of file pids.cpp.

◆ setTs()

void Integrator::setTs ( const double  _Ts)

Sets the sample time.

Parameters
_Tsis the sample time.

Definition at line 96 of file pids.cpp.

Member Data Documentation

◆ applySat

bool iCub::ctrl::Integrator::applySat
protected

Definition at line 59 of file pids.h.

◆ dim

unsigned int iCub::ctrl::Integrator::dim
protected

Definition at line 54 of file pids.h.

◆ lim

yarp::sig::Matrix iCub::ctrl::Integrator::lim
protected

Definition at line 57 of file pids.h.

◆ Ts

double iCub::ctrl::Integrator::Ts
protected

Definition at line 58 of file pids.h.

◆ x_old

yarp::sig::Vector iCub::ctrl::Integrator::x_old
protected

Definition at line 56 of file pids.h.

◆ y

yarp::sig::Vector iCub::ctrl::Integrator::y
protected

Definition at line 55 of file pids.h.


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