AuboCaps  0.6.0
until_node.h
Go to the documentation of this file.
1 #ifndef AUBO_SCOPE_UNTIL_NODE_H
2 #define AUBO_SCOPE_UNTIL_NODE_H
3 
6 
7 namespace arcs {
8 namespace aubo_scope {
9 ARCS_CLASS_FORWARD(UntilNode);
10 
11 /**
12  * <p>
13  * The Until node is a type of program node that must be under a Waypoint
14  * node or Direction node.
15  * </p>
16  *
17  * <p>
18  * It has special behavior when calling {@link
19  * TreeNode#addChild(ProgramNode)} and {@link
20  * TreeNode#removeChild(TreeNode)}. Until nodes by default are leaf nodes,
21  * however they can have actions added to them. When that happens they are
22  * transformed into branch nodes that allow child nodes. When the last child
23  * is removed they become leaf nodes again. This is all automatically
24  * handled when {@link TreeNode#addChild(ProgramNode)} and {@link
25  * TreeNode#removeChild(TreeNode)} are called.
26  * </p>
27  */
29 {
30 public:
31  /**
32  * The configuration type used to determine which type of configuration this
33  * instance is.
34  */
35  enum ConfigType : short
36  {
37 
38  /**
39  * <p>
40  * An Until node where the until condition is true once the
41  * evaluation of an expression is true.
42  * </p>
43  *
44  * The config instance can be cast to {@link
45  * ExpressionUntilNodeConfig}.
46  */
48  /**
49  * <p>
50  * An Until node where the until condition is true once an impact on
51  * the Tool is detected.
52  * </p>
53  *
54  * This functionality is not supported by the API.
55  */
57  /**
58  * <p>
59  * An Until node where the until condition is true once a given I/O
60  * reaches a certain value.
61  * </p>
62  *
63  * The config can be cast to {@link IOInputUntilNodeConfig}.
64  */
66 
67  /**
68  * <p>
69  * An Until node where the until condition is true once a given
70  * distance is reached.
71  * </p>
72  *
73  * The config can be cast to {@link DistanceUntilNodeConfig}.
74  */
76  /**
77  * <p>
78  * An Until node where the until condition is true once its parent
79  * Waypoint is reached.
80  * </p>
81  *
82  * The config can be cast to {@link ReachedWaypointUntilNodeConfig}.
83  */
85 
86  /**
87  * An undefined Until node with no type set yet.
88  */
89  NONE_CONFIG_TYPE
90 
91  };
92 
93  /**
94  * Compare operator types LESS_THAN and GREATER_THAN used when waiting for
95  * an analog input to go lower or higher, respectively, than a threshold
96  */
97  enum CompareOperator : int
98  {
100  GREATER_THAN
101  };
102 
103  /**
104  * Blend Parameters can be of different types
105  * The parameter type is used to determine the explicit blend parameters
106  * (can be used in place of instanceof operations).
107  */
109  {
110 
111  /**
112  * The robot arm will stop without performing a blend.
113  */
115 
116  /**
117  * <p>
118  * Custom blend has been selected.
119  * </p>
120  *
121  * The blend instance can be cast to {@link CustomBlendParameters}.
122  */
123  CUSTOM_BLEND
124  };
125 
127  {
128 
129  /**
130  * This deceleration was either created specifying values for both
131  * {@link AngularAcceleration} and {@link Acceleration} and/or is in use
132  * in an Until node that is not yet in the program tree.
133  */
135 
136  /**
137  * This deceleration is currently used under a MoveJ node.
138  */
140 
141  /**
142  * This deceleration is currently used under a MoveL or MoveP node.
143  */
144  Cartesian
145  };
146 
147  /**
148  * The deceleration parameter type used to determine which type of
149  * deceleration parameter this instance is.
150  */
152  {
153  /**
154  * Shared deceleration has been selected. The acceleration values from
155  * the parent Move node will be used as deceleration (absolute value).
156  */
158 
159  /**
160  * <p>
161  * Custom deceleration has been selected.
162  * </p>
163  *
164  * This instance can be cast to {@link CustomDecelerationParameters}.
165  */
166  CUSTOM_DECELERATION
167  };
168 
169  /**
170  * The type of the input selection.
171  */
173  {
174 
175  /**
176  * The node is not fully configured.
177  */
179 
180  /**
181  * <p>
182  * Digital input is selected.
183  * </p>
184  *
185  * The config instance can be cast to {@link
186  * DigitalInputUntilNodeConfig}.
187  */
189 
190  /**
191  * <p>
192  * Analog input is selected.
193  * </p>
194  *
195  * The config instance can be cast to {@link
196  * AnalogInputUntilNodeConfig}.
197  */
199 
200  /**
201  * <p>
202  * A float input register is selected.
203  * </p>
204  *
205  * The config instance can be cast to {@link
206  * FloatRegisterInputUntilNodeConfig}.
207  */
208  FLOAT_REGISTER_INPUT
209  };
210 
211  UntilNode(UntilNode &f);
212  UntilNode(UntilNode &&f);
213  virtual ~UntilNode();
214 
215  /**
216  * This method returns the type of configuration. Cast this instance
217  * appropriately to have access to specific getters.
218  *
219  * @return the type of this config.
220  */
221  ConfigType getConfigType();
222  void setConfigType(ConfigType type);
223 
224  BlendParameterType getBlendParameterType();
225  void setBlendParameterType(BlendParameterType type);
226 
227  /**
228  * Creates blend parameters for an Until node. Can be used in a Distance
229  * configuration type.
230  *
231  * @param suggestedBlend This blend value may be (automatically) corrected
232  * depending on the value of the distance parameter the Distance
233  * configuration.
234  * @return the blend parameters for the Until node.
235  */
236  void setWaypointBlendParameter(double suggested_blend);
237  double getWaypointBlendParameter();
238 
239  DecelerationParameterType getDecelerationParameterType();
240  void setDecelerationParameterType(DecelerationParameterType type);
241 
242  /**
243  * <p>
244  * Creates deceleration parameter for an Until node. Can be used in an
245  * Expression configuration type.
246  * </p>
247  *
248  * An angular deceleration is used when the type of the parent Move node is
249  * a MoveJ, whereas a Cartesian deceleration is used when the move type is a
250  * MoveL or MoveP.
251  *
252  * @param deceleration the angular deceleration (the value for the Cartesian
253  * deceleration will be the default value that AuboScope uses), not
254  * <code>null</code>.
255  * @param decelerationErrorHandler error handler for handling validation. If
256  * using {@link ErrorHandler#AUTO_CORRECT} this will clamp the value to the
257  * nearest valid angular deceleration value.
258  * @return the deceleration parameter for the Until node.
259  */
260  void setDecelerationParameters(double deceleration);
261  double getDecelerationParameters();
262 
263  /**
264  *
265  * @return the deceleration type. This can change depending on the Move node
266  * type above the Until node.
267  */
268  CustomDecelerationParameterType getCustomDecelerationParameterType();
269 
270  void setCustomDecelerationParameterType(
272 
273  /**
274  * The rate at which to decelerate when the until condition is met.
275  *
276  * @return the specified angular deceleration of the until node (absolute
277  * value).
278  */
279  double getAngularDeceleration();
280  void setAngularDeceleration(double dec);
281 
282  /**
283  * The rate at which to decelerate when the until condition is met.
284  *
285  * @return the specified Cartesian deceleration of the until node (absolute
286  * value).
287  */
288  double getCartesianDeceleration();
289  void setCartesianDeceleration(double dec);
290 
291  /**
292  * <p>
293  * Creates an Expression configuration for an Until node with an expression
294  * and default value for the deceleration parameter. The until condition for
295  * this configuration is true once the evaluation of the expression is true.
296  * </p>
297  *
298  * Note that this default value may change between AuboScope versions.
299  *
300  * @param expression the expression whose evaluation will determine whether
301  * the until condition is met.
302  * @return the Until node configuration.
303  */
304  void setExpressionConfig(ExpressionPtr expression);
305  ExpressionPtr getExpressionConfig();
306 
307  /**
308  * The distance the robot will travel.
309  *
310  * @return The distance.
311  */
312  double getDistance();
313  void setDistance(double dis);
314  IOInputSelectionType getIOInputSelectionType();
315  void setIOInputSelectionType(IOInputSelectionType type);
316 
317  /**
318  * Creates an I/O Input configuration for an Until node. The until condition
319  * for this configuration is true once the signal value of a given digital
320  * input goes HIGH or LOW.
321  *
322  * @param input the digital input whose signal value will determine whether
323  * the until condition is met, not <code>null</code>.
324  * @param valueToProceedUntil <code>true</code>, if the until condition is
325  * met when the input signal value goes HIGH, <code>false</code> otherwise
326  * (condition met when signal value is LOW).
327  * @return the Until node configuration.
328  * @throws IllegalArgumentException if <code>input</code> is an output (does
329  * not support reading of values). See {@link IO#isInput()}.
330  */
331  void setDigitalInputValueToProceed(bool value_to_proceed_until);
332  bool getDigitalInputValueToProceed();
333 
334  /**
335  * Creates an I/O Input configuration for an Until node. The until condition
336  * for this configuration is true once the the signal value of a given
337  * analog input goes past a specified electric Current threshold.
338  *
339  * @param input the analog input whose signal value will determine whether
340  * the until condition is met, not <code>null</code>.
341  * @param compareOperator the operator to use when comparing the signal
342  * value of the selected analog input to the threshold value, not
343  * <code>null</code>. Available options are "less than" ({@literal <}) or
344  * "greater than"
345  * ({@literal >}).
346  * @param currentThreshold the electric Current threshold for the signal
347  * value of the analog input. Execution will proceed until the signal value
348  * of the selected analog input goes past this threshold.
349  * @param errorHandler the error handler for validation errors. If using
350  * {@link ErrorHandler#AUTO_CORRECT} this will clamp the value to the
351  * nearest valid current value.
352  * @return the Until node configuration.
353  * @throws IllegalArgumentException if <code>input</code> is an output (does
354  * not support reading of values). See {@link IO#isInput()}.
355  */
356 
357  void setAnalogInputValueToProceed(double value);
358  double getAnalogInputValueToProceed();
359 
360  void setCompareOperator(CompareOperator compare_operator);
361  CompareOperator getCompareOperator();
362 
363 private:
364  friend class DataSwitch;
365  UntilNode();
366  void *d_{ nullptr };
367 };
368 
369 } // namespace aubo_scope
370 } // namespace arcs
371 #endif // AUBO_SCOPE_UNTIL_NODE_H
Shared deceleration has been selected.
Definition: until_node.h:157
The node is not fully configured.
Definition: until_node.h:178
ARCS_CLASS_FORWARD(GripForceCapability)
This deceleration was either created specifying values for both AngularAcceleration and Acceleration ...
Definition: until_node.h:134
IOInputSelectionType
The type of the input selection.
Definition: until_node.h:172
This deceleration is currently used under a MoveJ node.
Definition: until_node.h:139
BlendParameterType
Blend Parameters can be of different types The parameter type is used to determine the explicit blend...
Definition: until_node.h:108
ConfigType
The configuration type used to determine which type of configuration this instance is...
Definition: until_node.h:35
#define ARCS_ABI_EXPORT
Definition: class_forward.h:16
CompareOperator
Compare operator types LESS_THAN and GREATER_THAN used when waiting for an analog input to go lower o...
Definition: until_node.h:97
The robot arm will stop without performing a blend.
Definition: until_node.h:114
DecelerationParameterType
The deceleration parameter type used to determine which type of deceleration parameter this instance ...
Definition: until_node.h:151