AuboStudio SDK  0.6.3
screw_driver_configuration.h
浏览该文件的文档.
1#ifndef AUBO_SCOPE_SCREW_DIRVER_CONFIGURATION_H
2#define AUBO_SCOPE_SCREW_DIRVER_CONFIGURATION_H
3
4#include <functional>
7
8namespace arcs {
9namespace aubo_scope {
10
12/**
13 * <p>
14 * This interface provides parameters relevant for generating script code for
15 * the Program Selection capability (registered using {@link
16 * ScrewdriverCapabilities#registerProgramSelectionCapability(ScrewdriverProgramListProvider,
17 * ScriptCodeGenerator)}).
18 * </p>
19 *
20 * These parameters are passed when AuboScope calls the implementation of the
21 * {@link ScriptCodeGenerator#generateScript(ScriptWriter, Object)} method
22 * responsible for the generating the script code.
23 */
25{
26public:
27 virtual ~ProgramSelectionParameters() = default;
28
29 /**
30 * @return The selected screwdriver program to use for the operation.
31 * @throws UnsupportedOperationException if the screwdriver has not
32 * registered this capability
33 */
35
36 /**
37 * @return The operation type selected by the end user.
38 * @throws UnsupportedOperationException if the screwdriver has not
39 * registered this capability
40 */
42};
43
45/**
46 * <p>
47 * This interface provides parameters relevant for generating script code for
48 * the Prepare To Start Screwdriver capability (registered using {@link
49 * ScrewdriverCapabilities#registerPrepareToStartScrewdriverCapability(ScriptCodeGenerator)}).
50 * </p>
51 *
52 * <p>
53 * These parameters are passed when AuboScope calls the implementation of the
54 * {@link ScriptCodeGenerator#generateScript(ScriptWriter, Object)} method
55 * responsible for the generating the script code.
56 * </p>
57 *
58 * The interface is intentionally empty, but could have parameters in future
59 * releases.
60 */
66
68/**
69 * <p>
70 * This interface provides parameters relevant for generating script code for
71 * the Feed Screw capability (registered using {@link
72 * ScrewdriverCapabilities#registerFeedScrewCapability(ScriptCodeGenerator)}).
73 * </p>
74 *
75 * <p>
76 * These parameters are passed when AuboScope calls the implementation of the
77 * {@link ScriptCodeGenerator#generateScript(ScriptWriter, Object)} method
78 * responsible for the generating the script code.
79 * </p>
80 *
81 * The interface is intentionally empty, but could have parameters in future
82 * releases.
83 */
85{
86public:
87 virtual ~FeedScrewParameters() = default;
88};
89
91/**
92 * <p>
93 * This interface provides parameters relevant for generating script code for
94 * the Drive Screw Not OK feedback capability (registered using {@link
95 * ScrewdriverFeedbackCapabilities#registerDriveScrewNotOKCapability(ScriptCodeGenerator)}).
96 * </p>
97 *
98 * <p>
99 * These parameters are passed when AuboScope calls the implementation of the
100 * {@link ScriptCodeGenerator#generateScript(ScriptWriter, Object)} method
101 * responsible for the generating the script code.
102 * </p>
103 *
104 * The interface is intentionally empty, but could have parameters in future
105 * releases.
106 */
108{
109public:
110 virtual ~DriveScrewNotOKParameters() = default;
111};
112
114/**
115 * <p>
116 * This interface provides parameters relevant for generating script code for
117 * the Drive Screw OK feedback capability (registered using {@link
118 * ScrewdriverFeedbackCapabilities#registerDriveScrewOKCapability(ScriptCodeGenerator)}).
119 * </p>
120 *
121 * <p>
122 * These parameters are passed when AuboScope calls the implementation of the
123 * {@link ScriptCodeGenerator#generateScript(ScriptWriter, Object)} method
124 * responsible for the generating the script code.
125 * </p>
126 *
127 * The interface is intentionally empty, but could have parameters in future
128 * releases.
129 */
131{
132public:
133 virtual ~DriveScrewOKParameters() = default;
134};
135
137/**
138 * This interface provides the parameters relevant for generating script for the
139 * Screwdriver Ready feedback operation capability (registered using {@link
140 * ScrewdriverFeedbackCapabilities#registerScrewdriverReadyCapability(ScriptCodeGenerator)}).
141 *
142 * <p>
143 * These parameters are passed when AuboScope calls the implementation of the
144 * {@link ScriptCodeGenerator#generateScript(ScriptWriter, Object)} method
145 * responsible for the generating the script code.
146 * </p>
147 *
148 * The interface is intentionally empty, but could have parameters in future
149 * releases.
150 */
152{
153public:
154 virtual ~ScrewdriverReadyParameters() = default;
155};
156
158/**
159 * This interface provides access to register or setup various properties and
160 * capabilities of a screwdriver. It is optional to register these capabilities
161 * and properties.
162 */
164{
165public:
166 virtual ~ScrewdriverConfiguration() = default;
167
168 /**
169 * Add a screwdriver program to the list of programs.
170 *
171 * @param screwdriverProgram program to add, not <code>null</code>
172 * @throws DuplicateScrewdriverProgramID if the ids of the screwdriver
173 * programs (returned by the method {@link ScrewdriverProgram#getId()})
174 * are not unique.
175 * @throws NameOfScrewdriverProgramCannotBeNullOrEmpty if the display name
176 * of a program (returned by the method {@link
177 * ScrewdriverProgram#getDisplayName()}) is <code>null</code> or an empty
178 * string.
179 */
181 ScrewdriverProgramPtr screwdriverProgram) = 0;
182
183 /**
184 * Add a list of screwdriver programs to the list of programs.
185 *
186 * @param screwdriverProgramList list of programs to add, not
187 * <code>null</code>
188 * @throws DuplicateScrewdriverProgramID if the ids of the screwdriver
189 * programs (returned by the method
190 * {@link ScrewdriverProgram#getId()})
191 * are not unique.
192 * @throws NameOfScrewdriverProgramCannotBeNullOrEmpty if the display name
193 * of a program (returned by the method
194 * {@link
195 * ScrewdriverProgram#getDisplayName()}) is <code>null</code> or an empty
196 * string.
197 */
199 std::vector<ScrewdriverProgramPtr> screwdriverProgramList) = 0;
200
201 /**
202 * <p>
203 * Register a program selection capability for a screwdriver that supports
204 * selecting between a set of screwdriver programs, typically defined on an
205 * external control box for the screwdriver.
206 * </p>
207 *
208 * <p>
209 * The provided implementation of the {@link ScriptCodeGenerator} interface
210 * must generate the script code for selecting the specified screwdriver
211 * program. The return value of the script code must be a boolean, i.e.
212 * 'True' or 'False'. 'True' must be returned if selecting the program
213 * succeeded and 'False' must be returned if the program selection failed.
214 * </p>
215 *
216 * The generated script code is executed before the script code for starting
217 * the screwdriver (could be from a different node), i.e the script code
218 * generated by
219 * {@link
220 * ScrewdriverContribution#generateStartScrewdriverScript(ScriptWriter,
221 * ScrewdriverParameters)}.
222 *
223 * @param programListProvider provider of the list of screwdriver programs,
224 * not <code>null</code>
225 * @param scriptCodeGenerator script code generator responsible for
226 * generating the script code for selecting the specified screwdriver
227 * program. When the script code needs to be generated, the
228 * {@link
229 * ScriptCodeGenerator#generateScript(ScriptWriter, Object)} method will be
230 * called (by AuboScope). Return value for the generated script code must be
231 * a boolean, i.e. 'True' or 'False'.
232 * @throws CapabilityAlreadyRegistered if this capability has already been
233 * registered
234 * @throws CalledOutsideScrewdriverConfigurationPhase if this method is
235 * called at the wrong time, i.e. outside the scope of the {@link
236 * ScrewdriverContribution#configureScrewdriver(ScrewdriverConfiguration,
237 * ScrewdriverApiProvider)} method.
238 */
240 std::function<void(ScriptWriterPtr, ProgramSelectionParametersPtr)>
241 scriptCodeGenerator) = 0;
242
243 /**
244 * Register an operation type capability for a screwdriver that
245 * supports/requires the parameter for the screwdriving operation type (i.e.
246 * if the operation is Tighten or Loosen).
247 *
248 * @throws CapabilityAlreadyRegistered if this capability has already been
249 * registered
250 * @throws CalledOutsideScrewdriverConfigurationPhase if this method is
251 * called at the wrong time, i.e. outside the scope of the {@link
252 * ScrewdriverContribution#configureScrewdriver(ScrewdriverConfiguration,
253 * ScrewdriverApiProvider)} method.
254 */
256
257 /**
258 * <p>
259 * Register a capability/requirement for a screwdriver that needs to
260 * generate script code for preparing the screwdriver for a screwdriving
261 * operation (before starting the screw driver).
262 * </p>
263 *
264 * <p>
265 * The provided implementation of the {@link ScriptCodeGenerator} interface
266 * must generate the script code for preparing the screwdriver. The return
267 * value of the script code must be a boolean, i.e. 'True' or 'False'.
268 * 'True' must be returned if the preparation of the screwdriver was
269 * successful and 'False' must be returned if the preparation failed.
270 * </p>
271 *
272 * The generated script code is executed before the script code for starting
273 * the screwdriver (could be from a different node), i.e the script code
274 * generated by
275 * {@link
276 * ScrewdriverContribution#generateStartScrewdriverScript(ScriptWriter,
277 * ScrewdriverParameters)}.
278 *
279 * @param scriptCodeGenerator script code generator responsible for
280 * generating the script code for preparing the screwdriver. When the script
281 * code needs to be generated, the
282 * {@link
283 * ScriptCodeGenerator#generateScript(ScriptWriter, Object)} method will be
284 * called (by AuboScope). Return value for the generated script code must be
285 * a boolean, i.e. 'True' or 'False'.
286 * @throws CapabilityAlreadyRegistered if this capability has already been
287 * registered
288 * @throws CalledOutsideScrewdriverConfigurationPhase if this method is
289 * called at the wrong time, i.e. outside the scope of the {@link
290 * ScrewdriverContribution#configureScrewdriver(ScrewdriverConfiguration,
291 * ScrewdriverApiProvider)} method.
292 */
294 std::function<void(ScriptWriterPtr,
295 PrepareToStartScrewdriverParametersPtr)>
296 scriptCodeGenerator) = 0;
297
298 /**
299 * <p>
300 * Register a capability for a screwdriver that supports automatic screw
301 * feeding.
302 * </p>
303 *
304 * <p>
305 * The provided implementation of the {@link ScriptCodeGenerator} interface
306 * must generate the script code for feeding a screw to the screwdriver. The
307 * return value of the script code must be a boolean, i.e. 'True' or
308 * 'False'. 'True' must be returned if the screw feed operation was
309 * successful and 'False' must be returned if the operation failed.
310 * </p>
311 *
312 * The generated script code is executed before the script code for
313 * preparing the screwdriver, i.e the script code generated by {@link
314 * #registerPrepareToStartScrewdriverCapability(ScriptCodeGenerator)}.
315 *
316 * @param scriptCodeGenerator script code generator responsible for
317 * generating the script code for feeding a screw to the screwdriver. When
318 * the script code needs to be generated, the
319 * {@link
320 * ScriptCodeGenerator#generateScript(ScriptWriter, Object)} method will be
321 * called (by AuboScope). Return value for the generated script code must be
322 * a boolean, i.e. 'True' or 'False'
323 * @throws CapabilityAlreadyRegistered if this capability has already been
324 * registered
325 * @throws CalledOutsideScrewdriverConfigurationPhase if this method is
326 * called at the wrong time, i.e. outside the scope of the {@link
327 * ScrewdriverContribution#configureScrewdriver(ScrewdriverConfiguration,
328 * ScrewdriverApiProvider)} method.
329 */
331 std::function<void(ScriptWriterPtr, FeedScrewParametersPtr)>
332 scriptCodeGenerator) = 0;
333
334 /**
335 * <p>
336 * Register a feedback capability for a screwdriver that is capable of
337 * providing information about whether or not an ongoing screwdriving
338 * operation (driving the screw) ended successfully (ended in OK-state).
339 * </p>
340 *
341 * <p>
342 * <b>Note:</b> This capability must only be used to provide feedback about
343 * the success of the screwing operation. It should not be used to provide
344 * feedback about failures. To support feedback about when the operation
345 * fails, register the Drive Screw Not Ok feedback capability the using the
346 * {@link #registerDriveScrewNotOKCapability(ScriptCodeGenerator)} method.
347 * </p>
348 *
349 * <p>
350 * The provided implementation of the {@link ScriptCodeGenerator} interface
351 * must generate the script code for determining if the screwing operation
352 * succeeded. The return value of the script code must be a boolean, i.e.
353 * 'True' or 'False'. 'True' must be returned if the screwing operation was
354 * successful, otherwise 'False' must be returned.
355 * </p>
356 *
357 * <p>
358 * <b>Note:</b> A return value of 'False' must not be used to indicate that
359 * the operation failed, but simply that a success was not (yet) detected.
360 * If the screwdriver can provide feedback on whether or not the screwing
361 * operation failed, the Drive Screw Not Ok feedback capability must be
362 * used.
363 * </p>
364 *
365 * <b>Example:</b> <br>
366 * The digital tool input 0 will go high if the operation ended in OK-state.
367 * The script code is: <pre> return get_tool_digital_in(0)
368 * </pre>
369 *
370 * So the implementation of {@link
371 * ScriptCodeGenerator#generateScript(ScriptWriter, Object)} could be: <pre>
372 * scriptWriter.appendLine("return get_tool_digital_in(0)");
373 * </pre>
374 *
375 * @param scriptCodeGenerator script code generator responsible for
376 * generating the script code for determining if the screwing operation
377 * succeeded. When the script code needs to be generated, the
378 * {@link
379 * ScriptCodeGenerator#generateScript(ScriptWriter, Object)} method will be
380 * called (by AuboScope). Return value for the
381 * generated script code must be a boolean, i.e. 'True' or 'False'.
382 * @throws CapabilityAlreadyRegistered if this capability has already been
383 * registered
384 * @throws CalledOutsideScrewdriverConfigurationPhase if this method is
385 * called at the wrong time, i.e. outside the scope of the {@link
386 * ScrewdriverContribution#configureScrewdriver(ScrewdriverConfiguration,
387 * ScrewdriverApiProvider)} method.
388 */
390 std::function<void(ScriptWriterPtr, DriveScrewOKParametersPtr)>
391 scriptCodeGenerator) = 0;
392
393 /**
394 * <p>
395 * Register a feedback capability for a screwdriver that is capable of
396 * providing information about whether or not an ongoing screwdriving
397 * operation (driving the screw) failed, i.e. ended in Not Ok (NOK) state.
398 * </p>
399 *
400 * <p>
401 * <b>Note:</b> This capability must only be used to provide feedback about
402 * the failure of the screwing operation. It should not be used to provide
403 * feedback about successes. To support feedback about when the operation
404 * succeeds, register the Drive Screw Ok feedback capability the using the
405 * {@link #registerDriveScrewOKCapability(ScriptCodeGenerator)} method.
406 * </p>
407 *
408 * <p>
409 * The provided implementation of the {@link ScriptCodeGenerator} interface
410 * must generate the script code for determining if the screwing operation
411 * ended in failure. The return value of the script code must be a boolean,
412 * i.e. 'True' or 'False'. 'True' must be returned if the screwing operation
413 * failed, otherwise 'False' must be returned.
414 * </p>
415 *
416 * <p>
417 * <b>Note:</b> A return value of 'False' must not be used to indicate that
418 * the operation succeeded, but simply that a failure was not (yet)
419 * detected. If the screwdriver can provide feedback on whether or not the
420 * screwing operation succeeded, the Drive Screw Ok feedback capability
421 * should be used.
422 * </p>
423 *
424 * <b>Example:</b> <br>
425 * The digital tool input 1 will go high if the operation ended in NOT
426 * OK-state. The script code is: <pre> return get_tool_digital_in(1)
427 * </pre>
428 * So the implementation of {@link
429 * ScriptCodeGenerator#generateScript(ScriptWriter, Object)} could be: <pre>
430 * scriptWriter.appendLine("return get_tool_digital_in(1)");
431 * </pre>
432 *
433 *
434 * @param scriptCodeGenerator script code generator responsible for
435 * generating the script code for determining if the screwing operation
436 * failed. When the script code needs to be generated, the {@link
437 * ScriptCodeGenerator#generateScript(ScriptWriter, Object)} method will be
438 * called (by AuboScope). Return value for the
439 * generated script code must be a boolean, i.e. 'True' or 'False'.
440 * @throws CapabilityAlreadyRegistered if this capability has already been
441 * registered
442 * @throws CalledOutsideScrewdriverConfigurationPhase if this method is
443 * called at the wrong time, i.e. outside the scope of the {@link
444 * ScrewdriverContribution#configureScrewdriver(ScrewdriverConfiguration,
445 * ScrewdriverApiProvider)} method.
446 */
448 std::function<void(ScriptWriterPtr, DriveScrewNotOKParametersPtr)>
449 scriptCodeGenerator) = 0;
450
451 /**
452 * <p>
453 * Register a feedback capability for a screwdriver that is capable of
454 * providing information about whether or not the screwdriver device is
455 * ready to operate (receive commands). This capability is used (by
456 * AuboScope) in a program to ensure that the screwdriver is ready before
457 * sending commands to it.
458 * </p>
459 *
460 * <p>
461 * The provided implementation of the {@link ScriptCodeGenerator} interface
462 * must generate the script code for determining if the screwdriver is
463 * ready. The return value of the script code must be a boolean, i.e. 'True'
464 * or 'False'. 'True' must be returned if the screwdriver is ready,
465 * otherwise 'False' must be returned.
466 * </p>
467 *
468 * The generated script code is executed before the script code for the
469 * program selected capability (if that capability has been registered).
470 *
471 * @param scriptCodeGenerator script code generator responsible for
472 * generating the script code for determining if the screwdriver is ready.
473 * When the script code needs to be generated, the
474 * {@link
475 * ScriptCodeGenerator#generateScript(ScriptWriter, Object)} method will be
476 * called (by AuboScope). Return value for the
477 * generated script code must be a boolean, i.e. 'True' or 'False'.
478 * @throws CapabilityAlreadyRegistered if this capability has already been
479 * registered
480 * @throws CalledOutsideScrewdriverConfigurationPhase if this method is
481 * called at the wrong time, i.e. outside the scope of the {@link
482 * ScrewdriverContribution#configureScrewdriver(ScrewdriverConfiguration,
483 * ScrewdriverApiProvider)} method.
484 */
486 std::function<void(ScriptWriterPtr, ScrewdriverReadyParametersPtr)>
487 scriptCodeGenerator) = 0;
488};
489} // namespace aubo_scope
490} // namespace arcs
491
492#endif
#define ARCS_CLASS_FORWARD(C)
Macro that forward declares a class and defines the respective smartpointers through ARCS_DECLARE_PTR...
virtual ScrewdriverOperationType getScrewdriverOperationType()=0
virtual ScrewdriverProgram getScrewdriverProgram()=0
This interface provides access to register or setup various properties and capabilities of a screwdri...
virtual void addScrewdriverPrograms(std::vector< ScrewdriverProgramPtr > screwdriverProgramList)=0
Add a list of screwdriver programs to the list of programs.
virtual void registerDriveScrewOKCapability(std::function< void(ScriptWriterPtr, DriveScrewOKParametersPtr)> scriptCodeGenerator)=0
virtual void registerScrewdriverReadyCapability(std::function< void(ScriptWriterPtr, ScrewdriverReadyParametersPtr)> scriptCodeGenerator)=0
virtual void registerProgramSelectionCapability(std::function< void(ScriptWriterPtr, ProgramSelectionParametersPtr)> scriptCodeGenerator)=0
virtual void registerOperationTypeCapability()=0
Register an operation type capability for a screwdriver that supports/requires the parameter for the ...
virtual void addScrewdriverProgram(ScrewdriverProgramPtr screwdriverProgram)=0
Add a screwdriver program to the list of programs.
virtual void registerFeedScrewCapability(std::function< void(ScriptWriterPtr, FeedScrewParametersPtr)> scriptCodeGenerator)=0
virtual void registerPrepareToStartScrewdriverCapability(std::function< void(ScriptWriterPtr, PrepareToStartScrewdriverParametersPtr)> scriptCodeGenerator)=0
virtual void registerDriveScrewNotOKCapability(std::function< void(ScriptWriterPtr, DriveScrewNotOKParametersPtr)> scriptCodeGenerator)=0
This abstract class represents a screwdriver program, typically defined on an external control box fo...
This interface provides the parameters relevant for generating script for the Screwdriver Ready feedb...
ScrewdriverOperationType
This interface represents the type of screwing operation performed by the screwdriver.