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