AuboStudio SDK  0.6.3
user_interaction.h
浏览该文件的文档.
1#ifndef AUBO_SCOPE_USER_INTERACTION_H
2#define AUBO_SCOPE_USER_INTERACTION_H
3
4#include <vector>
5#include <functional>
6
11
12namespace arcs {
13namespace aubo_scope {
14
17
18using RobotPositionCallback = std::function<void(
19 bool accepted, const std::vector<double> &pose,
20 const std::vector<double> &q, const std::vector<double> &offset)>;
21using RobotMovementCallback = std::function<void(bool accepted, int error)>;
22
23/**
24 * @ingroup UserInterfaceApi
25 * \chinese
26 * 用户交互接口
27 * 此接口提供向终端用户请求输入或操作的功能。
28 * \endchinese
29 * \english
30 * UserInteraction
31 * This interface provides functionality for requesting input or actions from
32 * end users.
33 * \endenglish
34 */
36{
37public:
41
42 /**
43 * @ingroup UserInteraction
44 * <p>
45 * Request the end user to use the robot to define a robot position.
46 * Override the
47 * {@link RobotPositionCallback2#onOk(PositionParameters)} method to execute
48 * code once the end user is done. Optionally override the {@link
49 * RobotPositionCallback2#onCancel()} method to execute code if the end user
50 * cancels the operation.
51 * </p>
52 *
53 * <p>
54 * This method is asynchronous, i.e. the method will return immediately.
55 * Only when the end user is done, either
56 * {@link RobotPositionCallback2#onOk(PositionParameters)} or {@link
57 * RobotPositionCallback2#onCancel()} will be called.
58 * </p>
59 *
60 * NOTE: This functionality should not be used in a toolbar contribution
61 * (see {@link ToolbarService}).
62 *
63 * @param callback the instance callbacks will be made to.
64 */
66
67 /**
68 * @ingroup UserInteraction
69 * \chinese
70 * 指定 tcpOffset 获取用户定义的机器人位置
71 *
72 * @param tcpOffset TCP 偏移量
73 * @param callback 回调函数
74 * \endchinese
75 * \english
76 * Request the end user to define a robot position with specified tcpOffset.
77 *
78 * @param tcpOffset
79 * @param callback
80 * \endenglish
81 */
82 void getUserDefinedRobotPosition(const std::vector<double> &tcpOffset,
83 RobotPositionCallback callback);
84
85 /**
86 * @ingroup UserInteraction
87 * \chinese
88 * 指定 tcpOffset 字符串获取用户定义的机器人位置
89 *
90 * @param tcpOffset TCP 偏移量名称
91 * @param callback 回调函数
92 * \endchinese
93 * \english
94 * Request the end user to define a robot position with specified tcpOffset string.
95 *
96 * @param tcpOffset
97 * @param callback
98 * \endenglish
99 */
100 void getUserDefinedRobotPosition(const std::string &tcpOffset,
101 RobotPositionCallback callback);
102
103 /**
104 * @ingroup UserInteraction
105 * \chinese
106 * 指定 TCP 对象获取用户定义的机器人位置
107 *
108 * @param tcpOffset TCP 对象
109 * @param callback 回调函数
110 * \endchinese
111 * \english
112 * Request the end user to define a robot position with specified TCP object.
113 *
114 * @param tcpOffset
115 * @param callback
116 * \endenglish
117 */
118 void getUserDefinedRobotPosition(const TCPPtr tcpOffset,
119 RobotPositionCallback callback);
120
121 /**
122 * @ingroup UserInteraction
123 * <p>
124 * This method provides a factory for creating keyboard inputs which are
125 * used to configure a virtual keyboard/keypad and to request it to be
126 * displayed for a Qt GUI component.
127 * </p>
128 *
129 * NOTE: This functionality is only relevant for AuboCap nodes with a
130 * Qt-based user interface (see {@link ProgramNodeService},
131 * {@link InstallationNodeService} and {@link ToolbarService}).
132 *
133 * @return factory providing access to keyboard inputs.
134 */
135 KeyboardManagerPtr getKeyboardManager();
136
137 /**
138 * @ingroup UserInteraction
139 * <p>
140 * Transition to the move tab widget to allow/request the end user to move
141 * the robot (either automatically or manually) to a desired target position
142 * specified by joint positions.
143 * </p>
144 *
145 * <p>
146 * The Automove function will move the robot to the target joint positions
147 * linearly in joint space.
148 * </p>
149 *
150 * <b>NOTE:</b> This method does not take the currently active TCP offset
151 * into account, i.e. the Automove function will have the specified joint
152 * positions as target.
153 *
154 * @param q The target joint positions to move to.
155 * @param callback The instance which callbacks will be made to.
156 * @throws IllegalStateException If the plugin screen is not active
157 * (visible).
158 */
159 int requestUserToMoveJoint(const std::vector<double> &q,
160 RobotMovementCallback callback);
161 /**
162 * @ingroup UserInteraction
163 * @brief requestUserToMoveJoint
164 * @param q
165 * @param callback
166 * @return
167 */
168 int requestUserToMoveJoint(const std::string &q,
169 RobotMovementCallback callback);
170 /**
171 * @ingroup UserInteraction
172 * @param pose The target pose the robot TCP will move to.
173 * @param q The reference joint Angle.
174 * @param callback The instance which callbacks will be made to.
175 * @throws IllegalStateException If the plugin screen is not active
176 * (visible).
177 */
178 int requestUserToMoveJoint(const std::vector<double> &pose,
179 const std::vector<double> &q,
180 RobotMovementCallback callback);
181
182 /**
183 * @ingroup UserInteraction
184 * <p>
185 * Transition to the move tab widget to allow/request the end user to move
186 * the robot (either automatically or manually) to a desired target position
187 * specified by a pose.
188 * </p>
189 *
190 * <p>
191 * The Automove function will move the robot TCP to the target position
192 * linearly in Cartesian space. If this it not possible, the robot will move
193 * to the target linearly in joint space.
194 * </p>
195 *
196 * The current joint positions of the robot will be used as starting point
197 * for inverse kinematics to calculate a target joint vector corresponding
198 * to desired pose, taking the currently active TCP offset into account.
199 *
200 * @param pose The target pose the robot TCP will move to.
201 * @param callback The instance which callbacks will be made to.
202 * @throws IllegalStateException If the plugin screen is not active
203 * (visible).
204 */
205 QT_DEPRECATED int requestUserToMoveLine(const std::vector<double> &pose,
206 RobotMovementCallback callback);
207
208 /**
209 * @ingroup UserInteraction
210 * <p>
211 * Transition to the move tab widget to allow/request the end user to move
212 * the robot (either automatically or manually) to a desired target position
213 * specified by a pose.
214 * </p>
215 *
216 * <p>
217 * The Automove function will move the robot TCP to the target position
218 * linearly in Cartesian space. If this it not possible, the robot will move
219 * to the target linearly in joint space.
220 * </p>
221 *
222 * The current joint positions of the robot will be used as starting point
223 * for inverse kinematics to calculate a target joint vector corresponding
224 * to desired pose, taking the currently active TCP offset into account.
225 *
226 * @param pose The target pose the robot TCP will move to.
227 * @param tcpOffset
228 * @param callback The instance which callbacks will be made to.
229 * @throws IllegalStateException If the plugin screen is not active
230 * (visible).
231 */
232 int requestUserToMoveLine(const std::vector<double> &pose,
233 const std::vector<double> &tcpOffset,
234 RobotMovementCallback callback);
235
236 /**
237 * @ingroup UserInteraction
238 * \chinese
239 * 获取机器人缩略图
240 *
241 * @param q 关节角度
242 * @param pose 位姿
243 * @return 机器人缩略图
244 * \endchinese
245 * \english
246 * Get robot thumbnail.
247 *
248 * @param q joint angles
249 * @param pose pose
250 * @return robot thumbnail
251 * \endenglish
252 */
253 QPixmap *getRobotThumb(const std::vector<double> &q,
254 const std::vector<double> &pose);
255
256 /**
257 * @ingroup UserInteraction
258 * \chinese
259 * @brief setOperationLogDisplayName 设置操作日志显示名称
260 * @param pbn 界面按钮
261 * @param name 显示名称
262 * \endchinese
263 * \english
264 * @brief setOperationLogDisplayName
265 * @param pbn
266 * @param name
267 * \endenglish
268 */
269 void setOperationLogDisplayName(QWidget *pbn, const std::string &name);
270
271 /**
272 * @ingroup UserInteraction
273 * @return This method provides robot model drawing objects.
274 */
275 RenderInterfacePtr getRenderInterface();
276
277 /**
278 * @return This method provides popup manager.
279 */
280 PopupManagerPtr getPopupManager();
281
282private:
283 friend class DataSwitch;
285 void *d_{ nullptr };
286};
287
288} // namespace aubo_scope
289} // namespace arcs
290
291#endif // USERINTERACTION_H
#define ARCS_ABI_EXPORT
#define ARCS_CLASS_FORWARD(C)
Macro that forward declares a class and defines the respective smartpointers through ARCS_DECLARE_PTR...
\chinese TCP 接口 此接口表示 AuboScope 中的一个 TCP(工具中心点)。可以是用户定义的 TCP,也可以 是由 AuboCap 添加的 TCP。 \endchinese \eng...
定义 tcp.h:26
\chinese 用户交互接口 此接口提供向终端用户请求输入或操作的功能。 \endchinese \english UserInteraction This interface provides fu...
int requestUserToMoveJoint(const std::vector< double > &q, RobotMovementCallback callback)
int requestUserToMoveJoint(const std::vector< double > &pose, const std::vector< double > &q, RobotMovementCallback callback)
int requestUserToMoveJoint(const std::string &q, RobotMovementCallback callback)
requestUserToMoveJoint
void getUserDefinedRobotPosition(const std::vector< double > &tcpOffset, RobotPositionCallback callback)
\chinese 指定 tcpOffset 获取用户定义的机器人位置
RenderInterfacePtr getRenderInterface()
void getUserDefinedRobotPosition(RobotPositionCallback callback)
UserInteraction(UserInteraction &&f)
void setOperationLogDisplayName(QWidget *pbn, const std::string &name)
\chinese
QPixmap * getRobotThumb(const std::vector< double > &q, const std::vector< double > &pose)
\chinese 获取机器人缩略图
QT_DEPRECATED int requestUserToMoveLine(const std::vector< double > &pose, RobotMovementCallback callback)
UserInteraction(UserInteraction &f)
void getUserDefinedRobotPosition(const TCPPtr tcpOffset, RobotPositionCallback callback)
\chinese 指定 TCP 对象获取用户定义的机器人位置
void getUserDefinedRobotPosition(const std::string &tcpOffset, RobotPositionCallback callback)
\chinese 指定 tcpOffset 字符串获取用户定义的机器人位置
int requestUserToMoveLine(const std::vector< double > &pose, const std::vector< double > &tcpOffset, RobotMovementCallback callback)
KeyboardManagerPtr getKeyboardManager()
std::function< void( bool accepted, const std::vector< double > &pose, const std::vector< double > &q, const std::vector< double > &offset)> RobotPositionCallback
std::function< void(bool accepted, int error)> RobotMovementCallback