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