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