AuboCaps  0.5.0
user_interaction.h
Go to the documentation of this file.
1 #ifndef AUBO_SCOPE_USER_INTERACTION_H
2 #define AUBO_SCOPE_USER_INTERACTION_H
3 
4 #include <vector>
5 #include <functional>
8 
9 namespace arcs {
10 namespace aubo_scope {
11 
12 ARCS_CLASS_FORWARD(UserInteraction);
14 
15 using RobotPositionCallback = std::function<void(
16  bool accepted, const std::vector<double> &pose,
17  const std::vector<double> &q, const std::vector<double> &offset)>;
18 using RobotMovementCallback = std::function<void(bool accepted, int error)>;
19 
20 /**
21  * This interface provides functionality for requesting input or actions from
22  * end users
23  */
25 {
26 public:
29  virtual ~UserInteraction();
30 
31  /**
32  * <p>
33  * Request the end user to use the robot to define a robot position.
34  * Override the
35  * {@link RobotPositionCallback2#onOk(PositionParameters)} method to execute
36  * code once the end user is done. Optionally override the {@link
37  * RobotPositionCallback2#onCancel()} method to execute code if the end user
38  * cancels the operation.
39  * </p>
40  *
41  * <p>
42  * This method is asynchronous, i.e. the method will return immediately.
43  * Only when the end user is done, either
44  * {@link RobotPositionCallback2#onOk(PositionParameters)} or {@link
45  * RobotPositionCallback2#onCancel()} will be called.
46  * </p>
47  *
48  * NOTE: This functionality should not be used in a toolbar contribution
49  * (see {@link ToolbarService}).
50  *
51  * @param callback the instance callbacks will be made to.
52  */
53  void getUserDefinedRobotPosition(RobotPositionCallback callback);
54 
55  /**
56  * 指定 tcpOfffset
57  *
58  * @param tcpOffset
59  * @param callback
60  */
61  void getUserDefinedRobotPosition(const std::vector<double> &tcpOffset,
62  RobotPositionCallback callback);
63 
64  /**
65  * 指定 tcpOfffset
66  *
67  * @param tcpOffset
68  * @param callback
69  */
70  void getUserDefinedRobotPosition(const std::string &tcpOffset,
71  RobotPositionCallback callback);
72 
73  /**
74  * 指定 tcpOfffset
75  *
76  * @param tcpOffset
77  * @param callback
78  */
79  void getUserDefinedRobotPosition(const TCPPtr tcpOffset,
80  RobotPositionCallback callback);
81 
82  /**
83  * <p>
84  * This method provides a factory for creating keyboard inputs which are
85  * used to configure a virtual keyboard/keypad and to request it to be
86  * displayed for a Swing GUI component.
87  * </p>
88  *
89  * NOTE: This functionality is only relevant for AuboCap nodes with a
90  * Swing-based user interface (see {@link ProgramNodeService},
91  * {@link InstallationNodeService} and {@link ToolbarService}).
92  *
93  * @return factory providing access to keyboard inputs.
94  */
95  KeyboardInputFactoryPtr getKeyboardInputFactory();
96 
97  /**
98  * <p>
99  * Transition to the move tab widget to allow/request the end user to move
100  * the robot (either automatically or manually) to a desired target position
101  * specified by joint positions.
102  * </p>
103  *
104  * <p>
105  * The Automove function will move the robot to the target joint positions
106  * linearly in joint space.
107  * </p>
108  *
109  * <b>NOTE:</b> This method does not take the currently active TCP offset
110  * into account, i.e. the Automove function will have the specified joint
111  * positions as target.
112  *
113  * @param q The target joint positions to move to.
114  * @param callback The instance which callbacks will be made to.
115  * @throws IllegalStateException If the URCap screen is not active
116  * (visible).
117  */
118  int requestUserToMoveJoint(const std::vector<double> &q,
119  RobotMovementCallback callback);
120  int requestUserToMoveJoint(const std::string &q,
121  RobotMovementCallback callback);
122  /**
123  * @param pose The target pose the robot TCP will move to.
124  * @param q The reference joint Angle.
125  * @param callback The instance which callbacks will be made to.
126  * @throws IllegalStateException If the URCap screen is not active
127  * (visible).
128  */
129  int requestUserToMoveJoint(const std::vector<double> &pose,
130  const std::vector<double> &q,
131  RobotMovementCallback callback);
132 
133  /**
134  * <p>
135  * Transition to the move tab widget to allow/request the end user to move
136  * the robot (either automatically or manually) to a desired target position
137  * specified by a pose.
138  * </p>
139  *
140  * <p>
141  * The Automove function will move the robot TCP to the target position
142  * linearly in Cartesian space. If this it not possible, the robot will move
143  * to the target linearly in joint space.
144  * </p>
145  *
146  * The current joint positions of the robot will be used as starting point
147  * for inverse kinematics to calculate a target joint vector corresponding
148  * to desired pose, taking the currently active TCP offset into account.
149  *
150  * @param pose The target pose the robot TCP will move to.
151  * @param callback The instance which callbacks will be made to.
152  * @throws IllegalStateException If the URCap screen is not active
153  * (visible).
154  */
155  int requestUserToMoveLine(const std::vector<double> &pose,
156  RobotMovementCallback callback);
157 
158 private:
159  friend class DataSwitch;
160  UserInteraction();
161  void *d_{ nullptr };
162 };
163 
164 } // namespace aubo_scope
165 } // namespace arcs
166 
167 #endif // USERINTERACTION_H
This interface provides functionality for requesting input or actions from end users.
std::function< void(bool accepted, const std::vector< double > &pose, const std::vector< double > &q, const std::vector< double > &offset)> RobotPositionCallback
ARCS_CLASS_FORWARD(GripForceCapability)
#define ARCS_ABI_EXPORT
Definition: class_forward.h:16
std::function< void(bool accepted, int error)> RobotMovementCallback