AuboStudio SDK  0.6.3
until_node.h
浏览该文件的文档.
1#ifndef AUBO_SCOPE_UNTIL_NODE_H
2#define AUBO_SCOPE_UNTIL_NODE_H
3
6
7namespace arcs {
8namespace aubo_scope {
10
11/**
12 * \chinese
13 * <p>Until 节点是一种必须放在 Waypoint 节点或 Direction 节点下的程序节点类型。</p>
14 * <p>当调用 TreeNode#addChild 和 #removeChild 时,Until 节点具有特殊行为。
15 * 默认情况下 Until 节点是叶子节点,但可以向其添加动作。当添加动作时,它们会转换
16 * 为允许子节点的分支节点。当最后一个子节点被移除时,它们又变回叶子节点。</p>
17 * \endchinese
18 * \english
19 * <p>The Until node is a type of program node that must be under a Waypoint
20 * node or Direction node.</p>
21 * <p>It has special behavior when calling {@link
22 * TreeNode#addChild(ProgramNode)} and {@link
23 * TreeNode#removeChild(TreeNode)}. Until nodes by default are leaf nodes,
24 * however they can have actions added to them. When that happens they are
25 * transformed into branch nodes that allow child nodes. When the last child
26 * is removed they become leaf nodes again. This is all automatically
27 * handled when {@link TreeNode#addChild(ProgramNode)} and {@link
28 * TreeNode#removeChild(TreeNode)} are called.</p>
29 * \endenglish
30 */
32{
33public:
34 /**
35 * The configuration type used to determine which type of configuration this
36 * instance is.
37 */
38 enum ConfigType : short
39 {
40
41 /**
42 * <p>
43 * An Until node where the until condition is true once the
44 * evaluation of an expression is true.
45 * </p>
46 *
47 * The config instance can be cast to {@link
48 * ExpressionUntilNodeConfig}.
49 */
51 /**
52 * <p>
53 * An Until node where the until condition is true once an impact on
54 * the Tool is detected.
55 * </p>
56 *
57 * This functionality is not supported by the API.
58 */
60 /**
61 * <p>
62 * An Until node where the until condition is true once a given I/O
63 * reaches a certain value.
64 * </p>
65 *
66 * The config can be cast to {@link IOInputUntilNodeConfig}.
67 */
69
70 /**
71 * <p>
72 * An Until node where the until condition is true once a given
73 * distance is reached.
74 * </p>
75 *
76 * The config can be cast to {@link DistanceUntilNodeConfig}.
77 */
79 /**
80 * <p>
81 * An Until node where the until condition is true once its parent
82 * Waypoint is reached.
83 * </p>
84 *
85 * The config can be cast to {@link ReachedWaypointUntilNodeConfig}.
86 */
88
89 /**
90 * An undefined Until node with no type set yet.
91 */
93
94 };
95
96 /**
97 * Compare operator types LESS_THAN and GREATER_THAN used when waiting for
98 * an analog input to go lower or higher, respectively, than a threshold
99 */
105
106 /**
107 * Blend Parameters can be of different types
108 * The parameter type is used to determine the explicit blend parameters
109 * (can be used in place of instanceof operations).
110 */
112 {
113
114 /**
115 * The robot arm will stop without performing a blend.
116 */
118
119 /**
120 * <p>
121 * Custom blend has been selected.
122 * </p>
123 *
124 * The blend instance can be cast to {@link CustomBlendParameters}.
125 */
127 };
128
130 {
131
132 /**
133 * This deceleration was either created specifying values for both
134 * {@link AngularAcceleration} and {@link Acceleration} and/or is in use
135 * in an Until node that is not yet in the program tree.
136 */
138
139 /**
140 * This deceleration is currently used under a MoveJ node.
141 */
143
144 /**
145 * This deceleration is currently used under a MoveL or MoveP node.
146 */
148 };
149
150 /**
151 * The deceleration parameter type used to determine which type of
152 * deceleration parameter this instance is.
153 */
155 {
156 /**
157 * Shared deceleration has been selected. The acceleration values from
158 * the parent Move node will be used as deceleration (absolute value).
159 */
161
162 /**
163 * <p>
164 * Custom deceleration has been selected.
165 * </p>
166 *
167 * This instance can be cast to {@link CustomDecelerationParameters}.
168 */
170 };
171
172 /**
173 * The type of the input selection.
174 */
176 {
177
178 /**
179 * The node is not fully configured.
180 */
182
183 /**
184 * <p>
185 * Digital input is selected.
186 * </p>
187 *
188 * The config instance can be cast to {@link
189 * DigitalInputUntilNodeConfig}.
190 */
192
193 /**
194 * <p>
195 * Analog input is selected.
196 * </p>
197 *
198 * The config instance can be cast to {@link
199 * AnalogInputUntilNodeConfig}.
200 */
202
203 /**
204 * <p>
205 * A float input register is selected.
206 * </p>
207 *
208 * The config instance can be cast to {@link
209 * FloatRegisterInputUntilNodeConfig}.
210 */
212 };
213
216 virtual ~UntilNode();
217
218 /**
219 * This method returns the type of configuration. Cast this instance
220 * appropriately to have access to specific getters.
221 *
222 * @return the type of this config.
223 */
226
229
230 /**
231 * Creates blend parameters for an Until node. Can be used in a Distance
232 * configuration type.
233 *
234 * @param suggestedBlend This blend value may be (automatically) corrected
235 * depending on the value of the distance parameter the Distance
236 * configuration.
237 * @return the blend parameters for the Until node.
238 */
239 void setWaypointBlendParameter(double suggested_blend);
241
244
245 /**
246 * <p>
247 * Creates deceleration parameter for an Until node. Can be used in an
248 * Expression configuration type.
249 * </p>
250 *
251 * An angular deceleration is used when the type of the parent Move node is
252 * a MoveJ, whereas a Cartesian deceleration is used when the move type is a
253 * MoveL or MoveP.
254 *
255 * @param deceleration the angular deceleration (the value for the Cartesian
256 * deceleration will be the default value that AuboScope uses), not
257 * <code>null</code>.
258 * @param decelerationErrorHandler error handler for handling validation. If
259 * using {@link ErrorHandler#AUTO_CORRECT} this will clamp the value to the
260 * nearest valid angular deceleration value.
261 * @return the deceleration parameter for the Until node.
262 */
263 void setDecelerationParameters(double deceleration);
265
266 /**
267 *
268 * @return the deceleration type. This can change depending on the Move node
269 * type above the Until node.
270 */
272
275
276 /**
277 * The rate at which to decelerate when the until condition is met.
278 *
279 * @return the specified angular deceleration of the until node (absolute
280 * value).
281 */
283 void setAngularDeceleration(double dec);
284
285 /**
286 * The rate at which to decelerate when the until condition is met.
287 *
288 * @return the specified Cartesian deceleration of the until node (absolute
289 * value).
290 */
292 void setCartesianDeceleration(double dec);
293
294 /**
295 * <p>
296 * Creates an Expression configuration for an Until node with an expression
297 * and default value for the deceleration parameter. The until condition for
298 * this configuration is true once the evaluation of the expression is true.
299 * </p>
300 *
301 * Note that this default value may change between AuboScope versions.
302 *
303 * @param expression the expression whose evaluation will determine whether
304 * the until condition is met.
305 * @return the Until node configuration.
306 */
307 void setExpressionConfig(ExpressionPtr expression);
308 ExpressionPtr getExpressionConfig();
309
310 /**
311 * The distance the robot will travel.
312 *
313 * @return The distance.
314 */
315 double getDistance();
316 void setDistance(double dis);
319
320 /**
321 * Creates an I/O Input configuration for an Until node. The until condition
322 * for this configuration is true once the signal value of a given digital
323 * input goes HIGH or LOW.
324 *
325 * @param input the digital input whose signal value will determine whether
326 * the until condition is met, not <code>null</code>.
327 * @param valueToProceedUntil <code>true</code>, if the until condition is
328 * met when the input signal value goes HIGH, <code>false</code> otherwise
329 * (condition met when signal value is LOW).
330 * @return the Until node configuration.
331 * @throws IllegalArgumentException if <code>input</code> is an output (does
332 * not support reading of values). See {@link IO#isInput()}.
333 */
334 void setDigitalInputValueToProceed(bool value_to_proceed_until);
336
337 /**
338 * Creates an I/O Input configuration for an Until node. The until condition
339 * for this configuration is true once the the signal value of a given
340 * analog input goes past a specified electric Current threshold.
341 *
342 * @param input the analog input whose signal value will determine whether
343 * the until condition is met, not <code>null</code>.
344 * @param compareOperator the operator to use when comparing the signal
345 * value of the selected analog input to the threshold value, not
346 * <code>null</code>. Available options are "less than" ({@literal <}) or
347 * "greater than"
348 * ({@literal >}).
349 * @param currentThreshold the electric Current threshold for the signal
350 * value of the analog input. Execution will proceed until the signal value
351 * of the selected analog input goes past this threshold.
352 * @param errorHandler the error handler for validation errors. If using
353 * {@link ErrorHandler#AUTO_CORRECT} this will clamp the value to the
354 * nearest valid current value.
355 * @return the Until node configuration.
356 * @throws IllegalArgumentException if <code>input</code> is an output (does
357 * not support reading of values). See {@link IO#isInput()}.
358 */
359
362
363 void setCompareOperator(CompareOperator compare_operator);
365
366private:
367 friend class DataSwitch;
369 void *d_{ nullptr };
370};
371
372} // namespace aubo_scope
373} // namespace arcs
374#endif // AUBO_SCOPE_UNTIL_NODE_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 setBlendParameterType(BlendParameterType type)
ExpressionPtr getExpressionConfig()
ConfigType getConfigType()
This method returns the type of configuration.
void setWaypointBlendParameter(double suggested_blend)
Creates blend parameters for an Until node.
@ Cartesian
This deceleration is currently used under a MoveL or MoveP node.
@ Unknown
This deceleration was either created specifying values for both AngularAcceleration and Acceleration ...
@ Angular
This deceleration is currently used under a MoveJ node.
void setConfigType(ConfigType type)
CompareOperator getCompareOperator()
void setAngularDeceleration(double dec)
CustomDecelerationParameterType getCustomDecelerationParameterType()
BlendParameterType getBlendParameterType()
double getDistance()
The distance the robot will travel.
double getAngularDeceleration()
The rate at which to decelerate when the until condition is met.
ConfigType
The configuration type used to determine which type of configuration this instance is.
@ NONE_CONFIG_TYPE
An undefined Until node with no type set yet.
double getCartesianDeceleration()
The rate at which to decelerate when the until condition is met.
DecelerationParameterType getDecelerationParameterType()
void setCompareOperator(CompareOperator compare_operator)
void setDecelerationParameters(double deceleration)
void setExpressionConfig(ExpressionPtr expression)
void setCartesianDeceleration(double dec)
void setDigitalInputValueToProceed(bool value_to_proceed_until)
Creates an I/O Input configuration for an Until node.
IOInputSelectionType getIOInputSelectionType()
BlendParameterType
Blend Parameters can be of different types The parameter type is used to determine the explicit blend...
@ NO_BLEND
The robot arm will stop without performing a blend.
void setCustomDecelerationParameterType(CustomDecelerationParameterType type)
DecelerationParameterType
The deceleration parameter type used to determine which type of deceleration parameter this instance ...
@ SHARED_DECELERATION
Shared deceleration has been selected.
IOInputSelectionType
The type of the input selection.
@ NONE_INPUT_SELECT
The node is not fully configured.
CompareOperator
Compare operator types LESS_THAN and GREATER_THAN used when waiting for an analog input to go lower o...
void setDistance(double dis)
void setAnalogInputValueToProceed(double value)
Creates an I/O Input configuration for an Until node.
void setDecelerationParameterType(DecelerationParameterType type)
void setIOInputSelectionType(IOInputSelectionType type)