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 * <p>
28 * Add a payload to the current installation in AuboScope.
29 * </p>
30 *
31 * <p>
32 * This makes the payload selectable by the end user as well as available to
33 * other AuboCap contributions (through the
34 * {@link PayloadModel} interface). The payload is not modifiable by the end
35 * user or other aubo_studio plugins.
36 * </p>
37 *
38 * <p>
39 * A default guess for the inertia matrix for the payload will be computed
40 * based on the specified payload mass and center of gravity. If data for
41 * the payload's inertia matrix is available, the method
42 * {@link #addPayload(String, String, Mass, Position, InertiaMatrix)} can
43 * used instead (this might give better performance of the robot arm).
44 * </p>
45 *
46 * <p>
47 * <b>Note:</b> The specified payload mass must be the total mass of the
48 * payload attached to the tool output flange of the robot.
49 * </p>
50 *
51 * The valid range for the payload mass and the coordinates of the center of
52 * gravity (CoG) are available through the
53 * {@link RobotLimits} interface which can be accessed with {@link
54 * RobotModel#getRobotLimits()} (an instance of the
55 * {@link RobotModel} interface can be retrieved through {@link
56 * SystemAPI#getRobotModel()}).
57 *
58 * @param idKey The key to identify this payload by, not <code>null</code>
59 * nor an empty string. The key is for this AuboCap only, i.e. it only has
60 * to be unique for this AuboCap and not "globally" for other aubo_studio
61 * plugins.
62 * @param suggestedName Suggested name for the payload, not
63 * <code>null</code> nor an empty string. Valid names must match regex
64 * [a-zA-Z][a-zA-Z0-9_]{0,14} for a total of 15 characters. The final name
65 * can be retrieved from the returned payload instance.
66 * @param mass The total mass of the payload attached to the tool output
67 * flange of the robot, not <code>null</code>. Create it using {@link
68 * SimpleValueFactory#createMass(double, Mass.Unit)}.
69 * @param centerOfGravity The center of gravity (CoG), also referred to as
70 * center of mass, for the payload. It is defined as the offset between the
71 * center of the tool output flange and the center of gravity of the
72 * attached payload. Cannot be <code>null</code>. Create it using the {@link
73 * PositionFactory} interface.
74 * @return The payload created and registered in AuboScope.
75 * @throws PayloadAlreadyAddedException If a payload has previously been
76 * added using the same <code>idKey</code> identifier. Use {@link
77 * #getPayload(String)} to check if the payload has already been added to
78 * the current installation. Use {@link #updatePayload(String, Mass,
79 * Position)} or
80 * {@link #updatePayload(String, Mass,
81 * Position, InertiaMatrix)} to update the payload if the payload parameters
82 * have changed.
83 * @throws IllegalPayloadNameException If the suggested name does not match
84 * required regex.
85 * @throws IllegalMassException If the specified mass is not inside the
86 * valid range as defined by AuboScope.
87 * @throws IllegalCenterOfGravityException If any of the values of the
88 * specified center of gravity are not inside the valid range as defined by
89 * AuboScope.
90 */
91 PayloadPtr addPayload(const std::string &id_key,
92 const std::string &suggested_name, double mass,
93 const std::vector<double> &center_of_gravity);
94
95 /**
96 * @ingroup PayloadContributionModel
97 * @ref Payload
98 * <p>
99 * Add a payload to the current installation in AuboScope.
100 * </p>
101 *
102 * <p>
103 * This makes the payload selectable by the end user as well as available to
104 * other AuboCap contributions (through the
105 * {@link PayloadModel} interface). The payload is not modifiable by the end
106 * user or other aubo_studio plugins.
107 * </p>
108 *
109 * Use the {@link #addPayload(String, String, Mass, Position,
110 * InertiaMatrix)} method instead if data for the payload's inertia matrix
111 * is not available.
112 *
113 * <p>
114 * <b>Note:</b> The specified payload mass must be the total mass of the
115 * payload attached to the tool output flange of the robot.
116 * </p>
117 *
118 * The valid range for the payload mass and the coordinates of the center of
119 * gravity (CoG) are available through the
120 * {@link RobotLimits} interface which can be accessed with {@link
121 * RobotModel#getRobotLimits()} (an instance of the
122 * {@link RobotModel} interface can be retrieved through {@link
123 * SystemAPI#getRobotModel()}).
124 *
125 * @param idKey The key to identify this payload by, not <code>null</code>
126 * nor an empty string. The key is for this AuboCap only, i.e. it only has
127 * to be unique for this AuboCap and not "globally" for other aubo_studio
128 * plugins.
129 * @param suggestedName Suggested name for the payload, not
130 * <code>null</code> nor an empty string. Valid names must match regex
131 * [a-zA-Z][a-zA-Z0-9_]{0,14} for a total of 15 characters. The final name
132 * can be retrieved from the returned payload instance.
133 * @param mass The total mass of the payload attached to the tool output
134 * flange of the robot, not <code>null</code>. Create it using {@link
135 * SimpleValueFactory#createMass(double, Mass.Unit)}.
136 * @param centerOfGravity The center of gravity (CoG), also referred to as
137 * center of mass, for the payload. It is defined as the offset between the
138 * center of the tool output flange and the center of gravity of the
139 * attached payload. Cannot be <code>null</code>. Create it using the {@link
140 * PositionFactory} interface.
141 * @param inertiaMatrix The inertia matrix of the payload, defined in a
142 * coordinate system with center at the payload's center of gravity and the
143 * axes aligned with the tool output flange coordinate system (axes). Cannot
144 * be <code>null</code>. Create it using
145 * {@link #createInertiaMatrix(double, double, double,
146 * double, double, double, MomentOfInertia.Unit)}.
147 * @return The payload created and registered in AuboScope.
148 * @throws PayloadAlreadyAddedException If a payload has previously been
149 * added using the same <code>idKey</code> identifier. Use {@link
150 * #getPayload(String)} to check if the payload has already been added to
151 * the current installation.
152 * Use {@link #updatePayload(String, Mass,
153 * Position)} or
154 * {@link #updatePayload(String, Mass,
155 * Position, InertiaMatrix)} to update the payload if the payload parameters
156 * have changed.
157 * @throws IllegalPayloadNameException If the suggested name does not match
158 * required regex.
159 * @throws IllegalMassException If the specified mass is not inside the
160 * valid range as defined by AuboScope.
161 * @throws IllegalCenterOfGravityException If any of the values of the
162 * specified center of gravity are not inside the valid range as defined by
163 * AuboScope.
164 * @throws IllegalInertiaMatrixException If any of the values of the
165 * specified inertia matrix are not inside the valid range as defined by
166 * AuboScope.
167 */
168 PayloadPtr addPayload(const std::string &id_key,
169 const std::string &suggested_name, double mass,
170 const std::vector<double> &center_of_gravity,
171 const std::vector<double> &inertiaMatrix);
172
173 /**
174 * @ingroup PayloadContributionModel
175 * @ref Payload
176 * Returns the payload previously added by this AuboCap using the same
177 * <code>idKey</code> identifier. Use this to verify if the payload is
178 * present in the current installation.
179 *
180 * @param idKey The key to identify this payload by, not <code>null</code>
181 * nor an empty string.
182 * @return The payload previously added by this AuboCap.
183 * Returns <code>null</code> if no payload exists in current
184 * installation (with the specified <code>idKey</code> identifier).
185 */
186 PayloadPtr getPayload(const std::string &id_key);
187
188 /**
189 * @ingroup PayloadContributionModel
190 * @ref Payload
191 * <p>
192 * Update the mass and center of gravity (CoG) of an existing payload added
193 *by this AuboCap.
194 * </p>
195 *
196 * <b>Note:</b> If an inertia matrix has been specified for the payload,
197 *calling this method will replace (overwrite) it with a computed default
198 *guess based the new specified payload mass and center of gravity. To avoid
199 *overwriting an existing inertia matrix (or to update an existing inertia
200 *matrix), instead use the method
201 *{@link #updatePayload(String, Mass, Position, InertiaMatrix)}.
202 *
203 * @param idKey The key to identify the payload, not <code>null</code> nor
204 *an empty string. A payload must have been added using the same key prior
205 *to calling this method.
206 * @param mass The total mass of the payload attached to the tool output
207 *flange of the robot, not <code>null</code>. Create it using {@link
208 *SimpleValueFactory#createMass(double, Mass.Unit)}.
209 * @param centerOfGravity The center of gravity of the payload, not {@code
210 *null}. Create it using the
211 * {@link PositionFactory} interface.
212 * @throws PayloadNotFoundException If no payload exists with the provided
213 *<code>idKey</code> identifier in the current installation.
214 * @throws IllegalMassException If the specified mass is not inside the
215 *valid range as defined by AuboScope.
216 * @throws IllegalCenterOfGravityException If any of the values of the
217 *specified center of gravity are not inside the valid range as defined by
218 *AuboScope.
219 */
220
221 void updatePayload(const std::string &id_key, double mass,
222 const std::vector<double> &center_of_gravity);
223
224 /**
225 * @ingroup PayloadContributionModel
226 * Update the mass, center of gravity (CoG) and inertia matrix of an
227 * existing payload added by this AuboCap.
228 *
229 * @param idKey The key to identify the payload, not <code>null</code> nor
230 * an empty string. A payload must have been added using the same key prior
231 * to calling this method.
232 * @param mass The total mass of the payload attached to the tool output
233 * flange of the robot, not <code>null</code>. Create it using {@link
234 * SimpleValueFactory#createMass(double, Mass.Unit)}.
235 * @param centerOfGravity The center of gravity of the payload, not {@code
236 * null}. Create it using the
237 * {@link PositionFactory} interface.
238 * @param inertiaMatrix The inertia matrix of the payload, not
239 * <code>null</code>. Create it using
240 * {@link #createInertiaMatrix(double, double, double,
241 * double, double, double, MomentOfInertia.Unit)}
242 * @throws PayloadNotFoundException If no payload exists with the provided
243 * <code>idKey</code> identifier in the current installation.
244 * @throws IllegalMassException If the specified mass is not inside the
245 * valid range as defined by AuboScope.
246 * @throws IllegalCenterOfGravityException If any of the values of the
247 * specified center of gravity are not inside the valid range as defined by
248 * AuboScope.
249 * @throws IllegalInertiaMatrixException If any of the values of the
250 * specified inertia matrix are not inside the valid range as defined by
251 * AuboScope.
252 */
253 void updatePayload(const std::string id_key, double mass,
254 const std::vector<double> &center_of_gravity,
255 const std::vector<double> &inertia_matrix);
256
257 /**
258 * @ingroup PayloadContributionModel
259 * Remove a payload added by this AuboCap from AuboScope. Program nodes
260 * using the payload will be become undefined because the payload is no
261 * longer resolvable.
262 *
263 * @param idKey The identifier key used to add the payload with, not {@code
264 * null} nor an empty string.
265 * @throws PayloadNotFoundException If no payload exists with the provided
266 * <code>idKey</code> identifier in the current installation.
267 */
268 void removePayload(const std::string &id_key);
269
270private:
271 friend class DataSwitch;
273 void *d_{ nullptr };
274};
275} // namespace aubo_scope
276} // namespace arcs
277
278#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)
Remove a payload added by this AuboCap from AuboScope.
void updatePayload(const std::string &id_key, double mass, const std::vector< double > &center_of_gravity)
Payload
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
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)
Update the mass, center of gravity (CoG) and inertia matrix of an existing payload added by this Aubo...
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
PayloadPtr getPayload(const std::string &id_key)
Payload Returns the payload previously added by this AuboCap using the same idKey identifier.