AUBO SDK  0.26.0
gripper_interface.h
Go to the documentation of this file.
1/** @file gripper_interface.h
2 * @brief 通用夹爪接口
3 */
4#ifndef AUBO_SDK_GRIPPER_INTERFACE_H
5#define AUBO_SDK_GRIPPER_INTERFACE_H
6
7#include <aubo/sync_move.h>
8#include <aubo/trace.h>
9
10namespace arcs {
11namespace common_interface {
12
13/**
14 * @defgroup GripperInterface GripperInterface (夹爪)
15 * \~chinese 通用夹爪API接口
16 */
17class ARCS_ABI_EXPORT GripperInterface
18{
19public:
22
23 /**
24 * @ingroup GripperInterface
25 * \chinese
26 * 获取支持的所有夹爪
27 *
28 * @return
29 * \endchinese
30 */
31 std::vector<std::string> gripperGetSupportedModels();
32
33 /**
34 * @ingroup GripperInterface
35 * \chinese
36 * 扫描该型号下的所有设备
37 *
38 * @param model 夹爪品牌型号
39 * @param device_name 设备名
40 * @return 成功返回设备列表和0,失败返回错误码
41 * \endchinese
42 */
43 ResultWithErrno2 gripperScanDevices(const std::string &model,
44 const std::string &device_name);
45
46 /**
47 * @ingroup GripperInterface
48 * \chinese
49 * 获取已添加的夹爪
50 * @return
51 */
52 std::vector<std::string> gripperGetNames();
53
54 /**
55 * @ingroup GripperInterface
56 * \chinese
57 * 添加夹爪
58 *
59 * @param name 用户自定义名字,唯一
60 * @param model 夹爪品牌及型号
61 * @return 成功返回0,失败返回错误码
62 * \endchinese
63 */
64 int gripperAdd(const std::string &name, const std::string &model);
65
66 /**
67 * @ingroup GripperInterface
68 * \chinese
69 * 删除夹爪
70 *
71 * @param name 用户自定义名字
72 * @return 成功返回0,失败返回错误码
73 * \endchinese
74 */
75 int gripperDelete(const std::string &name);
76
77 /**
78 * @ingroup GripperInterface
79 * \chinese
80 * 修改夹爪名
81 *
82 * @param name
83 * @param new_name 新名字
84 * @return 成功返回0,失败返回错误码
85 * \endchinese
86 */
87 int gripperRename(const std::string &name, const std::string &new_name);
88
89 /**
90 * @ingroup GripperInterface
91 * \chinese
92 * 夹爪连接
93 *
94 * @param name
95 * @param device_name 设备名
96 * @return 成功返回0,失败返回错误码
97 * \endchinese
98 */
99 int gripperConnect(const std::string &name, const std::string &device_name);
100
101 /**
102 * @ingroup GripperInterface
103 * \chinese
104 * 夹爪断开连接
105 *
106 * @param name
107 * @return 成功返回0,失败返回错误码
108 * \endchinese
109 */
110 int gripperDisconnect(const std::string &name);
111
112 /**
113 * @ingroup GripperInterface
114 * \chinese
115 * 夹爪是否连接
116 *
117 * @param name
118 * @return 已连接返回true,未连接返回false
119 * \endchinese
120 */
121 bool gripperIsConnected(const std::string &name);
122
123 /**
124 * @ingroup GripperInterface
125 * \chinese
126 * 设置工作模式
127 *
128 * @param name
129 * @param work_mode 工作模式
130 * @return 成功返回0,失败返回错误码
131 * \endchinese
132 */
133 int gripperSetWorkMode(const std::string &name, int work_mode);
134
135 /**
136 * @ingroup GripperInterface
137 * \chinese
138 * 获取工作模式
139 *
140 * @param name
141 * @return 返回工作模式
142 * \endchinese
143 */
144 int gripperGetWorkMode(const std::string &name);
145
146 /**
147 * @ingroup GripperInterface
148 * \chinese
149 * 设置夹爪安装偏移
150 *
151 * @param name
152 * @param isVisibled 是否显示
153 * @param pose 末端(不包括手指)相对法兰的位姿
154 * @return 成功返回true,失败返回false
155 * \endchinese
156 */
157 int gripperSetMountPose(const std::string &name,
158 const std::vector<double> &pose,
159 bool enable_collision);
160
161 /**
162 * @brief 获取夹爪安装偏移
163 * @param name
164 * @return 返回夹爪安装偏移
165 */
166 std::vector<double> gripperGetMountPose(const std::string &name);
167
168 /**
169 * @ingroup GripperInterface
170 * \chinese
171 * 使能夹爪
172 *
173 * @param name
174 * @return
175 * \endchinese
176 */
177 int gripperEnable(const std::string &name, bool enable);
178
179 /**
180 * @ingroup GripperInterface
181 * \chinese
182 * 夹爪是否使能
183 *
184 * @param name
185 * @return
186 * \endchinese
187 */
188 bool gripperIsEnabled(const std::string &name);
189
190 /**
191 * @ingroup GripperInterface
192 * \chinese
193 * 设置运动参数
194 *
195 * @param name
196 * @param position 位置,单位:m/Pa
197 * @param velocity_percent 速度,单位:%,范围:[0, 1]
198 * @param force 夹持力,单位:N
199 * @param angle 旋转角度,单位:rad
200 * @param r_velocity_percent 旋转速度,单位:%,范围:[0, 1]
201 * @param torque_percent 旋转扭矩,单位:%,范围:[0, 1]
202 *
203 * @return
204 * \endchinese
205 */
206 int gripperSetPosition(const std::string &name, const double position);
207 int gripperSetVelocity(const std::string &name,
208 const double velocity_percent);
209 int gripperSetForce(const std::string &name, const double force);
210 int gripperSetAngle(const std::string &name, const double angle);
211 int gripperSetRVelocity(const std::string &name,
212 const double r_velocity_percent);
213 int gripperSetTorque(const std::string &name, const double torque_percent);
214
215 /**
216 * @ingroup GripperInterface
217 * \chinese
218 * 开始运动
219 *
220 * @param name
221 * @return
222 * \endchinese
223 */
224 int gripperMove(const std::string &name);
225
226 /**
227 * @ingroup GripperInterface
228 * \chinese
229 * 停止运动
230 *
231 * @param name
232 * @return
233 * \endchinese
234 */
235 int gripperStop(const std::string &name);
236
237 /**
238 * @ingroup GripperInterface
239 * \chinese
240 * 获取夹爪状态
241 *
242 * @param name
243 * @return
244 *
245 * @note 位置,速度,夹持力,旋转角度,旋转速度,旋转扭矩的单位与Set接口一致
246 *
247 * \endchinese
248 */
249 std::string gripperGetHardwareVersion(const std::string &name);
250 std::string gripperGetSoftwareVersion(const std::string &name);
251 double gripperGetPosition(const std::string &name);
252 double gripperGetVelocity(const std::string &name);
253 double gripperGetForce(const std::string &name);
254 double gripperGetAngle(const std::string &name);
255 double gripperGetRVelocity(const std::string &name);
256 double gripperGetTorque(const std::string &name);
257 bool gripperGetObjectDetection(const std::string &name);
258 bool gripperGetMotionState(const std::string &name);
259 double gripperGetVoltage(const std::string &name);
260 double gripperGetTemperature(const std::string &name);
261
262 /**
263 * @ingroup GripperInterface
264 * \chinese
265 * 重置modbus从站ID
266 *
267 * @param name
268 * @param slave_id 从站Id
269 * @return
270 * \endchinese
271 */
272 int gripperResetSlaveId(const std::string &name, const int slave_id);
273
274 /**
275 * @ingroup GripperInterface
276 * \chinese
277 * 获取夹爪状态
278 * @param name
279 * @return 状态
280 * \endchinese
281 */
282 int gripperGetStatusCode(const std::string &name);
283
284protected:
285 void *d_;
286};
287using GripperInterfacePtr = std::shared_ptr<GripperInterface>;
288
289} // namespace common_interface
290} // namespace arcs
291
292#endif // AUBO_SDK_GRIPPER_INTERFACE_H
double gripperGetVoltage(const std::string &name)
double gripperGetAngle(const std::string &name)
double gripperGetVelocity(const std::string &name)
int gripperSetRVelocity(const std::string &name, const double r_velocity_percent)
std::string gripperGetSoftwareVersion(const std::string &name)
std::vector< double > gripperGetMountPose(const std::string &name)
获取夹爪安装偏移
double gripperGetTorque(const std::string &name)
int gripperSetAngle(const std::string &name, const double angle)
bool gripperGetObjectDetection(const std::string &name)
double gripperGetForce(const std::string &name)
double gripperGetRVelocity(const std::string &name)
int gripperSetTorque(const std::string &name, const double torque_percent)
int gripperSetVelocity(const std::string &name, const double velocity_percent)
double gripperGetTemperature(const std::string &name)
int gripperSetForce(const std::string &name, const double force)
bool gripperGetMotionState(const std::string &name)
double gripperGetPosition(const std::string &name)
std::vector< std::string > gripperGetSupportedModels()
int gripperSetWorkMode(const std::string &name, int work_mode)
int gripperEnable(const std::string &name, bool enable)
int gripperResetSlaveId(const std::string &name, const int slave_id)
int gripperGetWorkMode(const std::string &name)
int gripperStop(const std::string &name)
int gripperSetMountPose(const std::string &name, const std::vector< double > &pose, bool enable_collision)
bool gripperIsConnected(const std::string &name)
int gripperGetStatusCode(const std::string &name)
int gripperAdd(const std::string &name, const std::string &model)
int gripperMove(const std::string &name)
std::vector< std::string > gripperGetNames()
int gripperConnect(const std::string &name, const std::string &device_name)
ResultWithErrno2 gripperScanDevices(const std::string &model, const std::string &device_name)
int gripperRename(const std::string &name, const std::string &new_name)
int gripperSetPosition(const std::string &name, const double position)
std::string gripperGetHardwareVersion(const std::string &name)
int gripperDelete(const std::string &name)
bool gripperIsEnabled(const std::string &name)
int gripperDisconnect(const std::string &name)
std::tuple< std::vector< std::string >, int > ResultWithErrno2
Definition type_def.h:787
std::shared_ptr< GripperInterface > GripperInterfacePtr
同步运行
Interface for injecting logs into the controller's logging system.