AuboStudio SDK 0.6.3

until_node.h
浏览该文件的文档.
1 #ifndef AUBO_SCOPE_UNTIL_NODE_H
2 #define AUBO_SCOPE_UNTIL_NODE_H
3
4 #include <aubo_caps/domain/program/nodes/program_node.h>
5 #include <aubo_caps/domain/value/expression/expression.h>
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 */
28 class ARCS_ABI_EXPORT UntilNode : public ProgramNode
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 */
47 EXPRESSION,
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 */
56 TOOL_CONTACT,
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 */
65 IO_INPUT,
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 */
75 DISTANCE,
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 */
84 REACHED_WAYPOINT,
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 {
99 LESS_THAN,
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 */
108 enum BlendParameterType
109 {
110
111 /**
112 * The robot arm will stop without performing a blend.
113 */
114 NO_BLEND,
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
126 enum CustomDecelerationParameterType
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 */
134 Unknown,
135
136 /**
137 * This deceleration is currently used under a MoveJ node.
138 */
139 Angular,
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 */
151 enum DecelerationParameterType
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 */
157 SHARED_DECELERATION,
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 */
172 enum IOInputSelectionType
173 {
174
175 /**
176 * The node is not fully configured.
177 */
178 NONE_INPUT_SELECT,
179
180 /**
181 * <p>
182 * Digital input is selected.
183 * </p>
184 *
185 * The config instance can be cast to {@link
186 * DigitalInputUntilNodeConfig}.
187 */
188 DIGITAL_INPUT,
189
190 /**
191 * <p>
192 * Analog input is selected.
193 * </p>
194 *
195 * The config instance can be cast to {@link
196 * AnalogInputUntilNodeConfig}.
197 */
198 ANALOG_INPUT,
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(
271 CustomDecelerationParameterType type);
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
ARCS_ABI_EXPORT
#define ARCS_ABI_EXPORT
Definition: class_forward.h:16
arcs::aubo_scope::ProgramNode
Definition: program_node.h:19
arcs::aubo_scope::UntilNode
Definition: until_node.h:29
arcs::aubo_scope::UntilNode::setBlendParameterType
void setBlendParameterType(BlendParameterType type)
arcs::aubo_scope::UntilNode::getDecelerationParameters
double getDecelerationParameters()
arcs::aubo_scope::UntilNode::getExpressionConfig
ExpressionPtr getExpressionConfig()
arcs::aubo_scope::UntilNode::getConfigType
ConfigType getConfigType()
This method returns the type of configuration.
arcs::aubo_scope::UntilNode::setWaypointBlendParameter
void setWaypointBlendParameter(double suggested_blend)
Creates blend parameters for an Until node.
arcs::aubo_scope::UntilNode::CustomDecelerationParameterType
CustomDecelerationParameterType
Definition: until_node.h:127
arcs::aubo_scope::UntilNode::Unknown
@ Unknown
This deceleration was either created specifying values for both AngularAcceleration and Acceleration ...
Definition: until_node.h:134
arcs::aubo_scope::UntilNode::Angular
@ Angular
This deceleration is currently used under a MoveJ node.
Definition: until_node.h:139
arcs::aubo_scope::UntilNode::setConfigType
void setConfigType(ConfigType type)
arcs::aubo_scope::UntilNode::getCompareOperator
CompareOperator getCompareOperator()
arcs::aubo_scope::UntilNode::setAngularDeceleration
void setAngularDeceleration(double dec)
arcs::aubo_scope::UntilNode::getDigitalInputValueToProceed
bool getDigitalInputValueToProceed()
arcs::aubo_scope::UntilNode::getCustomDecelerationParameterType
CustomDecelerationParameterType getCustomDecelerationParameterType()
arcs::aubo_scope::UntilNode::getBlendParameterType
BlendParameterType getBlendParameterType()
arcs::aubo_scope::UntilNode::getDistance
double getDistance()
The distance the robot will travel.
arcs::aubo_scope::UntilNode::getAngularDeceleration
double getAngularDeceleration()
The rate at which to decelerate when the until condition is met.
arcs::aubo_scope::UntilNode::ConfigType
ConfigType
The configuration type used to determine which type of configuration this instance is.
Definition: until_node.h:36
arcs::aubo_scope::UntilNode::TOOL_CONTACT
@ TOOL_CONTACT
Definition: until_node.h:56
arcs::aubo_scope::UntilNode::DISTANCE
@ DISTANCE
Definition: until_node.h:75
arcs::aubo_scope::UntilNode::REACHED_WAYPOINT
@ REACHED_WAYPOINT
Definition: until_node.h:84
arcs::aubo_scope::UntilNode::IO_INPUT
@ IO_INPUT
Definition: until_node.h:65
arcs::aubo_scope::UntilNode::EXPRESSION
@ EXPRESSION
Definition: until_node.h:47
arcs::aubo_scope::UntilNode::UntilNode
UntilNode(UntilNode &f)
arcs::aubo_scope::UntilNode::getCartesianDeceleration
double getCartesianDeceleration()
The rate at which to decelerate when the until condition is met.
arcs::aubo_scope::UntilNode::getDecelerationParameterType
DecelerationParameterType getDecelerationParameterType()
arcs::aubo_scope::UntilNode::setCompareOperator
void setCompareOperator(CompareOperator compare_operator)
arcs::aubo_scope::UntilNode::setDecelerationParameters
void setDecelerationParameters(double deceleration)
arcs::aubo_scope::UntilNode::setExpressionConfig
void setExpressionConfig(ExpressionPtr expression)
arcs::aubo_scope::UntilNode::setCartesianDeceleration
void setCartesianDeceleration(double dec)
arcs::aubo_scope::UntilNode::setDigitalInputValueToProceed
void setDigitalInputValueToProceed(bool value_to_proceed_until)
Creates an I/O Input configuration for an Until node.
arcs::aubo_scope::UntilNode::UntilNode
UntilNode()
arcs::aubo_scope::UntilNode::getIOInputSelectionType
IOInputSelectionType getIOInputSelectionType()
arcs::aubo_scope::UntilNode::BlendParameterType
BlendParameterType
Blend Parameters can be of different types The parameter type is used to determine the explicit blend...
Definition: until_node.h:109
arcs::aubo_scope::UntilNode::NO_BLEND
@ NO_BLEND
The robot arm will stop without performing a blend.
Definition: until_node.h:114
arcs::aubo_scope::UntilNode::setCustomDecelerationParameterType
void setCustomDecelerationParameterType(CustomDecelerationParameterType type)
arcs::aubo_scope::UntilNode::getWaypointBlendParameter
double getWaypointBlendParameter()
arcs::aubo_scope::UntilNode::DecelerationParameterType
DecelerationParameterType
The deceleration parameter type used to determine which type of deceleration parameter this instance ...
Definition: until_node.h:152
arcs::aubo_scope::UntilNode::SHARED_DECELERATION
@ SHARED_DECELERATION
Shared deceleration has been selected.
Definition: until_node.h:157
arcs::aubo_scope::UntilNode::IOInputSelectionType
IOInputSelectionType
The type of the input selection.
Definition: until_node.h:173
arcs::aubo_scope::UntilNode::DIGITAL_INPUT
@ DIGITAL_INPUT
Definition: until_node.h:188
arcs::aubo_scope::UntilNode::ANALOG_INPUT
@ ANALOG_INPUT
Definition: until_node.h:198
arcs::aubo_scope::UntilNode::NONE_INPUT_SELECT
@ NONE_INPUT_SELECT
The node is not fully configured.
Definition: until_node.h:178
arcs::aubo_scope::UntilNode::CompareOperator
CompareOperator
Compare operator types LESS_THAN and GREATER_THAN used when waiting for an analog input to go lower o...
Definition: until_node.h:98
arcs::aubo_scope::UntilNode::LESS_THAN
@ LESS_THAN
Definition: until_node.h:99
arcs::aubo_scope::UntilNode::UntilNode
UntilNode(UntilNode &&f)
arcs::aubo_scope::UntilNode::~UntilNode
virtual ~UntilNode()
arcs::aubo_scope::UntilNode::setDistance
void setDistance(double dis)
arcs::aubo_scope::UntilNode::getAnalogInputValueToProceed
double getAnalogInputValueToProceed()
arcs::aubo_scope::UntilNode::setAnalogInputValueToProceed
void setAnalogInputValueToProceed(double value)
Creates an I/O Input configuration for an Until node.
arcs::aubo_scope::UntilNode::setDecelerationParameterType
void setDecelerationParameterType(DecelerationParameterType type)
arcs::aubo_scope::UntilNode::setIOInputSelectionType
void setIOInputSelectionType(IOInputSelectionType type)
expression.h
arcs::aubo_scope::ARCS_CLASS_FORWARD
ARCS_CLASS_FORWARD(GripForceCapability)
arcs
Definition: contribution_provider.h:7
program_node.h