YARP
Yet Another Robot Platform
IAmplifierControl.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef YARP_DEV_IAMPLIFIERCONTROL_H
8 #define YARP_DEV_IAMPLIFIERCONTROL_H
9 
10 #include <yarp/os/Vocab.h>
11 #include <yarp/dev/api.h>
12 
15 namespace yarp
16 {
17  namespace dev
18  {
19  class IAmplifierControlRaw;
20  class IAmplifierControl;
21  }
22 }
23 
30 {
31 public:
35  virtual ~IAmplifierControl() {}
36 
42  virtual bool enableAmp(int j)=0;
43 
48  virtual bool disableAmp(int j)=0;
49 
50  /* Get the status of the amplifiers, coded in a 32 bits integer for
51  * each amplifier (at the moment contains only the fault, it will be
52  * expanded in the future).
53  * @param st pointer to storage
54  * @return true in good luck, false otherwise.
55  */
56  virtual bool getAmpStatus(int *st)=0;
57 
58  /* Get the status of a single amplifier, coded in a 32 bits integer
59  * @param j joint number
60  * @param st storage for return value
61  * @return true/false success failure.
62  */
63  virtual bool getAmpStatus(int j, int *v)=0;
64 
65  /* Read the electric current going to all motors.
66  * @param vals pointer to storage for the output values
67  * @return hopefully true, false in bad luck.
68  */
69  virtual bool getCurrents(double *vals)=0;
70 
71  /* Read the electric current going to a given motor.
72  * @param j motor number
73  * @param val pointer to storage for the output value
74  * @return probably true, might return false in bad times
75  */
76  virtual bool getCurrent(int j, double *val)=0;
77 
85  virtual bool getMaxCurrent(int j, double *v)=0;
86 
87  /* Set the maximum electric current going to a given motor.
88  * Exceeding this value will trigger instantaneous hardware fault.
89  * @param j motor number
90  * @param v the new value
91  * @return probably true, might return false in bad times
92  */
93  virtual bool setMaxCurrent(int j, double v)=0;
94 
95  /* Get the nominal current which can be kept for an indefinite amount of time
96  * without harming the motor. This value is specific for each motor and it is typically
97  * found in its data-sheet. The units are Ampere.
98  * This value and the peak current may be used by the firmware to configure
99  * an I2T filter.
100  * @param j joint number
101  * @param val storage for return value. [Ampere]
102  * @return true/false success failure.
103  */
104  virtual bool getNominalCurrent(int m, double *val) {return false;};
105 
106  /* Set the nominal current which can be kept for an indefinite amount of time
107  * without harming the motor. This value is specific for each motor and it is typically
108  * found in its data-sheet. The units are Ampere.
109  * This value and the peak current may be used by the firmware to configure
110  * an I2T filter.
111  * @param j joint number
112  * @param val storage for return value. [Ampere]
113  * @return true/false success failure.
114  */
115  virtual bool setNominalCurrent(int m, const double val) { return false; };
116 
117  /* Get the peak current which causes damage to the motor if maintained
118  * for a long amount of time.
119  * The value is often found in the motor data-sheet, units are Ampere.
120  * This value and the nominal current may be used by the firmware to configure
121  * an I2T filter.
122  * @param j joint number
123  * @param val storage for return value. [Ampere]
124  * @return true/false success failure.
125  */
126  virtual bool getPeakCurrent(int m, double *val) {return false;};
127 
128  /* Set the peak current. This value which causes damage to the motor if maintained
129  * for a long amount of time.
130  * The value is often found in the motor data-sheet, units are Ampere.
131  * This value and the nominal current may be used by the firmware to configure
132  * an I2T filter.
133  * @param j joint number
134  * @param val storage for return value. [Ampere]
135  * @return true/false success failure.
136  */
137  virtual bool setPeakCurrent(int m, const double val) {return false;};
138 
139  /* Get the the current PWM value used to control the motor.
140  * The units are firmware dependent, either machine units or percentage.
141  * @param j joint number
142  * @param val filled with PWM value.
143  * @return true/false success failure.
144  */
145  virtual bool getPWM(int j, double* val) {return false;};
146 
147  /* Get the PWM limit for the given motor.
148  * The units are firmware dependent, either machine units or percentage.
149  * @param j joint number
150  * @param val filled with PWM limit value.
151  * @return true/false success failure.
152  */
153  virtual bool getPWMLimit(int j, double* val) {return false;};
154 
155  /* Set the PWM limit for the given motor.
156  * The units are firmware dependent, either machine units or percentage.
157  * @param j joint number
158  * @param val new value for the PWM limit.
159  * @return true/false success failure.
160  */
161  virtual bool setPWMLimit(int j, const double val) {return false;};
162 
163  /* Get the power source voltage for the given motor in Volt.
164  * @param j joint number
165  * @param val filled with return value.
166  * @return true/false success failure.
167  */
168  virtual bool getPowerSupplyVoltage(int j, double* val) {return false;};
169 };
170 
176 {
177 public:
182 
188  virtual bool enableAmpRaw(int j)=0;
189 
194  virtual bool disableAmpRaw(int j)=0;
195 
196  /* Get the status of the amplifiers, coded in a 32 bits integer for
197  * each amplifier (at the moment contains only the fault, it will be
198  * expanded in the future).
199  * @param st pointer to storage
200  * @return true/false success failure.
201  */
202  virtual bool getAmpStatusRaw(int *st)=0;
203 
204  /* Get the status of a single amplifier, coded in a 32 bits integer
205  * @param j joint number
206  * @param st storage for return value
207  * @return true/false success failure.
208  */
209  virtual bool getAmpStatusRaw(int j, int *st)=0;
210 
211  /* Read the electric current going to all motors.
212  * @param vals pointer to storage for the output values
213  * @return hopefully true, false in bad luck.
214  */
215  virtual bool getCurrentsRaw(double *vals)=0;
216 
217  /* Read the electric current going to a given motor.
218  * @param j motor number
219  * @param val pointer to storage for the output value
220  * @return probably true, might return false in bad times
221  */
222  virtual bool getCurrentRaw(int j, double *val)=0;
223 
224  /* Set the maximum electric current going to a given motor.
225  * Exceeding this value will trigger instantaneous hardware fault.
226  * @param j motor number
227  * @param v the new value
228  * @return probably true, might return false in bad times
229  */
230  virtual bool setMaxCurrentRaw(int j, double v)=0;
231 
239  virtual bool getMaxCurrentRaw(int j, double *v)=0;
240 
241  /* Get the nominal current which can be kept for an indefinite amount of time
242  * without harming the motor. This value is specific for each motor and it is typically
243  * found in its data-sheet. The units are Ampere.
244  * This value and the peak current may be used by the firmware to configure
245  * an I2T filter.
246  * @param j joint number
247  * @param val storage for return value. [Ampere]
248  * @return true/false success failure.
249  */
250  virtual bool getNominalCurrentRaw(int m, double *val) {return false;};
251 
252  /* Set the nominal current which can be kept for an indefinite amount of time
253  * without harming the motor. This value is specific for each motor and it is typically
254  * found in its data-sheet. The units are Ampere.
255  * This value and the peak current may be used by the firmware to configure
256  * an I2T filter.
257  * @param j joint number
258  * @param val storage for return value. [Ampere]
259  * @return true/false success failure.
260  */
261  virtual bool setNominalCurrentRaw(int m, const double val) { return false; };
262 
263  /* Get the peak current which causes damage to the motor if maintained
264  * for a long amount of time.
265  * The value is often found in the motor data-sheet, units are Ampere.
266  * This value and the nominal current may be used by the firmware to configure
267  * an I2T filter.
268  * @param j joint number
269  * @param val storage for return value. [Ampere]
270  * @return true/false success failure.
271  */
272  virtual bool getPeakCurrentRaw(int m, double *val) {return false;};
273 
274  /* Set the peak current. This value which causes damage to the motor if maintained
275  * for a long amount of time.
276  * The value is often found in the motor data-sheet, units are Ampere.
277  * This value and the nominal current may be used by the firmware to configure
278  * an I2T filter.
279  * @param j joint number
280  * @param val storage for return value. [Ampere]
281  * @return true/false success failure.
282  */
283  virtual bool setPeakCurrentRaw(int m, const double val) {return false;};
284 
285  /* Get the current PWM value used to control the motor.
286  * The units are firmware dependent, either machine units or percentage.
287  * @param j joint number
288  * @param val filled with PWM value.
289  * @return true/false success failure.
290  */
291  virtual bool getPWMRaw(int j, double* val) {return false;};
292 
293  /* Get the PWM limit for the given motor.
294  * The units are firmware dependent, either machine units or percentage.
295  * @param j joint number
296  * @param val filled with PWM limit value.
297  * @return true/false success failure.
298  */
299  virtual bool getPWMLimitRaw(int j, double* val) {return false;};
300 
301  /* Set the PWM limit for the given motor.
302  * The units are firmware dependent, either machine units or percentage.
303  * @param j joint number
304  * @param val new value for the PWM limit.
305  * @return true/false success failure.
306  */
307  virtual bool setPWMLimitRaw(int j, const double val) {return false;};
308 
309  /* Get the power source voltage for the given motor in Volt.
310  * @param j joint number
311  * @param val filled with return value. [Volt]
312  * @return true/false success failure.
313  */
314  virtual bool getPowerSupplyVoltageRaw(int j, double* val) {return false;};
315 };
316 
317 // interface IAmplifierControl sets/gets
330 
331 #endif // YARP_DEV_IAMPLIFIERCONTROL_H
constexpr yarp::conf::vocab32_t VOCAB_AMP_DISABLE
constexpr yarp::conf::vocab32_t VOCAB_AMP_PEAK_CURRENT
constexpr yarp::conf::vocab32_t VOCAB_AMP_ENABLE
constexpr yarp::conf::vocab32_t VOCAB_AMP_VOLTAGE_SUPPLY
constexpr yarp::conf::vocab32_t VOCAB_AMP_CURRENT
constexpr yarp::conf::vocab32_t VOCAB_AMP_MAXCURRENT
constexpr yarp::conf::vocab32_t VOCAB_AMP_STATUS_SINGLE
constexpr yarp::conf::vocab32_t VOCAB_AMP_STATUS
constexpr yarp::conf::vocab32_t VOCAB_AMP_NOMINAL_CURRENT
constexpr yarp::conf::vocab32_t VOCAB_AMP_PWM
constexpr yarp::conf::vocab32_t VOCAB_AMP_CURRENTS
constexpr yarp::conf::vocab32_t VOCAB_AMP_PWM_LIMIT
Interface for control devices, amplifier commands.
virtual bool setMaxCurrentRaw(int j, double v)=0
virtual bool getPeakCurrentRaw(int m, double *val)
virtual bool getCurrentsRaw(double *vals)=0
virtual bool disableAmpRaw(int j)=0
Disable the amplifier on a specific joint.
virtual bool setNominalCurrentRaw(int m, const double val)
virtual bool getPowerSupplyVoltageRaw(int j, double *val)
virtual bool getAmpStatusRaw(int *st)=0
virtual bool getMaxCurrentRaw(int j, double *v)=0
Returns the maximum electric current allowed for a given motor.
virtual bool getPWMLimitRaw(int j, double *val)
virtual bool getPWMRaw(int j, double *val)
virtual bool enableAmpRaw(int j)=0
Enable the amplifier on a specific joint.
virtual ~IAmplifierControlRaw()
Destructor.
virtual bool getCurrentRaw(int j, double *val)=0
virtual bool getNominalCurrentRaw(int m, double *val)
virtual bool getAmpStatusRaw(int j, int *st)=0
virtual bool setPWMLimitRaw(int j, const double val)
virtual bool setPeakCurrentRaw(int m, const double val)
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 getAmpStatus(int j, int *v)=0
virtual bool setNominalCurrent(int m, const double val)
virtual ~IAmplifierControl()
Destructor.
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)
std::int32_t vocab32_t
Definition: numeric.h:78
constexpr yarp::conf::vocab32_t createVocab32(char a, char b=0, char c=0, char d=0)
Create a vocab from chars.
Definition: Vocab.h:28
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_dev_API
Definition: api.h:18