YARP
Yet Another Robot Platform
ImplementAmplifierControl.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_IMPLEMENTAMPLIFIERCONTROL_H
7 #define YARP_DEV_IMPLEMENTAMPLIFIERCONTROL_H
8 
10 #include <yarp/dev/api.h>
11 
12 namespace yarp
13 {
14  namespace dev
15  {
16  class ImplementAmplifierControl;
17  }
18 }
19 
21 {
22 protected:
24  void *helper;
25  double *dTemp;
26  int *iTemp;
27 
36  bool initialize (int size, const int *amap, const double *enc, const double *zos, const double *ampereFactor=NULL, const double *voltFactor=NULL);
37 
42  bool uninitialize ();
43 
44 public:
45  /* Constructor.
46  * @param y is the pointer to the class instance inheriting from this
47  * implementation.
48  */
50 
55 
61  bool enableAmp(int j) override;
62 
67  bool disableAmp(int j) override;
68 
69  /* Get the status of the amplifiers, coded in a 32 bits integer for
70  * each amplifier (at the moment contains only the fault, it will be
71  * expanded in the future).
72  * @param st pointer to storage
73  * @return true in good luck, false otherwise.
74  */
75  bool getAmpStatus(int *st) override;
76 
77  bool getAmpStatus(int j, int *st) override;
78 
79  /* Read the electric current going to all motors.
80  * @param vals pointer to storage for the output values
81  * @return hopefully true, false in bad luck.
82  */
83  bool getCurrents(double *vals) override;
84 
85  /* Read the electric current going to a given motor.
86  * @param j motor number
87  * @param val pointer to storage for the output value
88  * @return probably true, might return false in bad times
89  */
90  bool getCurrent(int j, double *val) override;
91 
92  /* Set the maximum electric current going to a given motor. The behavior
93  * of the board/amplifier when this limit is reached depends on the
94  * implementation.
95  * @param j motor number
96  * @param v the new value
97  * @return probably true, might return false in bad times
98  */
99  bool setMaxCurrent(int j, double v) override;
100 
109  bool getMaxCurrent(int j, double *v) override;
110 
111  /* Get the the nominal current which can be kept for an indefinite amount of time
112  * without harming the motor. This value is specific for each motor and it is typically
113  * found in its datasheet. The units are Ampere.
114  * This value and the peak current may be used by the firmware to configure
115  * an I2T filter.
116  * @param j joint number
117  * @param val storage for return value. [Ampere]
118  * @return true/false success failure.
119  */
120  bool getNominalCurrent(int m, double *val) override;
121 
122  /* Set the the nominal current which can be kept for an indefinite amount of time
123  * without harming the motor. This value is specific for each motor and it is typically
124  * found in its datasheet. The units are Ampere.
125  * This value and the peak current may be used by the firmware to configure
126  * an I2T filter.
127  * @param j joint number
128  * @param val storage for return value. [Ampere]
129  * @return true/false success failure.
130  */
131  bool setNominalCurrent(int m, const double val) override;
132 
133  /* Get the the peak current which causes damage to the motor if maintained
134  * for a long amount of time.
135  * The value is often found in the motor datasheet, units are Ampere.
136  * This value and the nominal current may be used by the firmware to configure
137  * an I2T filter.
138  * @param j joint number
139  * @param val storage for return value. [Ampere]
140  * @return true/false success failure.
141  */
142  bool getPeakCurrent(int m, double *val) override;
143 
144  /* Set the the peak current. This value which causes damage to the motor if maintained
145  * for a long amount of time.
146  * The value is often found in the motor datasheet, units are Ampere.
147  * This value and the nominal current may be used by the firmware to configure
148  * an I2T filter.
149  * @param j joint number
150  * @param val storage for return value. [Ampere]
151  * @return true/false success failure.
152  */
153  bool setPeakCurrent(int m, const double val) override;
154 
155  /* Get the the current PWM value used to control the motor.
156  * The units are firmware dependent, either machine units or percentage.
157  * @param j joint number
158  * @param val filled with PWM value.
159  * @return true/false success failure.
160  */
161  bool getPWM(int j, double* val) override;
162 
163  /* Get the PWM limit for the given motor.
164  * The units are firmware dependent, either machine units or percentage.
165  * @param j joint number
166  * @param val filled with PWM limit value.
167  * @return true/false success failure.
168  */
169  bool getPWMLimit(int j, double* val) override;
170 
171  /* Set the PWM limit for the given motor.
172  * The units are firmware dependent, either machine units or percentage.
173  * @param j joint number
174  * @param val new value for the PWM limit.
175  * @return true/false success failure.
176  */
177  bool setPWMLimit(int j, const double val) override;
178 
179  /* Get the power source voltage for the given motor in Volt.
180  * @param j joint number
181  * @param val filled with return value.
182  * @return true/false success failure.
183  */
184  bool getPowerSupplyVoltage(int j, double* val) override;
185 };
186 
187 
188 #endif // YARP_DEV_IMPLEMENTAMPLIFIERCONTROL_H
define control board standard interfaces
Interface for control devices, amplifier commands.
Interface for control devices, amplifier commands.
virtual bool getPWMLimit(int j, double *val)
virtual bool enableAmp(int j)=0
Enable the amplifier on a specific joint.
virtual bool setNominalCurrent(int m, const double val)
virtual bool getCurrents(double *vals)=0
virtual bool disableAmp(int j)=0
Disable the amplifier on a specific joint.
virtual bool getPWM(int j, double *val)
virtual bool getAmpStatus(int *st)=0
virtual bool setPWMLimit(int j, const double val)
virtual bool getMaxCurrent(int j, double *v)=0
Returns the maximum electric current allowed for a given motor.
virtual bool getNominalCurrent(int m, double *val)
virtual bool getCurrent(int j, double *val)=0
virtual bool getPowerSupplyVoltage(int j, double *val)
virtual bool setMaxCurrent(int j, double v)=0
virtual bool setPeakCurrent(int m, const double val)
virtual bool getPeakCurrent(int m, double *val)
bool initialize(int size, const int *amap, const double *enc, const double *zos, const double *ampereFactor=NULL, const double *voltFactor=NULL)
Initialize the internal data and alloc memory.
bool uninitialize()
Clean up internal data and memory.
ImplementAmplifierControl(yarp::dev::IAmplifierControlRaw *y)
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_dev_API
Definition: api.h:18