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