YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
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
15namespace yarp::dev {
16class IAmplifierControlRaw;
17class IAmplifierControl;
18}
19
26{
27public:
31 virtual ~IAmplifierControl() {}
32
38 virtual bool enableAmp(int j)=0;
39
44 virtual bool disableAmp(int j)=0;
45
46 /* Get the status of the amplifiers, coded in a 32 bits integer for
47 * each amplifier (at the moment contains only the fault, it will be
48 * expanded in the future).
49 * @param st pointer to storage
50 * @return true in good luck, false otherwise.
51 */
52 virtual bool getAmpStatus(int *st)=0;
53
54 /* Get the status of a single amplifier, coded in a 32 bits integer
55 * @param j joint number
56 * @param st storage for return value
57 * @return true/false success failure.
58 */
59 virtual bool getAmpStatus(int j, int *v)=0;
60
61 /* Read the electric current going to all motors.
62 * @param vals pointer to storage for the output values
63 * @return hopefully true, false in bad luck.
64 */
65 virtual bool getCurrents(double *vals)=0;
66
67 /* Read the electric current going to a given motor.
68 * @param j motor number
69 * @param val pointer to storage for the output value
70 * @return probably true, might return false in bad times
71 */
72 virtual bool getCurrent(int j, double *val)=0;
73
81 virtual bool getMaxCurrent(int j, double *v)=0;
82
83 /* Set the maximum electric current going to a given motor.
84 * Exceeding this value will trigger instantaneous hardware fault.
85 * @param j motor number
86 * @param v the new value
87 * @return probably true, might return false in bad times
88 */
89 virtual bool setMaxCurrent(int j, double v)=0;
90
91 /* Get the nominal current which can be kept for an indefinite amount of time
92 * without harming the motor. This value is specific for each motor and it is typically
93 * found in its data-sheet. The units are Ampere.
94 * This value and the peak current may be used by the firmware to configure
95 * an I2T filter.
96 * @param j joint number
97 * @param val storage for return value. [Ampere]
98 * @return true/false success failure.
99 */
100 virtual bool getNominalCurrent(int m, double *val) {return false;};
101
102 /* Set the nominal current which can be kept for an indefinite amount of time
103 * without harming the motor. This value is specific for each motor and it is typically
104 * found in its data-sheet. The units are Ampere.
105 * This value and the peak current may be used by the firmware to configure
106 * an I2T filter.
107 * @param j joint number
108 * @param val storage for return value. [Ampere]
109 * @return true/false success failure.
110 */
111 virtual bool setNominalCurrent(int m, const double val) { return false; };
112
113 /* Get the peak current which causes damage to the motor if maintained
114 * for a long amount of time.
115 * The value is often found in the motor data-sheet, units are Ampere.
116 * This value and the nominal current may be used by the firmware to configure
117 * an I2T filter.
118 * @param j joint number
119 * @param val storage for return value. [Ampere]
120 * @return true/false success failure.
121 */
122 virtual bool getPeakCurrent(int m, double *val) {return false;};
123
124 /* Set the peak current. This value which causes damage to the motor if maintained
125 * for a long amount of time.
126 * The value is often found in the motor data-sheet, units are Ampere.
127 * This value and the nominal current may be used by the firmware to configure
128 * an I2T filter.
129 * @param j joint number
130 * @param val storage for return value. [Ampere]
131 * @return true/false success failure.
132 */
133 virtual bool setPeakCurrent(int m, const double val) {return false;};
134
135 /* Get the the current PWM value used to control the motor.
136 * The units are firmware dependent, either machine units or percentage.
137 * @param j joint number
138 * @param val filled with PWM value.
139 * @return true/false success failure.
140 */
141 virtual bool getPWM(int j, double* val) {return false;};
142
143 /* Get the PWM limit for the given motor.
144 * The units are firmware dependent, either machine units or percentage.
145 * @param j joint number
146 * @param val filled with PWM limit value.
147 * @return true/false success failure.
148 */
149 virtual bool getPWMLimit(int j, double* val) {return false;};
150
151 /* Set the PWM limit for the given motor.
152 * The units are firmware dependent, either machine units or percentage.
153 * @param j joint number
154 * @param val new value for the PWM limit.
155 * @return true/false success failure.
156 */
157 virtual bool setPWMLimit(int j, const double val) {return false;};
158
159 /* Get the power source voltage for the given motor in Volt.
160 * @param j joint number
161 * @param val filled with return value.
162 * @return true/false success failure.
163 */
164 virtual bool getPowerSupplyVoltage(int j, double* val) {return false;};
165};
166
173{
174public:
179
185 virtual bool enableAmpRaw(int j)=0;
186
191 virtual bool disableAmpRaw(int j)=0;
192
193 /* Get the status of the amplifiers, coded in a 32 bits integer for
194 * each amplifier (at the moment contains only the fault, it will be
195 * expanded in the future).
196 * @param st pointer to storage
197 * @return true/false success failure.
198 */
199 virtual bool getAmpStatusRaw(int *st)=0;
200
201 /* Get the status of a single amplifier, coded in a 32 bits integer
202 * @param j joint number
203 * @param st storage for return value
204 * @return true/false success failure.
205 */
206 virtual bool getAmpStatusRaw(int j, int *st)=0;
207
208 /* Read the electric current going to all motors.
209 * @param vals pointer to storage for the output values
210 * @return hopefully true, false in bad luck.
211 */
212 virtual bool getCurrentsRaw(double *vals)=0;
213
214 /* Read the electric current going to a given motor.
215 * @param j motor number
216 * @param val pointer to storage for the output value
217 * @return probably true, might return false in bad times
218 */
219 virtual bool getCurrentRaw(int j, double *val)=0;
220
221 /* Set the maximum electric current going to a given motor.
222 * Exceeding this value will trigger instantaneous hardware fault.
223 * @param j motor number
224 * @param v the new value
225 * @return probably true, might return false in bad times
226 */
227 virtual bool setMaxCurrentRaw(int j, double v)=0;
228
236 virtual bool getMaxCurrentRaw(int j, double *v)=0;
237
238 /* Get the nominal current which can be kept for an indefinite amount of time
239 * without harming the motor. This value is specific for each motor and it is typically
240 * found in its data-sheet. The units are Ampere.
241 * This value and the peak current may be used by the firmware to configure
242 * an I2T filter.
243 * @param j joint number
244 * @param val storage for return value. [Ampere]
245 * @return true/false success failure.
246 */
247 virtual bool getNominalCurrentRaw(int m, double *val) {return false;};
248
249 /* Set the nominal current which can be kept for an indefinite amount of time
250 * without harming the motor. This value is specific for each motor and it is typically
251 * found in its data-sheet. The units are Ampere.
252 * This value and the peak current may be used by the firmware to configure
253 * an I2T filter.
254 * @param j joint number
255 * @param val storage for return value. [Ampere]
256 * @return true/false success failure.
257 */
258 virtual bool setNominalCurrentRaw(int m, const double val) { return false; };
259
260 /* Get the peak current which causes damage to the motor if maintained
261 * for a long amount of time.
262 * The value is often found in the motor data-sheet, units are Ampere.
263 * This value and the nominal current may be used by the firmware to configure
264 * an I2T filter.
265 * @param j joint number
266 * @param val storage for return value. [Ampere]
267 * @return true/false success failure.
268 */
269 virtual bool getPeakCurrentRaw(int m, double *val) {return false;};
270
271 /* Set the peak current. This value which causes damage to the motor if maintained
272 * for a long amount of time.
273 * The value is often found in the motor data-sheet, units are Ampere.
274 * This value and the nominal current may be used by the firmware to configure
275 * an I2T filter.
276 * @param j joint number
277 * @param val storage for return value. [Ampere]
278 * @return true/false success failure.
279 */
280 virtual bool setPeakCurrentRaw(int m, const double val) {return false;};
281
282 /* Get the current PWM value used to control the motor.
283 * The units are firmware dependent, either machine units or percentage.
284 * @param j joint number
285 * @param val filled with PWM value.
286 * @return true/false success failure.
287 */
288 virtual bool getPWMRaw(int j, double* val) {return false;};
289
290 /* Get the PWM limit for the given motor.
291 * The units are firmware dependent, either machine units or percentage.
292 * @param j joint number
293 * @param val filled with PWM limit value.
294 * @return true/false success failure.
295 */
296 virtual bool getPWMLimitRaw(int j, double* val) {return false;};
297
298 /* Set the PWM limit for the given motor.
299 * The units are firmware dependent, either machine units or percentage.
300 * @param j joint number
301 * @param val new value for the PWM limit.
302 * @return true/false success failure.
303 */
304 virtual bool setPWMLimitRaw(int j, const double val) {return false;};
305
306 /* Get the power source voltage for the given motor in Volt.
307 * @param j joint number
308 * @param val filled with return value. [Volt]
309 * @return true/false success failure.
310 */
311 virtual bool getPowerSupplyVoltageRaw(int j, double* val) {return false;};
312};
313
314// interface IAmplifierControl sets/gets
327
328#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
For streams capable of holding different kinds of content, check what they actually have.
Definition jointData.cpp:13
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:27
The main, catch-all namespace for YARP.
Definition dirs.h:16
#define YARP_dev_API
Definition api.h:18