AuboCaps  0.6.1
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>
6 
10 
11 namespace arcs {
12 namespace aubo_scope {
13 
14 ARCS_CLASS_FORWARD(UserInteraction);
16 
17 using RobotPositionCallback = std::function<void(
18  bool accepted, const std::vector<double> &pose,
19  const std::vector<double> &q, const std::vector<double> &offset)>;
20 using RobotMovementCallback = std::function<void(bool accepted, int error)>;
21 
22 /**
23  * This interface provides functionality for requesting input or actions from
24  * end users
25  */
27 {
28 public:
31  virtual ~UserInteraction();
32 
33  /**
34  * <p>
35  * Request the end user to use the robot to define a robot position.
36  * Override the
37  * {@link RobotPositionCallback2#onOk(PositionParameters)} method to execute
38  * code once the end user is done. Optionally override the {@link
39  * RobotPositionCallback2#onCancel()} method to execute code if the end user
40  * cancels the operation.
41  * </p>
42  *
43  * <p>
44  * This method is asynchronous, i.e. the method will return immediately.
45  * Only when the end user is done, either
46  * {@link RobotPositionCallback2#onOk(PositionParameters)} or {@link
47  * RobotPositionCallback2#onCancel()} will be called.
48  * </p>
49  *
50  * NOTE: This functionality should not be used in a toolbar contribution
51  * (see {@link ToolbarService}).
52  *
53  * @param callback the instance callbacks will be made to.
54  */
55  void getUserDefinedRobotPosition(RobotPositionCallback callback);
56 
57  /**
58  * 指定 tcpOfffset
59  *
60  * @param tcpOffset
61  * @param callback
62  */
63  void getUserDefinedRobotPosition(const std::vector<double> &tcpOffset,
64  RobotPositionCallback callback);
65 
66  /**
67  * 指定 tcpOfffset
68  *
69  * @param tcpOffset
70  * @param callback
71  */
72  void getUserDefinedRobotPosition(const std::string &tcpOffset,
73  RobotPositionCallback callback);
74 
75  /**
76  * 指定 tcpOfffset
77  *
78  * @param tcpOffset
79  * @param callback
80  */
81  void getUserDefinedRobotPosition(const TCPPtr tcpOffset,
82  RobotPositionCallback callback);
83 
84  /**
85  * <p>
86  * This method provides a factory for creating keyboard inputs which are
87  * used to configure a virtual keyboard/keypad and to request it to be
88  * displayed for a Swing GUI component.
89  * </p>
90  *
91  * NOTE: This functionality is only relevant for AuboCap nodes with a
92  * Swing-based user interface (see {@link ProgramNodeService},
93  * {@link InstallationNodeService} and {@link ToolbarService}).
94  *
95  * @return factory providing access to keyboard inputs.
96  */
97  KeyboardManagerPtr getKeyboardManager();
98 
99  /**
100  * <p>
101  * Transition to the move tab widget to allow/request the end user to move
102  * the robot (either automatically or manually) to a desired target position
103  * specified by joint positions.
104  * </p>
105  *
106  * <p>
107  * The Automove function will move the robot to the target joint positions
108  * linearly in joint space.
109  * </p>
110  *
111  * <b>NOTE:</b> This method does not take the currently active TCP offset
112  * into account, i.e. the Automove function will have the specified joint
113  * positions as target.
114  *
115  * @param q The target joint positions to move to.
116  * @param callback The instance which callbacks will be made to.
117  * @throws IllegalStateException If the URCap screen is not active
118  * (visible).
119  */
120  int requestUserToMoveJoint(const std::vector<double> &q,
121  RobotMovementCallback callback);
122  int requestUserToMoveJoint(const std::string &q,
123  RobotMovementCallback callback);
124  /**
125  * @param pose The target pose the robot TCP will move to.
126  * @param q The reference joint Angle.
127  * @param callback The instance which callbacks will be made to.
128  * @throws IllegalStateException If the URCap screen is not active
129  * (visible).
130  */
131  int requestUserToMoveJoint(const std::vector<double> &pose,
132  const std::vector<double> &q,
133  RobotMovementCallback callback);
134 
135  /**
136  * <p>
137  * Transition to the move tab widget to allow/request the end user to move
138  * the robot (either automatically or manually) to a desired target position
139  * specified by a pose.
140  * </p>
141  *
142  * <p>
143  * The Automove function will move the robot TCP to the target position
144  * linearly in Cartesian space. If this it not possible, the robot will move
145  * to the target linearly in joint space.
146  * </p>
147  *
148  * The current joint positions of the robot will be used as starting point
149  * for inverse kinematics to calculate a target joint vector corresponding
150  * to desired pose, taking the currently active TCP offset into account.
151  *
152  * @param pose The target pose the robot TCP will move to.
153  * @param callback The instance which callbacks will be made to.
154  * @throws IllegalStateException If the URCap screen is not active
155  * (visible).
156  */
157  QT_DEPRECATED int requestUserToMoveLine(const std::vector<double> &pose,
158  RobotMovementCallback callback);
159 
160  /**
161  * <p>
162  * Transition to the move tab widget to allow/request the end user to move
163  * the robot (either automatically or manually) to a desired target position
164  * specified by a pose.
165  * </p>
166  *
167  * <p>
168  * The Automove function will move the robot TCP to the target position
169  * linearly in Cartesian space. If this it not possible, the robot will move
170  * to the target linearly in joint space.
171  * </p>
172  *
173  * The current joint positions of the robot will be used as starting point
174  * for inverse kinematics to calculate a target joint vector corresponding
175  * to desired pose, taking the currently active TCP offset into account.
176  *
177  * @param pose The target pose the robot TCP will move to.
178  * @param tcpOffset
179  * @param callback The instance which callbacks will be made to.
180  * @throws IllegalStateException If the URCap screen is not active
181  * (visible).
182  */
183  int requestUserToMoveLine(const std::vector<double> &pose,
184  const std::vector<double> &tcpOffset,
185  RobotMovementCallback callback);
186 
187  /**
188  * 获取机器人缩略图
189  */
190  QPixmap *getRobotThumb(const std::vector<double> &q,
191  const std::vector<double> &pose);
192 
193  /// 界面按钮是否启用操作记录
194  void setOperationLogDisplayName(QWidget *pbn, const std::string &name);
195 
196  /**
197  * @return This method provides robot model drawing objects.
198  */
199  RenderInterfacePtr getRenderInterface();
200 
201 private:
202  friend class DataSwitch;
203  UserInteraction();
204  void *d_{ nullptr };
205 };
206 
207 } // namespace aubo_scope
208 } // namespace arcs
209 
210 #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