AuboStudio SDK  0.6.3
payload_contribution_model.h
浏览该文件的文档.
1#ifndef AUBO_SCOPE_PAYLOAD_CONTRIBUTION_MODEL_H
2#define AUBO_SCOPE_PAYLOAD_CONTRIBUTION_MODEL_H
3
6
7namespace arcs {
8namespace aubo_scope {
10
11/**
12 * @ingroup InstallationApi
13 * \~chinese 动态负载管理
14 * \~english API interface for dynamic payload management
15 */
16
18{
19public:
23
24 /**
25 * @ingroup PayloadContributionModel
26 * @ref Payload
27 * \chinese
28 * <p>
29 * 向AuboScope的当前安装中添加一个负载。
30 * </p>
31 *
32 * <p>
33 * 添加后终端用户可选择该负载,其他AuboCap贡献(通过{@link PayloadModel}接口)也可
34 * 使用。该负载不可被终端用户或其他aubo_studio插件修改。
35 * </p>
36 *
37 * <p>
38 * 系统将根据指定的负载质量和重心自动计算惯性矩阵的默认估算值。如果有负载惯性矩阵
39 * 的实际数据,可以使用{@link #addPayload(String, String, Mass, Position,
40 * InertiaMatrix)}方法替代(可获得更好的机器人手臂性能)。
41 * </p>
42 *
43 * <p>
44 * <b>注意:</b>指定的负载质量必须是连接到机器人工具输出法兰的负载总质量。
45 * </p>
46 *
47 * 负载质量和重心坐标(CoG)的有效范围可通过{@link RobotLimits}接口获取,该接口
48 * 可通过{@link RobotModel#getRobotLimits()}访问。
49 *
50 * @param idKey 用于标识此负载的键,不可为<code>null</code>或空字符串。该键仅对
51 * 此AuboCap有效,只需在此AuboCap中唯一,无需对其他aubo_studio插件"全局"唯一。
52 * @param suggestedName 建议的负载名称,不可为<code>null</code>或空字符串。有效
53 * 名称必须匹配正则表达式[a-zA-Z][a-zA-Z0-9_]{0,14},总共15个字符。最终名称可
54 * 从返回的负载实例获取。
55 * @param mass 连接到机器人工具输出法兰的负载总质量,不可为<code>null</code>。使
56 * 用{@link SimpleValueFactory#createMass(double, Mass.Unit)}创建。
57 * @param centerOfGravity 负载的重心(CoG),也称为质心。定义为工具输出法兰中心与
58 * 所连接负载重心之间的偏移量。不可为<code>null</code>。使用{@link PositionFactory}
59 * 接口创建。
60 * @return 在AuboScope中创建并注册的负载。
61 * @throws PayloadAlreadyAddedException 如果之前已使用相同的<code>idKey</code>标
62 * 识符添加过负载。使用{@link #getPayload(String)}检查负载是否已添加到当前安装中。
63 * 使用{@link #updatePayload(String, Mass, Position)}或
64 * {@link #updatePayload(String, Mass, Position, InertiaMatrix)}来更新负载。
65 * @throws IllegalPayloadNameException 如果建议的名称不匹配所需的正则表达式。
66 * @throws IllegalMassException 如果指定的质量不在AuboScope定义的有效范围内。
67 * @throws IllegalCenterOfGravityException 如果指定重心的任何值不在AuboScope定义
68 * 的有效范围内。
69 * \endchinese
70 * \english
71 * <p>
72 * Add a payload to the current installation in AuboScope.
73 * </p>
74 *
75 * <p>
76 * This makes the payload selectable by the end user as well as available to
77 * other AuboCap contributions (through the
78 * {@link PayloadModel} interface). The payload is not modifiable by the end
79 * user or other aubo_studio plugins.
80 * </p>
81 *
82 * <p>
83 * A default guess for the inertia matrix for the payload will be computed
84 * based on the specified payload mass and center of gravity. If data for
85 * the payload's inertia matrix is available, the method
86 * {@link #addPayload(String, String, Mass, Position, InertiaMatrix)} can
87 * used instead (this might give better performance of the robot arm).
88 * </p>
89 *
90 * <p>
91 * <b>Note:</b> The specified payload mass must be the total mass of the
92 * payload attached to the tool output flange of the robot.
93 * </p>
94 *
95 * The valid range for the payload mass and the coordinates of the center of
96 * gravity (CoG) are available through the
97 * {@link RobotLimits} interface which can be accessed with {@link
98 * RobotModel#getRobotLimits()} (an instance of the
99 * {@link RobotModel} interface can be retrieved through {@link
100 * SystemAPI#getRobotModel()}).
101 *
102 * @param idKey The key to identify this payload by, not <code>null</code>
103 * nor an empty string. The key is for this AuboCap only, i.e. it only has
104 * to be unique for this AuboCap and not "globally" for other aubo_studio
105 * plugins.
106 * @param suggestedName Suggested name for the payload, not
107 * <code>null</code> nor an empty string. Valid names must match regex
108 * [a-zA-Z][a-zA-Z0-9_]{0,14} for a total of 15 characters. The final name
109 * can be retrieved from the returned payload instance.
110 * @param mass The total mass of the payload attached to the tool output
111 * flange of the robot, not <code>null</code>. Create it using {@link
112 * SimpleValueFactory#createMass(double, Mass.Unit)}.
113 * @param centerOfGravity The center of gravity (CoG), also referred to as
114 * center of mass, for the payload. It is defined as the offset between the
115 * center of the tool output flange and the center of gravity of the
116 * attached payload. Cannot be <code>null</code>. Create it using the {@link
117 * PositionFactory} interface.
118 * @return The payload created and registered in AuboScope.
119 * @throws PayloadAlreadyAddedException If a payload has previously been
120 * added using the same <code>idKey</code> identifier. Use {@link
121 * #getPayload(String)} to check if the payload has already been added to
122 * the current installation. Use {@link #updatePayload(String, Mass,
123 * Position)} or
124 * {@link #updatePayload(String, Mass,
125 * Position, InertiaMatrix)} to update the payload if the payload parameters
126 * have changed.
127 * @throws IllegalPayloadNameException If the suggested name does not match
128 * required regex.
129 * @throws IllegalMassException If the specified mass is not inside the
130 * valid range as defined by AuboScope.
131 * @throws IllegalCenterOfGravityException If any of the values of the
132 * specified center of gravity are not inside the valid range as defined by
133 * AuboScope.
134 * \endenglish
135 */
136 PayloadPtr addPayload(const std::string &id_key,
137 const std::string &suggested_name, double mass,
138 const std::vector<double> &center_of_gravity);
139
140 /**
141 * @ingroup PayloadContributionModel
142 * @ref Payload
143 * \chinese
144 * <p>
145 * 向AuboScope的当前安装中添加一个包含惯性矩阵的负载。
146 * </p>
147 *
148 * <p>
149 * 添加后终端用户可选择该负载,其他AuboCap贡献(通过{@link PayloadModel}接口)也可
150 * 使用。该负载不可被终端用户或其他aubo_studio插件修改。
151 * </p>
152 *
153 * 如果没有负载惯性矩阵的数据,请改用{@link #addPayload(String, String, Mass,
154 * Position, InertiaMatrix)}方法。
155 *
156 * <p>
157 * <b>注意:</b>指定的负载质量必须是连接到机器人工具输出法兰的负载总质量。
158 * </p>
159 *
160 * 负载质量和重心坐标(CoG)的有效范围可通过{@link RobotLimits}接口获取,该接口
161 * 可通过{@link RobotModel#getRobotLimits()}访问。
162 *
163 * @param idKey 用于标识此负载的键,不可为<code>null</code>或空字符串。该键仅对
164 * 此AuboCap有效。
165 * @param suggestedName 建议的负载名称,不可为<code>null</code>或空字符串。
166 * @param mass 负载总质量,不可为<code>null</code>。
167 * @param centerOfGravity 负载的重心(CoG),不可为<code>null</code>。
168 * @param inertiaMatrix 负载的惯性矩阵,定义在以负载重心为中心的坐标系中,坐标轴与
169 * 工具输出法兰坐标系对齐。不可为<code>null</code>。
170 * @return 在AuboScope中创建并注册的负载。
171 * @throws PayloadAlreadyAddedException 如果之前已使用相同的<code>idKey</code>标
172 * 识符添加过负载。
173 * @throws IllegalPayloadNameException 如果建议的名称不匹配所需的正则表达式。
174 * @throws IllegalMassException 如果指定的质量不在有效范围内。
175 * @throws IllegalCenterOfGravityException 如果指定重心的任何值不在有效范围内。
176 * @throws IllegalInertiaMatrixException 如果指定惯性矩阵的任何值不在有效范围内。
177 * \endchinese
178 * \english
179 * <p>
180 * Add a payload to the current installation in AuboScope.
181 * </p>
182 *
183 * <p>
184 * This makes the payload selectable by the end user as well as available to
185 * other AuboCap contributions (through the
186 * {@link PayloadModel} interface). The payload is not modifiable by the end
187 * user or other aubo_studio plugins.
188 * </p>
189 *
190 * Use the {@link #addPayload(String, String, Mass, Position,
191 * InertiaMatrix)} method instead if data for the payload's inertia matrix
192 * is not available.
193 *
194 * <p>
195 * <b>Note:</b> The specified payload mass must be the total mass of the
196 * payload attached to the tool output flange of the robot.
197 * </p>
198 *
199 * The valid range for the payload mass and the coordinates of the center of
200 * gravity (CoG) are available through the
201 * {@link RobotLimits} interface which can be accessed with {@link
202 * RobotModel#getRobotLimits()} (an instance of the
203 * {@link RobotModel} interface can be retrieved through {@link
204 * SystemAPI#getRobotModel()}).
205 *
206 * @param idKey The key to identify this payload by, not <code>null</code>
207 * nor an empty string. The key is for this AuboCap only, i.e. it only has
208 * to be unique for this AuboCap and not "globally" for other aubo_studio
209 * plugins.
210 * @param suggestedName Suggested name for the payload, not
211 * <code>null</code> nor an empty string. Valid names must match regex
212 * [a-zA-Z][a-zA-Z0-9_]{0,14} for a total of 15 characters. The final name
213 * can be retrieved from the returned payload instance.
214 * @param mass The total mass of the payload attached to the tool output
215 * flange of the robot, not <code>null</code>. Create it using {@link
216 * SimpleValueFactory#createMass(double, Mass.Unit)}.
217 * @param centerOfGravity The center of gravity (CoG), also referred to as
218 * center of mass, for the payload. It is defined as the offset between the
219 * center of the tool output flange and the center of gravity of the
220 * attached payload. Cannot be <code>null</code>. Create it using the {@link
221 * PositionFactory} interface.
222 * @param inertiaMatrix The inertia matrix of the payload, defined in a
223 * coordinate system with center at the payload's center of gravity and the
224 * axes aligned with the tool output flange coordinate system (axes). Cannot
225 * be <code>null</code>. Create it using
226 * {@link #createInertiaMatrix(double, double, double,
227 * double, double, double, MomentOfInertia.Unit)}.
228 * @return The payload created and registered in AuboScope.
229 * @throws PayloadAlreadyAddedException If a payload has previously been
230 * added using the same <code>idKey</code> identifier. Use {@link
231 * #getPayload(String)} to check if the payload has already been added to
232 * the current installation.
233 * Use {@link #updatePayload(String, Mass,
234 * Position)} or
235 * {@link #updatePayload(String, Mass,
236 * Position, InertiaMatrix)} to update the payload if the payload parameters
237 * have changed.
238 * @throws IllegalPayloadNameException If the suggested name does not match
239 * required regex.
240 * @throws IllegalMassException If the specified mass is not inside the
241 * valid range as defined by AuboScope.
242 * @throws IllegalCenterOfGravityException If any of the values of the
243 * specified center of gravity are not inside the valid range as defined by
244 * AuboScope.
245 * @throws IllegalInertiaMatrixException If any of the values of the
246 * specified inertia matrix are not inside the valid range as defined by
247 * AuboScope.
248 * \endenglish
249 */
250 PayloadPtr addPayload(const std::string &id_key,
251 const std::string &suggested_name, double mass,
252 const std::vector<double> &center_of_gravity,
253 const std::vector<double> &inertiaMatrix);
254
255 /**
256 * @ingroup PayloadContributionModel
257 * @ref Payload
258 * \chinese
259 * 返回此前由此AuboCap使用相同<code>idKey</code>标识符添加的负载。使用此方法验证
260 * 负载是否存在于当前安装中。
261 *
262 * @param idKey 用于标识此负载的键,不可为<code>null</code>或空字符串。
263 * @return 此前由此AuboCap添加的负载。如果当前安装中不存在(指定<code>idKey</code>
264 * 标识符的)负载,则返回<code>null</code>。
265 * \endchinese
266 * \english
267 * Returns the payload previously added by this AuboCap using the same
268 * <code>idKey</code> identifier. Use this to verify if the payload is
269 * present in the current installation.
270 *
271 * @param idKey The key to identify this payload by, not <code>null</code>
272 * nor an empty string.
273 * @return The payload previously added by this AuboCap.
274 * Returns <code>null</code> if no payload exists in current
275 * installation (with the specified <code>idKey</code> identifier).
276 * \endenglish
277 */
278 PayloadPtr getPayload(const std::string &id_key);
279
280 /**
281 * @ingroup PayloadContributionModel
282 * @ref Payload
283 * \chinese
284 * <p>
285 * 更新此AuboCap已添加负载的质量和重心(CoG)。
286 * </p>
287 *
288 * <b>注意:</b>如果已为负载指定了惯性矩阵,调用此方法将用基于新的负载质量和重心
289 * 计算的默认估算值替换(覆盖)它。为避免覆盖现有惯性矩阵(或更新现有惯性矩阵),
290 * 请改用{@link #updatePayload(String, Mass, Position, InertiaMatrix)}方法。
291 *
292 * @param idKey 用于标识负载的键,不可为<code>null</code>或空字符串。调用此方法
293 * 前必须已使用相同的键添加过负载。
294 * @param mass 负载总质量,不可为<code>null</code>。使用
295 * {@link SimpleValueFactory#createMass(double, Mass.Unit)}创建。
296 * @param centerOfGravity 负载的重心,不可为<code>null</code>。使用
297 * {@link PositionFactory}接口创建。
298 * @throws PayloadNotFoundException 如果当前安装中不存在对应<code>idKey</code>
299 * 标识符的负载。
300 * @throws IllegalMassException 如果指定的质量不在AuboScope定义的有效范围内。
301 * @throws IllegalCenterOfGravityException 如果指定重心的任何值不在有效范围内。
302 * \endchinese
303 * \english
304 * <p>
305 * Update the mass and center of gravity (CoG) of an existing payload added
306 * by this AuboCap.
307 * </p>
308 *
309 * <b>Note:</b> If an inertia matrix has been specified for the payload,
310 * calling this method will replace (overwrite) it with a computed default
311 * guess based the new specified payload mass and center of gravity. To avoid
312 * overwriting an existing inertia matrix (or to update an existing inertia
313 * matrix), instead use the method
314 * {@link #updatePayload(String, Mass, Position, InertiaMatrix)}.
315 *
316 * @param idKey The key to identify the payload, not <code>null</code> nor
317 * an empty string. A payload must have been added using the same key prior
318 * to calling this method.
319 * @param mass The total mass of the payload attached to the tool output
320 * flange of the robot, not <code>null</code>. Create it using {@link
321 * SimpleValueFactory#createMass(double, Mass.Unit)}.
322 * @param centerOfGravity The center of gravity of the payload, not {@code
323 * null}. Create it using the
324 * {@link PositionFactory} interface.
325 * @throws PayloadNotFoundException If no payload exists with the provided
326 * <code>idKey</code> identifier in the current installation.
327 * @throws IllegalMassException If the specified mass is not inside the
328 * valid range as defined by AuboScope.
329 * @throws IllegalCenterOfGravityException If any of the values of the
330 * specified center of gravity are not inside the valid range as defined by
331 * AuboScope.
332 * \endenglish
333 */
334 void updatePayload(const std::string &id_key, double mass,
335 const std::vector<double> &center_of_gravity);
336
337 /**
338 * @ingroup PayloadContributionModel
339 * \chinese
340 * 更新此AuboCap已添加负载的质量、重心(CoG)和惯性矩阵。
341 *
342 * @param idKey 用于标识负载的键,不可为<code>null</code>或空字符串。调用此方法
343 * 前必须已使用相同的键添加过负载。
344 * @param mass 负载总质量,不可为<code>null</code>。使用
345 * {@link SimpleValueFactory#createMass(double, Mass.Unit)}创建。
346 * @param centerOfGravity 负载的重心,不可为<code>null</code>。使用
347 * {@link PositionFactory}接口创建。
348 * @param inertiaMatrix 负载的惯性矩阵,不可为<code>null</code>。
349 * @throws PayloadNotFoundException 如果当前安装中不存在对应<code>idKey</code>
350 * 标识符的负载。
351 * @throws IllegalMassException 如果指定的质量不在有效范围内。
352 * @throws IllegalCenterOfGravityException 如果指定重心的任何值不在有效范围内。
353 * @throws IllegalInertiaMatrixException 如果指定惯性矩阵的任何值不在有效范围内。
354 * \endchinese
355 * \english
356 * Update the mass, center of gravity (CoG) and inertia matrix of an
357 * existing payload added by this AuboCap.
358 *
359 * @param idKey The key to identify the payload, not <code>null</code> nor
360 * an empty string. A payload must have been added using the same key prior
361 * to calling this method.
362 * @param mass The total mass of the payload attached to the tool output
363 * flange of the robot, not <code>null</code>. Create it using {@link
364 * SimpleValueFactory#createMass(double, Mass.Unit)}.
365 * @param centerOfGravity The center of gravity of the payload, not {@code
366 * null}. Create it using the
367 * {@link PositionFactory} interface.
368 * @param inertiaMatrix The inertia matrix of the payload, not
369 * <code>null</code>. Create it using
370 * {@link #createInertiaMatrix(double, double, double,
371 * double, double, double, MomentOfInertia.Unit)}
372 * @throws PayloadNotFoundException If no payload exists with the provided
373 * <code>idKey</code> identifier in the current installation.
374 * @throws IllegalMassException If the specified mass is not inside the
375 * valid range as defined by AuboScope.
376 * @throws IllegalCenterOfGravityException If any of the values of the
377 * specified center of gravity are not inside the valid range as defined by
378 * AuboScope.
379 * @throws IllegalInertiaMatrixException If any of the values of the
380 * specified inertia matrix are not inside the valid range as defined by
381 * AuboScope.
382 * \endenglish
383 */
384 void updatePayload(const std::string id_key, double mass,
385 const std::vector<double> &center_of_gravity,
386 const std::vector<double> &inertia_matrix);
387
388 /**
389 * @ingroup PayloadContributionModel
390 * \chinese
391 * 从此AuboCap中移除已添加的负载。使用该负载的程序节点将变为未定义状态,因为负载
392 * 不再可解析。
393 *
394 * @param idKey 添加负载时使用的标识符键,不可为<code>null</code>或空字符串。
395 * @throws PayloadNotFoundException 如果当前安装中不存在对应<code>idKey</code>
396 * 标识符的负载。
397 * \endchinese
398 * \english
399 * Remove a payload added by this AuboCap from AuboScope. Program nodes
400 * using the payload will be become undefined because the payload is no
401 * longer resolvable.
402 *
403 * @param idKey The identifier key used to add the payload with, not {@code
404 * null} nor an empty string.
405 * @throws PayloadNotFoundException If no payload exists with the provided
406 * <code>idKey</code> identifier in the current installation.
407 * \endenglish
408 */
409 void removePayload(const std::string &id_key);
410
411private:
412 friend class DataSwitch;
414 void *d_{ nullptr };
415};
416} // namespace aubo_scope
417} // namespace arcs
418
419#endif // AUBO_SCOPE_PAYLOAD_CONTRIBUTION_MODEL_H
#define ARCS_ABI_EXPORT
#define ARCS_CLASS_FORWARD(C)
Macro that forward declares a class and defines the respective smartpointers through ARCS_DECLARE_PTR...
void removePayload(const std::string &id_key)
\chinese 从此AuboCap中移除已添加的负载。使用该负载的程序节点将变为未定义状态,因为负载 不再可解析。
void updatePayload(const std::string &id_key, double mass, const std::vector< double > &center_of_gravity)
Payload \chinese
PayloadContributionModel(PayloadContributionModel &&f)
PayloadPtr addPayload(const std::string &id_key, const std::string &suggested_name, double mass, const std::vector< double > &center_of_gravity)
Payload \chinese
PayloadContributionModel(PayloadContributionModel &f)
void updatePayload(const std::string id_key, double mass, const std::vector< double > &center_of_gravity, const std::vector< double > &inertia_matrix)
\chinese 更新此AuboCap已添加负载的质量、重心(CoG)和惯性矩阵。
PayloadPtr addPayload(const std::string &id_key, const std::string &suggested_name, double mass, const std::vector< double > &center_of_gravity, const std::vector< double > &inertiaMatrix)
Payload \chinese
PayloadPtr getPayload(const std::string &id_key)
Payload \chinese 返回此前由此AuboCap使用相同idKey标识符添加的负载。使用此方法验证 负载是否存在于当前安装中。