YARP
Yet Another Robot Platform
yarp::dev::ImplementPidControl Class Reference

#include <yarp/dev/ImplementPidControl.h>

+ Inheritance diagram for yarp::dev::ImplementPidControl:

Public Member Functions

 ImplementPidControl (yarp::dev::IPidControlRaw *y)
 
virtual ~ImplementPidControl ()
 
bool setPid (const PidControlTypeEnum &pidtype, int j, const Pid &pid) override
 Set new pid value for a joint axis. More...
 
bool setPids (const PidControlTypeEnum &pidtype, const Pid *pids) override
 Set new pid value on multiple axes. More...
 
bool setPidReference (const PidControlTypeEnum &pidtype, int j, double ref) override
 Set the controller reference for a given axis. More...
 
bool setPidReferences (const PidControlTypeEnum &pidtype, const double *refs) override
 Set the controller reference, multiple axes. More...
 
bool setPidErrorLimit (const PidControlTypeEnum &pidtype, int j, double limit) override
 Set the error limit for the controller on a specifi joint. More...
 
bool setPidErrorLimits (const PidControlTypeEnum &pidtype, const double *limits) override
 Get the error limit for the controller on all joints. More...
 
bool getPidError (const PidControlTypeEnum &pidtype, int j, double *err) override
 Get the current error for a joint. More...
 
bool getPidErrors (const PidControlTypeEnum &pidtype, double *errs) override
 Get the error of all joints. More...
 
