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