YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
yarp::dev::Pid Class Reference

Contains the parameters for a PID. More...

#include <yarp/dev/ControlBoardPid.h>

+ Inheritance diagram for yarp::dev::Pid:

Public Member Functions

 Pid ()
 Default Constructor.
 
 ~Pid ()
 Destructor.
 
 Pid (double kp, double kd, double ki, double int_max, double scale, double out_max)
 Basic constructor.
 
 Pid (double kp, double kd, double ki, double int_max, double scale, double out_max, double st_up, double st_down, double kff)
 Advanced constructor.
 
void setKp (double p)
 Set proportional gain.
 
void setKi (double i)
 Set integrative gain.
 
void setKd (double d)
 Set derivative gain.
 
void setMaxInt (double m)
 Set max threshold for the integrative part.
 
void setScale (double sc)
 Set output scale for the pid.
 
void setMaxOut (double m)
 Set max output value for the pid.
 
void setOffset (double o)
 Set offset value for the pid.
 
void setStictionValues (double up_value, double down_value)
 Set the two stiction values for the pid.
 
void setKff (double Kff)
 Set the feedforward gain for the pid.
 
bool operator== (const yarp::dev::Pid &p) const
 return true if all params are equal
 
void clear ()
 Set all pid parameters to zero.
 
- Public Member Functions inherited from yarp::dev::PidGainsData
 PidGainsData ()=default
 
 PidGainsData (const double kp, const double kd, const double ki, const double max_int, const double scale, const double max_output, const double offset, const double stiction_up_val, const double stiction_down_val, const double kff)
 
bool read (yarp::os::idl::WireReader &reader) override
 
bool read (yarp::os::ConnectionReader &connection) override
 Read this object from a network connection.
 
bool write (const yarp::os::idl::WireWriter &writer) const override
 
bool write (yarp::os::ConnectionWriter &connection) const override
 Write this object to a network connection.
 
std::string toString () const
 
- Public Member Functions inherited from yarp::os::idl::WirePortable
virtual bool readBare (yarp::os::ConnectionReader &reader)
 
virtual bool writeBare (yarp::os::ConnectionWriter &writer) const
 
virtual bool readBottle (yarp::os::ConnectionReader &reader)
 
virtual bool writeBottle (yarp::os::ConnectionWriter &writer) const
 
- Public Member Functions inherited from yarp::os::Portable
virtual Type getType () const
 
- Public Member Functions inherited from yarp::os::PortReader
virtual ~PortReader ()
 Destructor.
 
virtual Type getReadType () const
 
- Public Member Functions inherited from yarp::os::PortWriter
virtual ~PortWriter ()
 Destructor.
 
virtual void onCompletion () const
 This is called when the port has finished all writing operations.
 
virtual void onCommencement () const
 This is called when the port is about to begin writing operations.
 
virtual yarp::os::Type getWriteType () const
 

Additional Inherited Members

- Public Types inherited from yarp::dev::PidGainsData
typedef yarp::os::idl::Unwrapped< PidGainsData > unwrapped
 
- Static Public Member Functions inherited from yarp::os::Portable
static bool copyPortable (const PortWriter &writer, PortReader &reader)
 Copy one portable to another, via writing and reading.
 
- Public Attributes inherited from yarp::dev::PidGainsData
double kp {0.0}
 proportional gain
 
double kd {0.0}
 derivative gain
 
double ki {0.0}
 integrative gain
 
double max_int {0.0}
 saturation threshold for the integrator
 
double scale {0.0}
 scale for the pid output
 
double max_output {0.0}
 max output
 
double offset {0.0}
 pwm offset added to the pid output
 
double stiction_up_val {0.0}
 up stiction offset added to the pid output
 
double stiction_down_val {0.0}
 down stiction offset added to the pid output
 
double kff {0.0}
 feedforward gain
 

Detailed Description

Contains the parameters for a PID.

Definition at line 30 of file ControlBoardPid.h.

Constructor & Destructor Documentation

◆ Pid() [1/3]

Pid::Pid ( )

Default Constructor.

Definition at line 23 of file ControlBoardPid.cpp.

◆ ~Pid()

Pid::~Pid ( )
default

Destructor.

◆ Pid() [2/3]

Pid::Pid ( double  kp,
double  kd,
double  ki,
double  int_max,
double  scale,
double  out_max 
)

Basic constructor.

Parameters
kpproportional gain
kdderivative gain
kiintegrative gain
int_maxintegrator max output
scalescaling factor
out_maxcap on output

Definition at line 11 of file ControlBoardPid.cpp.

◆ Pid() [3/3]

Pid::Pid ( double  kp,
double  kd,
double  ki,
double  int_max,
double  scale,
double  out_max,
double  st_up,
double  st_down,
double  kff 
)

Advanced constructor.

Parameters
kpproportional gain
kdderivative gain
kiintegrative gain
int_maxintegrator max output
scalescaling factor
out_maxcap on output
st_upup stiction offset
st_downdown stiction offset
kfffeedforward gain

Definition at line 16 of file ControlBoardPid.cpp.

Member Function Documentation

◆ clear()

void Pid::clear ( )

Set all pid parameters to zero.

Definition at line 28 of file ControlBoardPid.cpp.

◆ operator==()

bool Pid::operator== ( const yarp::dev::Pid &  p) const

return true if all params are equal

Parameters
ppid to be compared

Definition at line 88 of file ControlBoardPid.cpp.

◆ setKd()

void Pid::setKd ( double  d)

Set derivative gain.

Parameters
dnew gain

Definition at line 52 of file ControlBoardPid.cpp.

◆ setKff()

void Pid::setKff ( double  Kff)

Set the feedforward gain for the pid.

Parameters
Kffnew gain

Definition at line 83 of file ControlBoardPid.cpp.

◆ setKi()

void Pid::setKi ( double  i)

Set integrative gain.

Parameters
inew gain

Definition at line 47 of file ControlBoardPid.cpp.

◆ setKp()

void Pid::setKp ( double  p)

Set proportional gain.

Parameters
pnew gain

Definition at line 42 of file ControlBoardPid.cpp.

◆ setMaxInt()

void Pid::setMaxInt ( double  m)

Set max threshold for the integrative part.

Parameters
mnew max

Definition at line 57 of file ControlBoardPid.cpp.

◆ setMaxOut()

void Pid::setMaxOut ( double  m)

Set max output value for the pid.

Parameters
mnew value

Definition at line 67 of file ControlBoardPid.cpp.

◆ setOffset()

void Pid::setOffset ( double  o)

Set offset value for the pid.

Parameters
onew offset value

Definition at line 72 of file ControlBoardPid.cpp.

◆ setScale()

void Pid::setScale ( double  sc)

Set output scale for the pid.

Parameters
scscale value

Definition at line 62 of file ControlBoardPid.cpp.

◆ setStictionValues()

void Pid::setStictionValues ( double  up_value,
double  down_value 
)

Set the two stiction values for the pid.

Parameters
up_valuethe new up value
down_valuethe new down value

Definition at line 77 of file ControlBoardPid.cpp.


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