AuboCaps  0.4.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  /**
124  * <p>
125  * Transition to the move tab widget to allow/request the end user to move
126  * the robot (either automatically or manually) to a desired target position
127  * specified by a pose.
128  * </p>
129  *
130  * <p>
131  * The Automove function will move the robot TCP to the target position
132  * linearly in Cartesian space. If this it not possible, the robot will move
133  * to the target linearly in joint space.
134  * </p>
135  *
136  * The current joint positions of the robot will be used as starting point
137  * for inverse kinematics to calculate a target joint vector corresponding
138  * to desired pose, taking the currently active TCP offset into account.
139  *
140  * @param pose The target pose the robot TCP will move to.
141  * @param callback The instance which callbacks will be made to.
142  * @throws IllegalStateException If the URCap screen is not active
143  * (visible).
144  */
145  int requestUserToMoveLine(const std::vector<double> &pose,
146  RobotMovementCallback callback);
147 
148 private:
149  friend class DataSwitch;
150  UserInteraction();
151  void *d_{ nullptr };
152 };
153 
154 } // namespace aubo_scope
155 } // namespace arcs
156 
157 #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