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