AuboCaps  0.5.0
waypoint_node.h
Go to the documentation of this file.
1 #ifndef AUBO_SCOPE_WAYPOINT_NODE_H
2 #define AUBO_SCOPE_WAYPOINT_NODE_H
3 
4 #include <vector>
7 
8 namespace arcs {
9 namespace aubo_scope {
10 
11 ARCS_CLASS_FORWARD(WaypointNode);
12 
14 {
15 public:
16  /**
17  * The configuration type used to determine which type of configuration this
18  * instance is.
19  */
20  enum ConfigType : int
21  {
22  /**
23  * <p>
24  * Fixed position has been selected (fixed waypoint).
25  * </p>
26  *
27  * The config instance can be cast to {@link
28  * FixedPositionWaypointNodeConfig}.
29  */
30  FIXED_POSITION = 0,
31 
32  /**
33  * <p>
34  * Variable position has been selected (variable waypoint).
35  * </p>
36  *
37  * The config instance can be cast to {@link
38  * VariablePositionWaypointNodeConfig}.
39  */
41 
42  /**
43  * Relative position has been selected (relative waypoint).
44  */
45  RELATIVE_POSITION
46  };
47 
48  /**
49  * The blend parameters type used to determine which type of blend
50  * parameters this instance is.
51  */
52  enum BlendType : int
53  {
54  /**
55  * No blend has been selected (the robot arm will stop at this point).
56  */
57  NO_BLEND = 0,
58 
59  /**
60  * Shared blend has been selected.
61  */
63 
64  /**
65  * <p>>
66  * Waypoint blend has been selected.
67  * </p>
68  *
69  * The blend instance can be cast to {@link WaypointBlendParameters}.
70  */
71  WAYPOINT_BLEND
72  };
73 
74  /**
75  * The blend parameters type used to determine which type of blend
76  * parameters this instance is.
77  */
78  enum MotionType : int
79  {
80  /**
81  * <p>
82  * Time motion parameters has been selected.
83  * </p>
84  *
85  * This instance can be cast to {@link TimeMotionParameters}.
86  */
88 
89  /**
90  * <p>
91  * Joint motion parameters has been selected.
92  * </p>
93  *
94  * This instance can be cast to {@link JointMotionParameters}.
95  */
97 
98  /**
99  * <p>
100  * Tool motion parameters has been selected.
101  * </p>
102  *
103  * This instance can be cast to {@link ToolMotionParameters}.
104  */
106 
107  /**
108  * Shared motion parameters has been selected.
109  */
110  SHARED_MOTION
111  };
112 
113  enum class PositionDefinition : int
114  {
115  /**
116  * The position has not been defined.
117  */
118  UNDEFINED,
119 
120  /**
121  * <p>
122  * The position of the waypoint has been defined.
123  * </p>
124  *
125  * Cast this instance to {@link FixedPositionDefinedWaypointNodeConfig}.
126  */
127  DEFINED
128  };
129 
131  {
132  /**
133  * A variable has not been selected. This instance has no further
134  * information.
135  */
137 
138  /**
139  * <p>
140  * A variable has been selected making this config defined.
141  * </p>
142  *
143  * Cast this instance to {@link
144  * VariablePositionDefinedWaypointNodeConfig}.
145  */
146  DEFINED
147  };
148 
151  virtual ~WaypointNode();
152 
153  /**
154  * This method returns the type of configuration. Cast this instance
155  * appropriately to have access to specific getters.
156  *
157  * @return the type of this config.
158  */
159  ConfigType getConfigType();
160 
161  /**
162  * Get blend type of the waypoint
163  * @return the blend type.
164  */
165  BlendType getBlendType();
166 
167  MotionType getMotionType();
168 
169  /**
170  * Cast this instance appropriately to have access to specific getters.
171  *
172  * @return the position definition.
173  */
174  PositionDefinition getPositionDefinition();
175 
176  /**
177  * Cast this instance appropriately to have access to specific getters.
178  *
179  * @return the variable definition.
180  */
181  VariableDefinition getVariableDefinition();
182 
183  /**
184  * <p>
185  * Get the blend to be used for the movement.
186  * </p>
187  *
188  * Note that, if the configuration has not been applied to a waypoint node
189  * in the program tree, the blend value returned is a "suggested" value,
190  * since the blend may be (automatically) corrected depending on surrounding
191  * waypoints in the program tree (when it is applied to a waypoint node).
192  *
193  * @return the blend for the waypoint.
194  */
195  double getBlend();
196 
197  /**
198  * @return the joint speed to be achieved.
199  */
200  double getJointSpeed();
201 
202  /**
203  * @return the joint acceleration to use for the movement.
204  */
205  double getJointAcceleration();
206 
207  /**
208  * @return the time for the waypoint movement.
209  */
210  double getTime();
211 
212  /**
213  * @return the tool speed to be achieved.
214  */
215  double getToolSpeed();
216 
217  /**
218  * @return the tool acceleration to use for the movement
219  */
220  double getToolAcceleration();
221 
222  /**
223  * @return the waypoint position and orientation.
224  */
225  std::vector<double> getPose();
226 
227  /**
228  * @return the joint positions corresponding to the pose of the robot (when
229  * taking the TCP offset into account)
230  */
231  std::vector<double> getJointPositions();
232 
233  /**
234  * @return the pose for the TCP offset (used when defining the robot
235  * position)
236  */
237  std::vector<double> getTcpOffset();
238 
239  /**
240  * @return the variable for the waypoint.
241  */
242  VariablePtr getVariable();
243 
244  /**
245  * <p>
246  * Creates shared motion parameters for a waypoint.
247  * </p>
248  *
249  * Can be used for waypoints under a MoveJ, MoveL or a MoveP.
250  *
251  * @return the motion parameters for the waypoint.
252  */
253  void setSharedMotionParameters();
254 
255  /**
256  * <p></p>
257  * Creates time motion parameters for a waypoint.
258  * </p>
259  *
260  * Can be used for waypoints under a MoveJ or a MoveL.
261  *
262  * @param duration the time the movement should take, not <code>null</code>.
263  * @param errorHandler error handler for handling validation. If using
264  * {@link ErrorHandler#AUTO_CORRECT} this will clamp the value to the
265  * nearest valid time value.
266  * @return the time motion parameters for the waypoint.
267  */
268  void setTimeMotionParameters(unsigned int duration);
269 
270  /**
271  * <p>
272  * Creates joint motion parameters for a waypoint.
273  * </p>
274  *
275  * Can be used for waypoints under a MoveJ.
276  *
277  * @param jointSpeed the joint speed to be achieved, not <code>null</code>.
278  * @param jointSpeedErrorHandler error handler for handling validation. If
279  * using {@link ErrorHandler#AUTO_CORRECT} this will clamp the value to the
280  * nearest valid joint speed value.
281  * @param joint_acceleration the joint acceleration to be used for the
282  * movement, not <code>null</code>.
283  * @param joint_accelerationErrorHandler error handler for handling
284  * validation. If using {@link ErrorHandler#AUTO_CORRECT} this will clamp
285  * the value to the nearest valid joint acceleration value.
286  * @return the joint motion parameters for the waypoint.
287  */
288  void setJointMotionParameters(double joint_speed,
289  double joint_acceleration);
290 
291  /**
292  * <p>
293  * Creates tool motion parameters for a waypoint.
294  * </p>
295  *
296  * Can be used for waypoints under a MoveL or a MoveP.
297  *
298  * @param tool_speed the tool speed to be achieved, not <code>null</code>.
299  * @param tool_speedErrorHandler error handler for handling validation. If
300  * using {@link ErrorHandler#AUTO_CORRECT} this will clamp the value to the
301  * nearest valid tool speed value.
302  * @param tool_acceleration the tool acceleration to be used for the
303  * movement, not <code>null</code>.
304  * @param tool_accelerationErrorHandler error handler for handling
305  * validation. If using {@link ErrorHandler#AUTO_CORRECT} this will clamp
306  * the value to the nearest valid tool acceleration value.
307  * @return the tool motion parameters for the waypoint.
308  */
309  void setToolMotionParameters(double tool_speed, double tool_acceleration);
310 
311  /**
312  * <p>
313  * Creates a fixed position configuration with default values for a
314  * waypoint.
315  * </p>
316  *
317  * Note that these default values may change between PolyScope versions.
318  *
319  * @return the waypoint configuration.
320  */
321  void setFixedPositionConfig();
322 
323  /**
324  * <p>
325  * Creates a fixed position configuration for a waypoint with a defined
326  * pose.
327  * </p>
328  *
329  * @param pose_including_tcp the position and orientation for the waypoint,
330  * not <code>null</code>.
331  * @param qNear the joint positions that will be used for the inverse
332  * kinematics calculations as a robot configuration near the waypoint pose,
333  * not <code>null</code>.
334  * @param blendParameters the blend parameters for the waypoint, not
335  * <code>null</code>.
336  * @param waypoint_motion_parameters the motion parameters for the waypoint,
337  * not <code>null</code>.
338  * @return the waypoint configuration.
339  */
340  void setFixedPositionConfig(const std::vector<double> &pose_including_tcp,
341  const std::vector<double> &qNear);
342 
343  /**
344  * <p>
345  * Creates a variable position configuration with default values for a
346  * waypoint
347  * </p>
348  *
349  * Note that these default values may change between PolyScope versions.
350  *
351  * @return the waypoint configuration.
352  */
353  void setVariablePositionConfig();
354 
355  /**
356  * Creates a variable position configuration for a waypoint with a defined
357  * variable
358  *
359  * @param variable the variable position and orientation for the waypoint,
360  * not <code>null</code>.
361  * @param blendParameters the blend parameters for the waypoint, not
362  * <code>null</code>.
363  * @param waypoint_motion_parameters the motion parameters for the waypoint,
364  * not <code>null</code>.
365  * @return the waypoint configuration.
366  */
367  void setVariablePositionConfig(VariablePtr variable);
368 
369 private:
370  friend class DataSwitch;
371  WaypointNode();
372  void *d_{ nullptr };
373 };
374 
375 } // namespace aubo_scope
376 } // namespace arcs
377 #endif // AUBO_SCOPE_WAYPOINT_NODE_H
ARCS_CLASS_FORWARD(GripForceCapability)
BlendType
The blend parameters type used to determine which type of blend parameters this instance is...
Definition: waypoint_node.h:52
MotionType
The blend parameters type used to determine which type of blend parameters this instance is...
Definition: waypoint_node.h:78
A variable has not been selected.
Shared blend has been selected.
Definition: waypoint_node.h:62
#define ARCS_ABI_EXPORT
Definition: class_forward.h:16
ConfigType
The configuration type used to determine which type of configuration this instance is...
Definition: waypoint_node.h:20