|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
18 #define JOINTIDCHECK if (j >= castToMapper(helper)->axes()){yError("joint id out of bound"); return false;}
23 doubleBuffManager(nullptr),
24 pidBuffManager(nullptr)
34 bool ImplementPidControl:: initialize (
int size,
const int *amap,
const double *enc,
const double *zos,
const double* newtons,
const double* amps,
const double* dutys)
91 int nj= cb_helper->
axes();
98 buffValues[k] = pid_machine;
185 *out = raw / output_conversion_units_user2raw;
194 int nj = cb_helper->
axes();
200 for (
int j = 0; j < nj; j++)
203 outs[j] = outs[j] / output_conversion_units_user2raw;
215 k_raw=cb_helper->toHw(j);
220 cb_helper->convert_pid_to_user(pidtype, rawPid, k_raw, *pid, j);
236 int nj=cb_helper->
axes();
238 for (
int k_raw = 0; k_raw < nj; k_raw++)
243 pids[j_usr] = outpid;
336 rawoff = off * output_conversion_units_user2raw;
void convert_pidunits_to_machine(const yarp::dev::PidControlTypeEnum &pidtype, double userval, int j, double &machineval, int &k)
void convert_pid_to_machine(const yarp::dev::PidControlTypeEnum &pidtype, const Pid &in_usr, int j_usr, Pid &out_raw, int &k_raw)
double get_pidoutput_conversion_factor_user2raw(const yarp::dev::PidControlTypeEnum &pidtype, int j)
bool setPidErrorLimits(const PidControlTypeEnum &pidtype, const double *limits) override
Get the error limit for the controller on all joints.
yarp::dev::impl::FixedSizeBuffersManager< double > * doubleBuffManager
virtual bool getPidErrorLimitRaw(const PidControlTypeEnum &pidtype, int j, double *limit)=0
Get the error limit for the controller on a specific joint.
virtual ~ImplementPidControl()
virtual bool setPidReferenceRaw(const PidControlTypeEnum &pidtype, int j, double ref)=0
Set the controller reference for a given axis.
virtual bool setPidOffsetRaw(const PidControlTypeEnum &pidtype, int j, double v)=0
Set an offset value on the ourput of pid controller.
virtual bool isPidEnabledRaw(const PidControlTypeEnum &pidtype, int j, bool *enabled)=0
Get the current status (enabled/disabled) of the pid controller.
T * getData()
Return the data pointer.
virtual bool setPidRaw(const PidControlTypeEnum &pidtype, int j, const Pid &pid)=0
Set new pid value for a joint axis.
Buffer< T > getBuffer()
Get a buffer and fill its information in @buffer.
bool getPids(const PidControlTypeEnum &pidtype, Pid *pids) override
Get current pid value for a specific joint.
bool setPidOffset(const PidControlTypeEnum &pidtype, int j, double v) override
Set offset value for a given controller.
bool isPidEnabled(const PidControlTypeEnum &pidtype, int j, bool *enabled) override
Get the current status (enabled/disabled) of the pid.
virtual bool resetPidRaw(const PidControlTypeEnum &pidtype, int j)=0
Reset the controller of a given joint, usually sets the current status of the joint as the reference ...
An interface for the device drivers.
virtual bool disablePidRaw(const PidControlTypeEnum &pidtype, int j)=0
Disable the pid computation for a joint.
virtual bool getPidErrorLimitsRaw(const PidControlTypeEnum &pidtype, double *limits)=0
Get the error limit for all controllers.
bool getPidReferences(const PidControlTypeEnum &pidtype, double *refs) override
Get the current reference of all pid controllers.
virtual bool setPidErrorLimitsRaw(const PidControlTypeEnum &pidtype, const double *limits)=0
Get the error limit for the controller on all joints.
bool getPidOutput(const PidControlTypeEnum &pidtype, int j, double *out) override
Get the output of the controller (e.g.
bool setPid(const PidControlTypeEnum &pidtype, int j, const Pid &pid) override
Set new pid value for a joint axis.
virtual bool getPidOutputRaw(const PidControlTypeEnum &pidtype, int j, double *out)=0
Get the output of the controller (e.g.
bool enablePid(const PidControlTypeEnum &pidtype, int j) override
Enable the pid computation for a joint.
virtual bool setPidsRaw(const PidControlTypeEnum &pidtype, const Pid *pids)=0
Set new pid value on multiple axes.
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 ...
bool uninitialize()
Clean up internal data and memory.
Buffer contains info about a buffer of type T and it is used to exchange information with yarp::dev::...
virtual bool getPidRaw(const PidControlTypeEnum &pidtype, int j, Pid *pid)=0
Get current pid value for a specific joint.
virtual bool setPidErrorLimitRaw(const PidControlTypeEnum &pidtype, int j, double limit)=0
Set the error limit for the controller on a specific joint.
bool getPidErrorLimits(const PidControlTypeEnum &pidtype, double *refs) override
Get the error limit for all controllers.
bool setPids(const PidControlTypeEnum &pidtype, const Pid *pids) override
Set new pid value on multiple axes.
yarp::dev::impl::FixedSizeBuffersManager< yarp::dev::Pid > * pidBuffManager
ImplementPidControl(yarp::dev::IPidControlRaw *y)
bool setConversionUnits(const PidControlTypeEnum &pidtype, const PidFeedbackUnitsEnum fbk_conv_units, const PidOutputUnitsEnum out_conv_units)
Interface for a generic control board device implementing a PID controller.
void releaseBuffer(Buffer< T > &buffer)
Release a buffer.
bool setPidReferences(const PidControlTypeEnum &pidtype, const double *refs) override
Set the controller reference, multiple axes.
virtual bool getPidReferencesRaw(const PidControlTypeEnum &pidtype, double *refs)=0
Get the current reference of all pid controllers.
virtual bool setPidReferencesRaw(const PidControlTypeEnum &pidtype, const double *refs)=0
Set the controller reference, multiple axes.
bool getPidErrors(const PidControlTypeEnum &pidtype, double *errs) override
Get the error of all joints.
An interface to the operating system, including Port based communication.
virtual bool getPidOutputsRaw(const PidControlTypeEnum &pidtype, double *outs)=0
Get the output of the controllers (e.g.
yarp::dev::ControlBoardHelper * castToMapper(void *p)
bool disablePid(const PidControlTypeEnum &pidtype, int j) override
Disable the pid computation for a joint.
void convert_pid_to_user(const yarp::dev::PidControlTypeEnum &pidtype, const Pid &in_raw, int j_raw, Pid &out_usr, int &k_usr)
bool setPidErrorLimit(const PidControlTypeEnum &pidtype, int j, double limit) override
Set the error limit for the controller on a specifi joint.
bool getPid(const PidControlTypeEnum &pidtype, int j, Pid *pid) override
Get current pid value for a specific joint.
bool getPidReference(const PidControlTypeEnum &pidtype, int j, double *ref) override
Get the current reference of the pid controller for a specific joint.
Contains the parameters for a PID.
virtual bool enablePidRaw(const PidControlTypeEnum &pidtype, int j)=0
Enable the pid computation for a joint.
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.
bool getPidError(const PidControlTypeEnum &pidtype, int j, double *err) override
Get the current error for a joint.
virtual bool getPidErrorRaw(const PidControlTypeEnum &pidtype, int j, double *err)=0
Get the current error for a joint.
virtual bool getPidErrorsRaw(const PidControlTypeEnum &pidtype, double *errs)=0
Get the error of all joints.
void set_pid_conversion_units(const PidControlTypeEnum &pidtype, const PidFeedbackUnitsEnum fbk_conv_units, const PidOutputUnitsEnum out_conv_units)
virtual bool getPidsRaw(const PidControlTypeEnum &pidtype, Pid *pids)=0
Get current pid value for a specific joint.
bool setPidReference(const PidControlTypeEnum &pidtype, int j, double ref) override
Set the controller reference for a given axis.
virtual bool getPidReferenceRaw(const PidControlTypeEnum &pidtype, int j, double *ref)=0
Get the current reference of the pid controller for a specific joint.
bool getPidErrorLimit(const PidControlTypeEnum &pidtype, int j, double *ref) override
Get the error limit for the controller on a specific joint.
void convert_pidunits_to_user(const yarp::dev::PidControlTypeEnum &pidtype, const double machineval, double *userval, int k)
bool getPidOutputs(const PidControlTypeEnum &pidtype, double *outs) override
Get the output of the controllers (e.g.