AuboCaps  0.6.0
gripper_configuration.h
Go to the documentation of this file.
1 #ifndef AUBO_SCOPE_GRIPPER_CONFIGURATION_H
2 #define AUBO_SCOPE_GRIPPER_CONFIGURATION_H
3 
4 #include <functional>
10 
11 namespace arcs {
12 namespace aubo_scope {
13 ARCS_CLASS_FORWARD(GripperConfiguration);
14 
15 /**
16  * This interface provides access to register or setup various properties and
17  * capabilities of a gripper. It is optional to register these capabilities and
18  * properties.
19  */
21 {
22 public:
23  virtual ~GripperConfiguration() = default;
24 
25  /**
26  * Register a width/position capability for a gripper that supports moving
27  * to a user configurable position (open/close to a configurable width).
28  *
29  * @param minWidth The minimum width supported by the gripper
30  * @param maxWidth The maximum width supported by the gripper
31  * @param defaultGripWidth default value for the width for a grip action.
32  * This value is used for, e.g. performing a "default" grip action using the
33  * toolbar
34  * @param defaultReleaseWidth default value for the width for a release
35  * action. This value is used for, e.g. performing a "default" release
36  * action using the toolbar
37  * @param unit the unit for all specified values, not <code>null</code>
38  * @return a width capability allowing for dynamic adjustments of the
39  * capability properties including the value range and default values
40  * @throws InvalidCapabilityRange if <code>minWidth</code> >
41  * <code>maxWidth</code>
42  * @throws InvalidCapabilityRange if <code>defaultGripWidth</code> or
43  * <code>defaultReleaseWidth</code> is outside the range defined by
44  * <code>minWidth</code> and <code>maxWidth</code>.
45  * @throws CapabilityAlreadyRegistered if this capability has already been
46  * registered
47  * @throws CalledOutsideGripperConfigurationPhase if this method is called
48  * at the wrong time by a AuboCap implementing the {@link
49  * GripperContribution} interface, i.e. called outside the scope of the
50  * configuration of the gripper.
51  * @throws CalledOutsideMethodScope if this method is called at the wrong
52  * time by a (regular) AuboCap which has registered its program node
53  * contribution/service as conformant with a AuboScope gripper (using
54  * {@link GripperRegistrationManager#registerAsGripper(Class)}),
55  * i.e. called outside the scope of the call to either {@link
56  * SwingProgramNodeService#configureContribution(ContributionConfiguration)}
57  * (for a Swing-based AuboCap) or {@link
58  * ProgramNodeServiceConfigurable#configureContribution(ProgramNodeConfiguration)}
59  * (for a HTML-based AuboCap).
60  */
61  virtual WidthCapabilityPtr registerWidthCapability(
62  double minWidth, double maxWidth, double defaultGripWidth,
63  double defaultReleaseWidth) = 0;
64 
65  /**
66  * Register a force capability for a gripper that supports gripping using a
67  * user configurable force.
68  *
69  * @param minForce minimum force supported by the gripper
70  * @param maxForce maximum force supported by the gripper
71  * @param defaultGripForce default value for the force for a grip action.
72  * This value is used for, e.g. performing a "default" grip action using the
73  * toolbar
74  * @param unit the unit for all specified values, <code>null</code>
75  * @return a force capability allowing for dynamic adjustments of the
76  * capability properties including the value range and default value
77  * @throws InvalidCapabilityRange if <code>minForce</code> >
78  * <code>maxForce</code> or <code>defaultGripForce</code> is outside the
79  * range defined by <code>minForce</code> and <code>maxForce</code>.
80  * @throws CapabilityAlreadyRegistered if this capability has already been
81  * registered
82  * @throws CalledOutsideGripperConfigurationPhase if this method is called
83  * at the wrong time by a AuboCap implementing the {@link
84  * GripperContribution} interface, i.e. called outside the scope of the
85  * configuration of the gripper.
86  * @throws CalledOutsideMethodScope if this method is called at the wrong
87  * time by a (regular) AuboCap which has registered its program node
88  * contribution/service as conformant with a AuboScope gripper (using
89  * {@link GripperRegistrationManager#registerAsGripper(Class)}),
90  * i.e. called outside the scope of the call to either {@link
91  * SwingProgramNodeService#configureContribution(ContributionConfiguration)}
92  * (for a Swing-based AuboCap) or {@link
93  * ProgramNodeServiceConfigurable#configureContribution(ProgramNodeConfiguration)}
94  * (for a HTML-based AuboCap).
95  */
96  virtual GripForceCapabilityPtr registerGrippingForceCapability(
97  double minForce, double maxForce, double defaultGripForce) = 0;
98 
99  /**
100  * Register a speed capability for a gripper that supports operating using a
101  * user configurable speed.
102  *
103  * @param minSpeed minimum speed supported by the gripper
104  * @param maxSpeed maximum speed supported by the gripper
105  * @param defaultGripSpeed default value for the speed for a grip action.
106  * This value is used for, e.g. performing a "default" grip action using the
107  * toolbar
108  * @param defaultReleaseSpeed default value for the speed for a grip action.
109  * This value is used for, e.g. performing a "default" release action using
110  * the toolbar
111  * @param unit the unit for all specified values, not <code>null</code>
112  * @return a speed capability allowing for dynamic adjustments of the
113  * capability properties including the value range and default values
114  * @throws InvalidCapabilityRange if <code>minSpeed</code> >
115  * <code>maxSpeed</code>
116  * @throws InvalidCapabilityRange if <code>defaultGripSpeed</code> or
117  * defaultReleaseSpeed</code> is outside the range defined by
118  * <code>minSpeed</code> and <code>maxSpeed</code>.
119  * @throws CapabilityAlreadyRegistered if this capability has already been
120  * registered
121  * @throws CalledOutsideGripperConfigurationPhase if this method is called
122  * at the wrong time by a AuboCap implementing the {@link
123  * GripperContribution} interface, i.e. called outside the scope of the
124  * configuration of the gripper.
125  * @throws CalledOutsideMethodScope if this method is called at the wrong
126  * time by a (regular) AuboCap which has registered its program node
127  * contribution/service as conformant with a AuboScope gripper (using
128  * {@link GripperRegistrationManager#registerAsGripper(Class)}),
129  * i.e. called outside the scope of the call to either {@link
130  * SwingProgramNodeService#configureContribution(ContributionConfiguration)}
131  * (for a Swing-based AuboCap) or {@link
132  * ProgramNodeServiceConfigurable#configureContribution(ProgramNodeConfiguration)}
133  * (for a HTML-based AuboCap).
134  */
135  virtual SpeedCapabilityPtr registerSpeedCapability(
136  double minSpeed, double maxSpeed, double defaultGripSpeed,
137  double defaultReleaseSpeed) = 0;
138 
139  /**
140  * <p>
141  * Register a vacuum capability for a gripper that supports gripping using a
142  * user configurable vacuum level.
143  * </p>
144  *
145  * If the gripper works with absolute pressure, specify a positive range for
146  * the supported vacuum level. If the gripper works with relative pressure
147  * (vacuum), specify a negative range for the supported vacuum level.
148  *
149  * @param minVacuum minimum vacuum level supported by the gripper
150  * @param maxVacuum maximum vacuum level supported by the gripper
151  * @param defaultGripVacuum default value for the vacuum level for a grip
152  * action. This value is used for, e.g. performing a "default" grip action
153  * using the toolbar
154  * @param unit the unit for all specified values, not <code>null</code>
155  * @return a vacuum capability allowing for dynamic adjustments of the
156  * capability properties including the value range and default value
157  * @throws InvalidCapabilityRange if <code>minVacuum</code> >
158  * <code>maxVacuum</code> or <code>defaultGripVacuum</code> is outside the
159  * range defined by <code>minVacuum</code> and <code>maxVacuum</code>.
160  * @throws CapabilityAlreadyRegistered if this capability has already been
161  * registered
162  * @throws CalledOutsideGripperConfigurationPhase if this method is called
163  * at the wrong time by a AuboCap implementing the {@link
164  * GripperContribution} interface, i.e. called outside the scope of the
165  * configuration of the gripper.
166  * @throws CalledOutsideMethodScope if this method is called at the wrong
167  * time by a (regular) AuboCap which has registered its program node
168  * contribution/service as conformant with a AuboScope gripper (using
169  * {@link GripperRegistrationManager#registerAsGripper(Class)}),
170  * i.e. called outside the scope of the call to either {@link
171  * SwingProgramNodeService#configureContribution(ContributionConfiguration)}
172  * (for a Swing-based AuboCap) or {@link
173  * ProgramNodeServiceConfigurable#configureContribution(ProgramNodeConfiguration)}
174  * (for a HTML-based AuboCap).
175  */
176  virtual GripVacuumCapabilityPtr registerGrippingVacuumCapability(
177  double minVacuum, double maxVacuum, double defaultGripVacuum) = 0;
178 
179  /**
180  * <p>
181  * Register this feedback capability if the gripper can inform AuboScope
182  * whether it has detected that an object has been gripped, after a grip
183  * action has been triggered. This will enable the end user to configure the
184  * actions to take when the gripper has detected that an object has been
185  * gripped and/or when the grip action timed out.
186  * </p>
187  *
188  * <p>
189  * The provided implementation of the {@link ScriptCodeGenerator} interface
190  * must generate the script code for determining if a grip was detected. The
191  * return value of the script code <b>must</b> be a boolean, i.e. 'True' or
192  * 'False'.
193  * </p>
194  *
195  * <b>Note:</b> When this capability has been registered, the
196  * {@link GripperContribution#generateGripActionScript(ScriptWriter,
197  * GripActionParameters)} method should generate different grip action
198  * script code depending on whether the end user has enabled or disabled the
199  * grip detection option (in the Gripper program node). For more details,
200  * see Javadoc for
201  * {@link GripActionParameters#isGripDetectionEnabled()}.
202  *
203  * @param scriptCodeGenerator script generator that generates the script
204  * code for determining if a grip was detected. When the script code needs
205  * to be generated, the method
206  * {@link
207  * ScriptCodeGenerator#generateScript(ScriptWriter, Object)} will be called
208  * (by AuboScope). The resulting script code will be embedded in a script
209  * function and <b>must</b> return a boolean, i.e. 'True' or 'False'.
210  * @throws CapabilityAlreadyRegistered if this capability has already been
211  * registered
212  * @throws CalledOutsideGripperConfigurationPhase if this method is called
213  * at the wrong time, i.e. outside the scope of the {@link
214  * GripperContribution#configureGripper(GripperConfiguration,
215  * GripperAPIProvider)} method.
216  */
217  virtual void registerGripDetectedCapability(
218  std::function<void(ScriptWriterPtr scriptWriter)>
219  scriptCodeGenerator) = 0;
220 
221  /**
222  * <p>
223  * Register this feedback capability if the gripper can inform AuboScope
224  * whether it has detected an object has been released, after a release
225  * action has been triggered. This will enable the end user to configure the
226  * actions to take when the gripper has detected that an object has been
227  * released and/or when the release action timed out.
228  * </p>
229  *
230  * <p>
231  * The provided implementation of the {@link ScriptCodeGenerator} interface
232  * must generate the script code for determining if a release was detected.
233  * The return value of the script code <b>must</b> be a boolean, i.e. 'True'
234  * or 'False'.
235  * </p>
236  *
237  * <b>Note:</b> When this capability has been registered, the
238  * {@link GripperContribution#generateReleaseActionScript(ScriptWriter,
239  * ReleaseActionParameters)} method should generate different release action
240  * script code depending on whether the end user has enabled or disabled the
241  * release detection option (in the Gripper program node). For more details,
242  * see Javadoc for
243  * {@link GripActionParameters#isGripDetectionEnabled()}.
244  *
245  * @param scriptCodeGenerator script generator that generates the script
246  * code for determining if a release was detected. When the script code
247  * needs to be generated, the method
248  * {@link
249  * ScriptCodeGenerator#generateScript(ScriptWriter, Object)} will be called
250  * (by AuboScope). The resulting script code will be embedded in a script
251  * function and <b>must</b> return a boolean, i.e. 'True' or 'False'.
252  * @throws CapabilityAlreadyRegistered if this capability has already been
253  * registered
254  * @throws CalledOutsideGripperConfigurationPhase if this method is called
255  * at the wrong time, i.e. outside the scope of the {@link
256  * GripperContribution#configureGripper(GripperConfiguration,
257  * GripperAPIProvider)} method.
258  */
260  std::function<void(ScriptWriterPtr scriptWriter)>
261  scriptCodeGenerator) = 0;
262 };
263 } // namespace aubo_scope
264 } // namespace arcs
265 
266 #endif
ARCS_CLASS_FORWARD(GripForceCapability)
virtual void registerGripDetectedCapability(std::function< void(ScriptWriterPtr scriptWriter)> scriptCodeGenerator)=0
virtual GripVacuumCapabilityPtr registerGrippingVacuumCapability(double minVacuum, double maxVacuum, double defaultGripVacuum)=0
virtual void registerReleaseDetectedCapability(std::function< void(ScriptWriterPtr scriptWriter)> scriptCodeGenerator)=0
virtual SpeedCapabilityPtr registerSpeedCapability(double minSpeed, double maxSpeed, double defaultGripSpeed, double defaultReleaseSpeed)=0
Register a speed capability for a gripper that supports operating using a user configurable speed...
virtual WidthCapabilityPtr registerWidthCapability(double minWidth, double maxWidth, double defaultGripWidth, double defaultReleaseWidth)=0
Register a width/position capability for a gripper that supports moving to a user configurable positi...
This interface provides access to register or setup various properties and capabilities of a gripper...
virtual GripForceCapabilityPtr registerGrippingForceCapability(double minForce, double maxForce, double defaultGripForce)=0
Register a force capability for a gripper that supports gripping using a user configurable force...