YARP
Yet Another Robot Platform
ImplementPidControl.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef YARP_DEV_IMPLEMENTPIDCONTROL_H
7 #define YARP_DEV_IMPLEMENTPIDCONTROL_H
8 
9 #include <yarp/dev/IPidControl.h>
10 
11 namespace yarp {
12  namespace dev {
13  class ImplementPidControl;
14  }
15 }
16 
17 namespace yarp {
18 namespace dev {
19 namespace impl {
20 
21 template <typename T>
22 class FixedSizeBuffersManager;
23 
24 } // namespace impl
25 } // namespace dev
26 } // namespace yarp
27 
29 {
30 protected:
32  void *helper;
35 
42  bool initialize(int size, const int *amap, const double *enc, const double *zos, const double* newtons, const double* amps, const double* dutys);
43 
48  bool uninitialize();
49 
50  bool setConversionUnits(const PidControlTypeEnum& pidtype, const PidFeedbackUnitsEnum fbk_conv_units, const PidOutputUnitsEnum out_conv_units);
51 
52 public:
53  /* Constructor.
54  * @param y is the pointer to the class instance inheriting from this
55  * implementation.
56  */
58 
59  /* Destructor.
60  */
61  virtual ~ImplementPidControl();
62 
63  bool setPid(const PidControlTypeEnum& pidtype, int j, const Pid &pid) override;
64  bool setPids(const PidControlTypeEnum& pidtype, const Pid *pids) override;
65  bool setPidReference(const PidControlTypeEnum& pidtype, int j, double ref) override;
66  bool setPidReferences(const PidControlTypeEnum& pidtype, const double *refs) override;
67  bool setPidErrorLimit(const PidControlTypeEnum& pidtype, int j, double limit) override;
68  bool setPidErrorLimits(const PidControlTypeEnum& pidtype, const double *limits) override;
69  bool getPidError(const PidControlTypeEnum& pidtype, int j, double *err) override;
70  bool getPidErrors(const PidControlTypeEnum& pidtype, double *errs) override;
71  bool getPidOutput(const PidControlTypeEnum& pidtype, int j, double *out) override;
72  bool getPidOutputs(const PidControlTypeEnum& pidtype, double *outs) override;
73  bool getPid(const PidControlTypeEnum& pidtype, int j, Pid *pid) override;
74  bool getPids(const PidControlTypeEnum& pidtype, Pid *pids) override;
75  bool getPidReference(const PidControlTypeEnum& pidtype, int j, double *ref) override;
76  bool getPidReferences(const PidControlTypeEnum& pidtype, double *refs) override;
77  bool getPidErrorLimit(const PidControlTypeEnum& pidtype, int j, double *ref) override;
78  bool getPidErrorLimits(const PidControlTypeEnum& pidtype, double *refs) override;
79  bool resetPid(const PidControlTypeEnum& pidtype, int j) override;
80  bool enablePid(const PidControlTypeEnum& pidtype, int j) override;
81  bool disablePid(const PidControlTypeEnum& pidtype, int j) override;
82  bool setPidOffset(const PidControlTypeEnum& pidtype, int j, double v) override;
83  bool isPidEnabled(const PidControlTypeEnum& pidtype, int j, bool* enabled) override;
84  void b();
85 };
86 
87 #endif // YARP_DEV_IMPLEMENTPIDCONTROL_H
Interface for a generic control board device implementing a PID controller.
Definition: IPidControl.h:29
Interface for a generic control board device implementing a PID controller, with scaled arguments.
Definition: IPidControl.h:208
virtual bool setPid(const PidControlTypeEnum &pidtype, int j, const Pid &pid)=0
Set new pid value for a joint axis.
virtual bool getPidReference(const PidControlTypeEnum &pidtype, int j, double *ref)=0
Get the current reference of the pid controller for a specific joint.
virtual bool getPidOutput(const PidControlTypeEnum &pidtype, int j, double *out)=0
Get the output of the controller (e.g.
virtual bool getPidReferences(const PidControlTypeEnum &pidtype, double *refs)=0
Get the current reference of all pid controllers.
virtual bool resetPid(const PidControlTypeEnum &pidtype, int j)=0
Reset the controller of a given joint, usually sets the current status of the joint as the reference ...
virtual bool setPidOffset(const PidControlTypeEnum &pidtype, int j, double v)=0
Set offset value for a given controller.
virtual bool getPidErrorLimits(const PidControlTypeEnum &pidtype, double *limits)=0
Get the error limit for all controllers.
virtual bool getPidError(const PidControlTypeEnum &pidtype, int j, double *err)=0
Get the current error for a joint.
virtual bool getPidErrorLimit(const PidControlTypeEnum &pidtype, int j, double *limit)=0
Get the error limit for the controller on a specific joint.
virtual bool setPidErrorLimit(const PidControlTypeEnum &pidtype, int j, double limit)=0
Set the error limit for the controller on a specifi joint.
virtual bool disablePid(const PidControlTypeEnum &pidtype, int j)=0
Disable the pid computation for a joint.
virtual bool setPidErrorLimits(const PidControlTypeEnum &pidtype, const double *limits)=0
Get the error limit for the controller on all joints.
virtual bool getPidOutputs(const PidControlTypeEnum &pidtype, double *outs)=0
Get the output of the controllers (e.g.
virtual bool setPidReference(const PidControlTypeEnum &pidtype, int j, double ref)=0
Set the controller reference for a given axis.
virtual bool setPidReferences(const PidControlTypeEnum &pidtype, const double *refs)=0
Set the controller reference, multiple axes.
virtual bool getPidErrors(const PidControlTypeEnum &pidtype, double *errs)=0
Get the error of all joints.
virtual bool setPids(const PidControlTypeEnum &pidtype, const Pid *pids)=0
Set new pid value on multiple axes.
virtual bool enablePid(const PidControlTypeEnum &pidtype, int j)=0
Enable the pid computation for a joint.
virtual bool isPidEnabled(const PidControlTypeEnum &pidtype, int j, bool *enabled)=0
Get the current status (enabled/disabled) of the pid.
virtual bool getPids(const PidControlTypeEnum &pidtype, Pid *pids)=0
Get current pid value for a specific joint.
virtual bool getPid(const PidControlTypeEnum &pidtype, int j, Pid *pid)=0
Get current pid value for a specific joint.
bool uninitialize()
Clean up internal data and memory.
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.
ImplementPidControl(yarp::dev::IPidControlRaw *y)
yarp::dev::impl::FixedSizeBuffersManager< double > * doubleBuffManager
yarp::dev::impl::FixedSizeBuffersManager< yarp::dev::Pid > * pidBuffManager
bool setConversionUnits(const PidControlTypeEnum &pidtype, const PidFeedbackUnitsEnum fbk_conv_units, const PidOutputUnitsEnum out_conv_units)
Contains the parameters for a PID.
PidOutputUnitsEnum
Definition: PidEnums.h:34
PidControlTypeEnum
Definition: PidEnums.h:18
PidFeedbackUnitsEnum
Definition: PidEnums.h:28
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_dev_API
Definition: api.h:18