bool getPidOutput (const PidControlTypeEnum &pidtype, int j, double *out) override
 Get the output of the controller (e.g. More...
 
bool getPidOutputs (const PidControlTypeEnum &pidtype, double *outs) override
 Get the output of the controllers (e.g. More...
 
bool getPid (const PidControlTypeEnum &pidtype, int j, Pid *pid) override
 Get current pid value for a specific joint. More...
 
bool getPids (const PidControlTypeEnum &pidtype, Pid *pids) override
 Get current pid value for a specific joint. More...
 
bool getPidReference (const PidControlTypeEnum &pidtype, int j, double *ref) override
 Get the current reference of the pid controller for a specific joint. More...
 
bool getPidReferences (const PidControlTypeEnum &pidtype, double *refs) override
 Get the current reference of all pid controllers. More...
 
bool getPidErrorLimit (const PidControlTypeEnum &pidtype, int j, double *ref) override
 Get the error limit for the controller on a specific joint. More...
 
bool getPidErrorLimits (const PidControlTypeEnum &pidtype, double *refs) override
 Get the error limit for all controllers. More...
 
bool resetPid (const PidControlTypeEnum &pidtype, int j) override
 Reset the controller of a given joint, usually sets the current status of the joint as the reference value for the PID, and resets the integrator. More...
 
bool enablePid (const PidControlTypeEnum &pidtype, int j) override
 Enable the pid computation for a joint. More...
 
bool disablePid (const PidControlTypeEnum &pidtype, int j) override
 Disable the pid computation for a joint. More...
 
bool setPidOffset (const PidControlTypeEnum &pidtype, int j, double v) override
 Set offset value for a given controller. More...
 
bool isPidEnabled (const PidControlTypeEnum &pidtype, int j, bool *enabled) override
 Get the current status (enabled/disabled) of the pid. More...
 
void b ()
 
- Public Member Functions inherited from yarp::dev::IPidControl
virtual ~IPidControl ()
 Destructor. More...
 

Protected Member Functions

bool initialize (int size, const int *amap, const double *enc, const double *zos, const double *newtons, const double *amps, const double *dutys)
 Initialize the internal data and alloc memory. More...
 
bool uninitialize ()
 Clean up internal data and memory. More...
 
bool setConversionUnits (const PidControlTypeEnum &pidtype, const PidFeedbackUnitsEnum fbk_conv_units, const PidOutputUnitsEnum out_conv_units)
 

Protected Attributes

IPidControlRawiPid
 
void * helper
 
yarp::dev::impl::FixedSizeBuffersManager< double > * doubleBuffManager
 
yarp::dev::impl::FixedSizeBuffersManager< yarp::dev::Pid > * pidBuffManager
 

Detailed Description

Definition at line 31 of file ImplementPidControl.h.

Constructor & Destructor Documentation

◆ ImplementPidControl()

ImplementPidControl::ImplementPidControl ( yarp::dev::IPidControlRaw y)

Definition at line 21 of file ImplementPidControl.cpp.

◆ ~ImplementPidControl()

ImplementPidControl::~ImplementPidControl ( )
virtual

Definition at line 29 of file ImplementPidControl.cpp.

Member Function Documentation

◆ b()

void yarp::dev::ImplementPidControl::b ( )

◆ disablePid()

bool ImplementPidControl::disablePid ( const PidControlTypeEnum pidtype,
int  j 
)
overridevirtual

Disable the pid computation for a joint.

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
jjoint number
Returns
true on success, false on failure.

Implements yarp::dev::IPidControl.

Definition at line 320 of file ImplementPidControl.cpp.

◆ enablePid()

bool ImplementPidControl::enablePid ( const PidControlTypeEnum pidtype,
int  j 
)
overridevirtual

Enable the pid computation for a joint.

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
jjoint number
Returns
true on success, false on failure.

Implements yarp::dev::IPidControl.

Definition at line 311 of file ImplementPidControl.cpp.

◆ getPid()

bool ImplementPidControl::getPid ( const PidControlTypeEnum pidtype,
int  j,
Pid pid 
)
overridevirtual

Get current pid value for a specific joint.

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
jjoint number
pidpointer to storage for the return value.
Returns
success/failure

Implements yarp::dev::IPidControl.

Definition at line 210 of file ImplementPidControl.cpp.

◆ getPidError()

bool ImplementPidControl::getPidError ( const PidControlTypeEnum pidtype,
int  j,
double *  err 
)
overridevirtual

Get the current error for a joint.

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
jjoint number
errpointer to the storage for the return value
Returns
true/false on success failure

Implements yarp::dev::IPidControl.

Definition at line 148 of file ImplementPidControl.cpp.

◆ getPidErrorLimit()

bool ImplementPidControl::getPidErrorLimit ( const PidControlTypeEnum pidtype,
int  j,
double *  limit 
)
overridevirtual

Get the error limit for the controller on a specific joint.

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
jjoint number
limitpointer to storage
Returns
success/failure

Implements yarp::dev::IPidControl.

Definition at line 276 of file ImplementPidControl.cpp.

◆ getPidErrorLimits()

bool ImplementPidControl::getPidErrorLimits ( const PidControlTypeEnum pidtype,
double *  limits 
)
overridevirtual

Get the error limit for all controllers.

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
limitspointer to the array that will store the output
Returns
success or failure

Implements yarp::dev::IPidControl.

Definition at line 291 of file ImplementPidControl.cpp.

◆ getPidErrors()

bool ImplementPidControl::getPidErrors ( const PidControlTypeEnum pidtype,
double *  errs 
)
overridevirtual

Get the error of all joints.

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
errspointer to the vector that will store the errors

Implements yarp::dev::IPidControl.

Definition at line 162 of file ImplementPidControl.cpp.

◆ getPidOutput()

bool ImplementPidControl::getPidOutput ( const PidControlTypeEnum pidtype,
int  j,
double *  out 
)
overridevirtual

Get the output of the controller (e.g.

pwm value)

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
jjoint number
outpointer to storage for return value
Returns
success/failure

Implements yarp::dev::IPidControl.

Definition at line 173 of file ImplementPidControl.cpp.

◆ getPidOutputs()

bool ImplementPidControl::getPidOutputs ( const PidControlTypeEnum pidtype,
double *  outs 
)
overridevirtual

Get the output of the controllers (e.g.

pwm value)

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
outspinter to the vector that will store the output values

Implements yarp::dev::IPidControl.

Definition at line 191 of file ImplementPidControl.cpp.

◆ getPidReference()

bool ImplementPidControl::getPidReference ( const PidControlTypeEnum pidtype,
int  j,
double *  ref 
)
overridevirtual

Get the current reference of the pid controller for a specific joint.

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
jjoint number
refpointer to storage for return value
Returns
reference value

Implements yarp::dev::IPidControl.

Definition at line 249 of file ImplementPidControl.cpp.

◆ getPidReferences()

bool ImplementPidControl::getPidReferences ( const PidControlTypeEnum pidtype,
double *  refs 
)
overridevirtual

Get the current reference of all pid controllers.

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
refsvector that will store the output.

Implements yarp::dev::IPidControl.

Definition at line 264 of file ImplementPidControl.cpp.

◆ getPids()

bool ImplementPidControl::getPids ( const PidControlTypeEnum pidtype,
Pid pids 
)
overridevirtual

Get current pid value for a specific joint.

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
pidsvector that will store the values of the pids.
Returns
success/failure

Implements yarp::dev::IPidControl.

Definition at line 226 of file ImplementPidControl.cpp.

◆ initialize()

bool ImplementPidControl::initialize ( int  size,
const int *  amap,
const double *  enc,
const double *  zos,
const double *  newtons,
const double *  amps,
const double *  dutys 
)
protected

Initialize the internal data and alloc memory.

Parameters
sizeis the number of controlled axes the driver deals with.
amapis a lookup table mapping axes onto physical drivers.
Returns
true if initialized succeeded, false if it wasn't executed, or assert.

Definition at line 34 of file ImplementPidControl.cpp.

◆ isPidEnabled()

bool ImplementPidControl::isPidEnabled ( const PidControlTypeEnum pidtype,
int  j,
bool *  enabled 
)
overridevirtual

Get the current status (enabled/disabled) of the pid.

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
jjoint number
enabledthe current status of the pid controller.
Returns
true on success, false on failure.

Implements yarp::dev::IPidControl.

Definition at line 340 of file ImplementPidControl.cpp.

◆ resetPid()

bool ImplementPidControl::resetPid ( const PidControlTypeEnum pidtype,
int  j 
)
overridevirtual

Reset the controller of a given joint, usually sets the current status of the joint as the reference value for the PID, and resets the integrator.

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
jjoint number
Returns
true on success, false on failure.

Implements yarp::dev::IPidControl.

Definition at line 302 of file ImplementPidControl.cpp.

◆ setConversionUnits()

bool ImplementPidControl::setConversionUnits ( const PidControlTypeEnum pidtype,
const PidFeedbackUnitsEnum  fbk_conv_units,
const PidOutputUnitsEnum  out_conv_units 
)
protected

Definition at line 349 of file ImplementPidControl.cpp.

◆ setPid()

bool ImplementPidControl::setPid ( const PidControlTypeEnum pidtype,
int  j,
const Pid pid 
)
overridevirtual

Set new pid value for a joint axis.

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
jjoint number
pidnew pid value
Returns
true/false on success/failure

Implements yarp::dev::IPidControl.

Definition at line 78 of file ImplementPidControl.cpp.

◆ setPidErrorLimit()

bool ImplementPidControl::setPidErrorLimit ( const PidControlTypeEnum pidtype,
int  j,
double  limit 
)
overridevirtual

Set the error limit for the controller on a specifi joint.

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
jjoint number
limitlimit value
Returns
true/false on success/failure

Implements yarp::dev::IPidControl.

Definition at line 127 of file ImplementPidControl.cpp.

◆ setPidErrorLimits()

bool ImplementPidControl::setPidErrorLimits ( const PidControlTypeEnum pidtype,
const double *  limits 
)
overridevirtual

Get the error limit for the controller on all joints.

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
limitspointer to the vector with the new limits
Returns
true/false on success/failure

Implements yarp::dev::IPidControl.

Definition at line 137 of file ImplementPidControl.cpp.

◆ setPidOffset()

bool ImplementPidControl::setPidOffset ( const PidControlTypeEnum pidtype,
int  j,
double  v 
)
overridevirtual

Set offset value for a given controller.

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
jjoint number
vthe offset to be added to the output of the pid controller
Returns
true on success, false on failure.

Implements yarp::dev::IPidControl.

Definition at line 329 of file ImplementPidControl.cpp.

◆ setPidReference()

bool ImplementPidControl::setPidReference ( const PidControlTypeEnum pidtype,
int  j,
double  ref 
)
overridevirtual

Set the controller reference for a given axis.

Warning this method can result in very large torques and should be used carefully. If you do not understand this warning you should avoid using this method. Have a look at other interfaces (e.g. position control).

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
jjoint number
refnew reference point
Returns
true/false upon success/failure

Implements yarp::dev::IPidControl.

Definition at line 107 of file ImplementPidControl.cpp.

◆ setPidReferences()

bool ImplementPidControl::setPidReferences ( const PidControlTypeEnum pidtype,
const double *  refs 
)
overridevirtual

Set the controller reference, multiple axes.

Warning this method can result in very large torques and should be used carefully. If you do not understand this warning you should avoid using this method. Have a look at other interfaces (e.g. position control).

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
refspointer to the vector that contains the new reference points.
Returns
true/false upon success/failure

Implements yarp::dev::IPidControl.

Definition at line 117 of file ImplementPidControl.cpp.

◆ setPids()

bool ImplementPidControl::setPids ( const PidControlTypeEnum pidtype,
const Pid pids 
)
overridevirtual

Set new pid value on multiple axes.

Parameters
pidtypethe id of the pid that will be affected by the command (e.g. position, velocity etc)
pidspointer to a vector of pids
Returns
true/false upon success/failure

Implements yarp::dev::IPidControl.

Definition at line 88 of file ImplementPidControl.cpp.

◆ uninitialize()

bool ImplementPidControl::uninitialize ( )
protected

Clean up internal data and memory.

Returns
true if uninitialization is executed, false otherwise.

Definition at line 55 of file ImplementPidControl.cpp.

Member Data Documentation

◆ doubleBuffManager

yarp::dev::impl::FixedSizeBuffersManager<double>* yarp::dev::ImplementPidControl::doubleBuffManager
protected

Definition at line 36 of file ImplementPidControl.h.

◆ helper

void* yarp::dev::ImplementPidControl::helper
protected

Definition at line 35 of file ImplementPidControl.h.

◆ iPid

IPidControlRaw* yarp::dev::ImplementPidControl::iPid
protected

Definition at line 34 of file ImplementPidControl.h.

◆ pidBuffManager

yarp::dev::impl::FixedSizeBuffersManager<yarp::dev::Pid>* yarp::dev::ImplementPidControl::pidBuffManager
protected

Definition at line 37 of file ImplementPidControl.h.


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