ARCS SDK API  0.24.0
force_control.h
浏览该文件的文档.
1 /** @file force_control.h
2  * @brief 力控接口
3  *
4  * 力控的限制
5  * When the robot is force controlled, the following functionality is not
6  * accessible:
7  *
8  * • Collision Detection (option 613-1) \n
9  * • SoftMove (option 885-1) \n
10  * • Tracking functionality like Conveyor Tracking (option 606-1), Optical
11  * Tracking (6601) and Weld Guide (815-2) \n
12  * • Sensor Synchronization or Analog Synchronization \n
13  * • World Zones (option 608-1) \n
14  * • Independent Axes (option 610-1) \n
15  * • Path Offset (option 612-1) \n
16  * • Arc options \n
17  * • PickMaster options \n
18  * • Joint soft servo (instruction SoftAct) \n
19  * • Force Control cannot be activated when the robot is running in MultiMove
20  * Coordinated mode (option 604-1). \n
21  * • If Force Control is used together with SafeMove (option 810-2) or
22  * Electronic Position Switches (option 810-1), the function Operational
23  * Safety Range must be used. See the respective manual for these options. \n
24  * • RAPID instructions such as FCAct, FCDeact, FCConditionWaitWhile and
25  * FCRefStop can only be called from normal level in a motion task.
26  *
27  * 应用:抛光、打磨、清洁 \n
28  * FC Pressure \n
29  * 设置轨迹坐标系的z方向为力控轴,spring设置为0 \n
30  * 在还没接触前设置输出力为0,spring设置为固定值(根据vel确定) \n
31  * 离开接触面:设置输出力为0,spring设置为固定值 \n
32  *
33  * 活塞(Piston)装配 \n
34  * Forward clutch hub \n
35  * 设置力控终止模式
36  *
37  * 基于末端力传感器的拖动示教 \n
38  * spring = 0; force_ref = 0; 参考轨迹点任意
39  */
40 #ifndef AUBO_SDK_FORCE_CONTROL_INTERFACE_H
41 #define AUBO_SDK_FORCE_CONTROL_INTERFACE_H
42 
43 #include <vector>
44 #include <thread>
45 
46 #include <aubo/global_config.h>
47 #include <aubo/type_def.h>
48 
49 namespace arcs {
50 namespace common_interface {
51 
52 /**
53  * 力控接口抽象类
54  */
55 class ARCS_ABI_EXPORT ForceControl
56 {
57 public:
58  ForceControl();
59  virtual ~ForceControl();
60 
61  /**
62  * Start force control
63  *
64  * fcEnable is used to enable Force Control. At the same time as Force
65  * Control is enabled, fcEnable is used to define the coordinate system
66  * for Force Control, and tune the force and torque damping. If a coordinate
67  * system is not specified in fcEnable a default force control coordinate
68  * system is created with the same orientation as the work object coordinate
69  * system. All Force Control supervisions are activated by fcEnable.
70  *
71  * 使能力控。
72  * fcEnable 被用于使能力控。 在力控被使能的同时,
73  * fcEnable 用于定义力控的坐标系,并调整力和力矩的阻尼。
74  * 如果在 fcEnable 中未指定坐标系,
75  * 则会创建一个默认的力控制坐标系,其方向与工作对象坐标系相同。
76  * 所有力控制监管功能都被 fcEnable 激活。
77  *
78  * @return 成功返回0;失败返回错误码
79  * AUBO_BUSY
80  * AUBO_BAD_STATE
81  * -AUBO_BAD_STATE
82  *
83  * @throws arcs::common_interface::AuboException
84  *
85  * @par Python函数原型
86  * fcEnable(self: pyaubo_sdk.ForceControl) -> int
87  *
88  * @par Lua函数原型
89  * fcEnable() -> nil
90  *
91  * @par JSON-RPC请求示例
92  * {"jsonrpc":"2.0","method":"rob1.ForceControl.fcEnable","params":[],"id":1}
93  *
94  * @par JSON-RPC响应示例
95  * {"id":1,"jsonrpc":"2.0","result":0}
96  *
97  */
98  int fcEnable();
99 
100  /**
101  * End force control
102  *
103  * fcDisable is used to disable Force Control. After a successful
104  * deactivation the robot is back in position control.
105  *
106  * 失能力控。
107  * fcDisable 被用于失能力控。 在成功失能力控之后,机器人将回到位置控制模式。
108  *
109  * @return 成功返回0;失败返回错误码
110  * AUBO_BUSY
111  * AUBO_BAD_STATE
112  * -AUBO_BAD_STATE
113  *
114  * @throws arcs::common_interface::AuboException
115  *
116  * @par Python函数原型
117  * fcDisable(self: pyaubo_sdk.ForceControl) -> int
118  *
119  * @par Lua函数原型
120  * fcDisable() -> nil
121  *
122  * @par JSON-RPC请求示例
123  * {"jsonrpc":"2.0","method":"rob1.ForceControl.fcDisable","params":[],"id":1}
124  *
125  * @par JSON-RPC响应示例
126  * {"id":1,"jsonrpc":"2.0","result":0}
127  *
128  */
129  int fcDisable();
130 
131  /**
132  * 判断力控是否被使能
133  *
134  * @return 使能返回true,失能返回false
135  *
136  * @throws arcs::common_interface::AuboException
137  *
138  * @par Python函数原型
139  * isFcEnabled(self: pyaubo_sdk.ForceControl) -> bool
140  *
141  * @par Lua函数原型
142  * isFcEnabled() -> boolean
143  *
144  * @par JSON-RPC请求示例
145  * {"jsonrpc":"2.0","method":"rob1.ForceControl.isFcEnabled","params":[],"id":1}
146  *
147  * @par JSON-RPC响应示例
148  * {"id":1,"jsonrpc":"2.0","result":false}
149  *
150  */
151  bool isFcEnabled();
152 
153  /**
154  * 设置力控参考(目标)值
155  *
156  * @param feature: 参考几何特征,用于生成力控参考坐标系
157  * @param compliance: 柔性轴(方向)选择
158  * @param wrench: 目标力/力矩
159  * @param limits: 速度限制
160  * @param type: 力控参考坐标系类型
161  *
162  * @return 成功返回0;失败返回错误码
163  * AUBO_BUSY
164  * AUBO_BAD_STATE
165  * -AUBO_INVL_ARGUMENT
166  * -AUBO_BAD_STATE
167  *
168  * @throws arcs::common_interface::AuboException
169  *
170  * @par Python函数原型
171  * setTargetForce(self: pyaubo_sdk.ForceControl, arg0: List[float], arg1:
172  * List[bool], arg2: List[float], arg3: List[float], arg4:
173  * arcs::common_interface::TaskFrameType) -> int
174  *
175  * @par Lua函数原型
176  * setTargetForce(feature: table, compliance: table, wrench: table, limits:
177  * table, type: number) -> nil
178  *
179  */
180  int setTargetForce(const std::vector<double> &feature,
181  const std::vector<bool> &compliance,
182  const std::vector<double> &wrench,
183  const std::vector<double> &limits,
184  TaskFrameType type = TaskFrameType::FRAME_FORCE);
185 
186  /**
187  * 设置力控动力学模型
188  *
189  * @param m
190  * @param d
191  * @param k
192  *
193  * @return 成功返回0;失败返回错误码
194  * AUBO_BUSY
195  * AUBO_BAD_STATE
196  * -AUBO_INVL_ARGUMENT
197  * -AUBO_BAD_STATE
198  *
199  * @throws arcs::common_interface::AuboException
200  *
201  * @par Python函数原型
202  * setDynamicModel(self: pyaubo_sdk.ForceControl, arg0: List[float], arg1:
203  * List[float], arg2: List[float]) -> int
204  *
205  * @par Lua函数原型
206  * setDynamicModel(m: table, d: table, k: table) -> nil
207  *
208  */
209  int setDynamicModel(const std::vector<double> &m,
210  const std::vector<double> &d,
211  const std::vector<double> &k);
212 
213  /**
214  * 获取力控动力学模型
215  *
216  * @return 力控动力学模型
217  *
218  * @throws arcs::common_interface::AuboException
219  *
220  * @par Python函数原型
221  * getDynamicModel(self: pyaubo_sdk.ForceControl) -> Tuple[List[float],
222  * List[float], List[float]]
223  *
224  * @par Lua函数原型
225  * getDynamicModel() -> table
226  *
227  * @par JSON-RPC请求示例
228  * {"jsonrpc":"2.0","method":"rob1.ForceControl.getDynamicModel","params":[],"id":1}
229  *
230  * @par JSON-RPC响应示例
231  * {"id":1,"jsonrpc":"2.0","result":[[],[20.0,20.0,20.0,5.0,5.0,5.0],[]]}
232  *
233  */
234  DynamicsModel getDynamicModel();
235 
236  /**
237  * 设置力控终止条件:力,当测量的力在设置的范围之内,力控算法将保持运行,直到设置的条件不满足,力控将退出
238  *
239  * FCCondForce is used to set up an end condition based on measured force.
240  * The condition is lateractivated by calling the instruction
241  * FCCondWaitWhile, which will wait and hold the program execution while the
242  * specified condition is true. This allows the reference force, torque and
243  * movement to continue until the force is outside the specified limits.
244  *
245  * A force condition is set up by defining minimum and maximum limits for
246  * the force in the directions of the force control coordinate system. Once
247  * activated with FCCondWaitWhile, the program execution will continue to
248  * wait while the measured force is within its specified limits.
249  *
250  * It is possible to specify that the condition is fulfilled when the force
251  * is outside the specified limits instead. This is done by using the switch
252  * argument Outside. The condition on force is specified in the force
253  * control coordinate system. This coordinate system is setup by the user in
254  * the instruction FCAct.
255  *
256  * @param min 各方向最小的力/力矩
257  * @param max 各方向最大的力/力矩
258  * @param outside false 在设置条件的范围之内有效
259  * true 在设置条件的范围之外有效
260  * @param timeout
261  * 时间限制,单位s(秒),从开始力控到达该时间时,不管是否满足力控终止条件,都会终止力控
262  *
263  * @return 成功返回0;失败返回错误码
264  * AUBO_BUSY
265  * AUBO_BAD_STATE
266  * -AUBO_INVL_ARGUMENT
267  * -AUBO_BAD_STATE
268  *
269  * @throws arcs::common_interface::AuboException
270  *
271  * @par Python函数原型
272  * setCondForce(self: pyaubo_sdk.ForceControl, arg0: List[float], arg1:
273  * List[float], arg2: bool, arg3: float) -> int
274  *
275  * @par Lua函数原型
276  * setCondForce(min: table, max: table, outside: boolean, timeout: number)
277  * -> nil
278  *
279  */
280  int setCondForce(const std::vector<double> &min,
281  const std::vector<double> &max, bool outside,
282  double timeout);
283 
284  /**
285  * FCCondOrient is used to set up an end condition for the tool orientation.
286  * The condition is lateractivated by calling the instruction
287  * FCCondWaitWhile, which will wait and hold the program execution while the
288  * specified condition is true. This allows the reference force, torque and
289  * movement to continue until the orientation is outside the specified
290  * limits.
291  *
292  * An orientation condition is set up by defining a maximum angle and a
293  * maximum rotation from a reference orientation. The reference orientation
294  * is either defined by the current z direction of the tool, or by
295  * specifying an orientation in relation to the z direction of the work
296  * object.
297  *
298  * Once activated, the tool orientation must be within the limits (or
299  * outside, if the argument Outside is used).
300  *
301  * @param frame
302  * @param max_angle
303  * @param max_rot
304  * @param outside
305  * @param timeout
306  *
307  * @return 成功返回0;失败返回错误码
308  * AUBO_BUSY
309  * AUBO_BAD_STATE
310  * -AUBO_INVL_ARGUMENT
311  * -AUBO_BAD_STATE
312  *
313  * @throws arcs::common_interface::AuboException
314  *
315  * @par Python函数原型
316  * setCondOrient(self: pyaubo_sdk.ForceControl, arg0: List[float], arg1:
317  * float, arg2: float, arg3: bool, arg4: float) -> int
318  *
319  * @par Lua函数原型
320  * setCondOrient(frame: table, max_angle: number, max_rot: number, outside:
321  * boolean, timeout: number) -> nil
322  *
323  */
324  int setCondOrient(const std::vector<double> &frame, double max_angle,
325  double max_rot, bool outside, double timeout);
326 
327  /**
328  * 指定力控有效平面,x-y平面,z方向有效
329  *
330  * FCCondPos is used to set up an end condition for the TCP position. The
331  * condition is later activated by calling the instruction FCCondWaitWhile,
332  * which will wait and hold the program execution while the specified
333  * condition is true. This allows the reference force, torque and movement
334  * to continue until the specified position is outside the specified limits.
335  *
336  * A position condition is set up by defining a volume in space for the TCP
337  * position. Once activated the measured TCP position has to be within the
338  * specified volume (or outside, if the argument Outside is used).
339  *
340  * @param plane={A,B,C,D}
341  * 平面表示方法 Ax +By +Cz + D = 0
342  * 其中,n = (A, B, C)是平面的法向量,
343  * D 是将平面平移到坐标原点所需距离(所以D=0时,平面过原点)
344  * @param timeout
345  *
346  * @return 成功返回0;失败返回错误码
347  * AUBO_BUSY
348  * AUBO_BAD_STATE
349  * -AUBO_INVL_ARGUMENT
350  * -AUBO_BAD_STATE
351  *
352  * @throws arcs::common_interface::AuboException
353  *
354  * @par Python函数原型
355  * setCondPlane(self: pyaubo_sdk.ForceControl, arg0: List[float], arg1:
356  * float) -> int
357  *
358  * @par Lua函数原型
359  * setCondPlane(plane: table, timeout: number) -> nil
360  *
361  */
362  int setCondPlane(const std::vector<double> &plane, double timeout);
363 
364  /**
365  * 指定力控有效圆柱体,提供中心轴和圆柱半径,可以指定圆柱内部还是外部
366  *
367  * @param axis
368  * @param radius
369  * @param outside
370  * @param timeout
371  *
372  * @return 成功返回0;失败返回错误码
373  * AUBO_BUSY
374  * AUBO_BAD_STATE
375  * -AUBO_INVL_ARGUMENT
376  * -AUBO_BAD_STATE
377  *
378  * @throws arcs::common_interface::AuboException
379  *
380  * @par Python函数原型
381  * setCondCylinder(self: pyaubo_sdk.ForceControl, arg0: List[float], arg1:
382  * float, arg2: bool, arg3: float) -> int
383  *
384  * @par Lua函数原型
385  * setCondCylinder(axis: table, radius: number, outside: boolean, timeout:
386  * number) -> nil
387  *
388  */
389  int setCondCylinder(const std::vector<double> &axis, double radius,
390  bool outside, double timeout);
391 
392  /**
393  * 指定力控有效球体,提供球心和半径,可以指定球体内部还是外部
394  *
395  * @param center
396  * @param radius
397  * @param outside
398  * @param timeout
399  *
400  * @return 成功返回0;失败返回错误码
401  * AUBO_BUSY
402  * AUBO_BAD_STATE
403  * -AUBO_INVL_ARGUMENT
404  * -AUBO_BAD_STATE
405  *
406  * @throws arcs::common_interface::AuboException
407  *
408  * @par Python函数原型
409  * setCondSphere(self: pyaubo_sdk.ForceControl, arg0: List[float], arg1:
410  * float, arg2: bool, arg3: float) -> int
411  *
412  * @par Lua函数原型
413  * setCondSphere(center: table, radius: number, outside: boolean, timeout:
414  * number) -> nil
415  *
416  */
417  int setCondSphere(const std::vector<double> &center, double radius,
418  bool outside, double timeout);
419 
420  /**
421  * FCCondTCPSpeed is used to setup an end condition for the TCP speed. The
422  * condition is lateractivated by calling the instruction FCCondWaitWhile,
423  * which will wait and hold the program execution while the specified
424  * condition is true. This allows the reference force, torque and movement
425  * to continue until the speed is outside the specified limits.
426  *
427  * A TCP speed condition is setup up by defining minimum and maximum limits
428  * for the TCP speed in all directions of the work object. Once activated
429  * with FCCondWaitWhile, the program execution will continue to wait while
430  * the measured speed is within its specified limits.
431  *
432  * It is possible to specify that the condition is fulfilled when the speed
433  * is outside the specified limits instead. This is the done by using the
434  * switch argument Outside. The condition on TCP speed is specified in the
435  * work object coordinate system.
436  *
437  * @param min
438  * @param max
439  * @param outside
440  * @param timeout
441  *
442  * @return 成功返回0;失败返回错误码
443  * AUBO_BUSY
444  * AUBO_BAD_STATE
445  * -AUBO_INVL_ARGUMENT
446  * -AUBO_BAD_STATE
447  *
448  * @throws arcs::common_interface::AuboException
449  *
450  * @par Python函数原型
451  * setCondTcpSpeed(self: pyaubo_sdk.ForceControl, arg0: List[float], arg1:
452  * List[float], arg2: bool, arg3: float) -> int
453  *
454  * @par Lua函数原型
455  * setCondTcpSpeed(min: table, max: table, outside: boolean, timeout:
456  * number) -> nil
457  *
458  */
459  int setCondTcpSpeed(const std::vector<double> &min,
460  const std::vector<double> &max, bool outside,
461  double timeout);
462 
463  /**
464  * 力控终止条件-距离
465  *
466  * @param distance
467  * @param timeout
468  *
469  * @return 成功返回0;失败返回错误码
470  * AUBO_BUSY
471  * AUBO_BAD_STATE
472  * -AUBO_INVL_ARGUMENT
473  * -AUBO_BAD_STATE
474  *
475  * @throws arcs::common_interface::AuboException
476  *
477  */
478  int setCondDistance(double distance, double timeout);
479 
480  /**
481  * 高级力控终止条件
482  *
483  * @param type
484  * @param args
485  * @param timeout
486  *
487  * @return 成功返回0;失败返回错误码
488  * AUBO_BUSY
489  * AUBO_BAD_STATE
490  * -AUBO_INVL_ARGUMENT
491  * -AUBO_BAD_STATE
492  *
493  * @throws arcs::common_interface::AuboException
494  *
495  */
496  int setCondAdvanced(const std::string &type,
497  const std::vector<double> &args, double timeout);
498 
499  /**
500  * 激活力控终止条件
501  *
502  * @return 成功返回0;失败返回错误码
503  * AUBO_BUSY
504  * AUBO_BAD_STATE
505  * -AUBO_BAD_STATE
506  *
507  * @throws arcs::common_interface::AuboException
508  *
509  * @par Python函数原型
510  * setCondActive(self: pyaubo_sdk.ForceControl) -> int
511  *
512  * @par Lua函数原型
513  * setCondActive() -> nil
514  *
515  * @par JSON-RPC请求示例
516  * {"jsonrpc":"2.0","method":"rob1.ForceControl.setCondActive","params":[],"id":1}
517  *
518  * @par JSON-RPC响应示例
519  * {"id":1,"jsonrpc":"2.0","result":0}
520  *
521  */
522  int setCondActive();
523 
524  /**
525  * 力控终止条件是否已经满足
526  *
527  * @return
528  *
529  * @throws arcs::common_interface::AuboException
530  *
531  * @par Python函数原型
532  * isCondFullfiled(self: pyaubo_sdk.ForceControl) -> bool
533  *
534  * @par Lua函数原型
535  * isCondFullfiled() -> boolean
536  *
537  * @par JSON-RPC请求示例
538  * {"jsonrpc":"2.0","method":"rob1.ForceControl.isCondFullfiled","params":[],"id":1}
539  *
540  * @par JSON-RPC响应示例
541  * {"id":1,"jsonrpc":"2.0","result":false}
542  *
543  */
544  bool isCondFullfiled();
545 
546  /**
547  * FCSupvForce is used to set up force supervision in Force Control. The
548  * supervision is activated when Force Control is activated with the
549  * instruction FCAct.
550  *
551  * The force supervision is set up by defining minimum and maximum limits
552  * for the force in the directions of the force control coordinate system.
553  * Once activated, the supervision will stop the execution if the force is
554  * outside the allowed values. The force supervision is specified in the
555  * force control coordinate system. This coordinate system is setup by the
556  * user with the instruction FCAct.
557  *
558  * @param min
559  * @param max
560  *
561  * @return 成功返回0;失败返回错误码
562  * AUBO_BUSY
563  * AUBO_BAD_STATE
564  * -AUBO_INVL_ARGUMENT
565  * -AUBO_BAD_STATE
566  *
567  * @throws arcs::common_interface::AuboException
568  *
569  * @par Python函数原型
570  * setSupvForce(self: pyaubo_sdk.ForceControl, arg0: List[float], arg1:
571  * List[float]) -> int
572  *
573  * @par Lua函数原型
574  * setSupvForce(min: table, max: table) -> nil
575  *
576  */
577  int setSupvForce(const std::vector<double> &min,
578  const std::vector<double> &max);
579 
580  /**
581  * FCSupvOrient is used to set up an supervision for the tool orientation.
582  * The supervision is activated when Force Control is activated with the
583  * instruction FCAct.
584  *
585  * An orientation supervision is set up by defining a maximum angle and a
586  * maximum rotation from a reference orientation. The reference orientation
587  * is either defined by the current z direction of the tool, or by
588  * specifying an orientation in relation to the z direction of the work
589  * object.
590  *
591  * Once activated, the tool orientation must be within the limits otherwise
592  * the supervision will stop the execution.
593  *
594  * @param frame
595  * @param max_angle
596  * @param max_rot
597  * @param outside
598  *
599  * @return 成功返回0;失败返回错误码
600  * AUBO_BUSY
601  * AUBO_BAD_STATE
602  * -AUBO_INVL_ARGUMENT
603  * -AUBO_BAD_STATE
604  *
605  * @throws arcs::common_interface::AuboException
606  *
607  * @par Python函数原型
608  * setSupvOrient(self: pyaubo_sdk.ForceControl, arg0: List[float], arg1:
609  * float, arg2: float, arg3: bool) -> int
610  *
611  * @par Lua函数原型
612  * setSupvOrient(frame: table, max_angle: number, max_rot: number,
613  * outside: boolean) -> nil
614  *
615  */
616  int setSupvOrient(const std::vector<double> &frame, double max_angle,
617  double max_rot, bool outside);
618 
619  /**
620  * FCSupvPos is used to set up position supervision in Force Control.
621  * Supervision is activated when Force Control is activated with the
622  * instruction FCAct. Position supervision is set up by defining a volume in
623  * space for the TCP. Once activated, the supervision will stop the
624  * execution if the TCP is outside this volume.
625  *
626  * @param frame
627  * @param box
628  *
629  * @return 成功返回0;失败返回错误码
630  * AUBO_BUSY
631  * AUBO_BAD_STATE
632  * -AUBO_INVL_ARGUMENT
633  * -AUBO_BAD_STATE
634  *
635  * @throws arcs::common_interface::AuboException
636  *
637  * @par Python函数原型
638  * setSupvPosBox(self: pyaubo_sdk.ForceControl, arg0: List[float], arg1:
639  * List[float[6]]) -> int
640  *
641  * @par Lua函数原型
642  * setSupvPosBox(frame: table, box: table) -> nil
643  *
644  */
645  int setSupvPosBox(const std::vector<double> &frame, const Box &box);
646 
647  /**
648  *
649  * @param frame
650  * @param cylinder
651  *
652  * @return 成功返回0;失败返回错误码
653  * AUBO_BUSY
654  * AUBO_BAD_STATE
655  * -AUBO_INVL_ARGUMENT
656  * -AUBO_BAD_STATE
657  *
658  * @throws arcs::common_interface::AuboException
659  *
660  * @par Python函数原型
661  * setSupvPosCylinder(self: pyaubo_sdk.ForceControl, arg0: List[float],
662  * arg1: List[float[5]]) -> int
663  *
664  * @par Lua函数原型
665  * setSupvPosCylinder(frame: table, cylinder: table) -> nil
666  *
667  */
668  int setSupvPosCylinder(const std::vector<double> &frame,
669  const Cylinder &cylinder);
670 
671  /**
672  *
673  * @param frame
674  * @param sphere
675  *
676  * @return 成功返回0;失败返回错误码
677  * AUBO_BUSY
678  * AUBO_BAD_STATE
679  * -AUBO_INVL_ARGUMENT
680  * -AUBO_BAD_STATE
681  *
682  * @throws arcs::common_interface::AuboException
683  *
684  * @par Python函数原型
685  * setSupvPosSphere(self: pyaubo_sdk.ForceControl, arg0: List[float], arg1:
686  * List[float[3]]) -> int
687  *
688  * @par Lua函数原型
689  * setSupvPosSphere(frame: table, sphere: table) -> nil
690  *
691  */
692  int setSupvPosSphere(const std::vector<double> &frame,
693  const Sphere &sphere);
694 
695  /**
696  * FCSupvReoriSpeed is used to set up reorientation speed supervision in
697  * Force Control. The supervision is activated when Force Control is
698  * activated with the instruction FCAct.
699  *
700  * The reorientation speed supervision is set up by defining minimum and
701  * maximum limits for the reorientation speed around the axis of the work
702  * object coordinate system. Once activated, the supervision will stop the
703  * execution if the values of the reorientation speed are to high.
704  *
705  * There are two speed supervisions: FCSupvReoriSpeed and FCSupvTCPSpeed,
706  * which is described in section FCSupvTCPSpeed on page 199.
707  * Both supervisions may be required because:
708  * - A robot axis can rotate with high speed while the TCP is stationary.
709  * - The TCP can be far from the rotating axisand asmallaxis rotation may
710  * result in a high speed movement of the TCP
711  *
712  * @param speed_limit
713  * @param outside
714  * @param timeout
715  *
716  * @return 成功返回0;失败返回错误码
717  * AUBO_BUSY
718  * AUBO_BAD_STATE
719  * -AUBO_INVL_ARGUMENT
720  * -AUBO_BAD_STATE
721  *
722  * @throws arcs::common_interface::AuboException
723  *
724  * @par Python函数原型
725  * setSupvReoriSpeed(self: pyaubo_sdk.ForceControl, arg0: List[float], arg1:
726  * bool, arg2: float) -> int
727  *
728  * @par Lua函数原型
729  * setSupvReoriSpeed(speed_limit: table, outside: boolean, timeout: number)
730  * -> nil
731  *
732  */
733  int setSupvReoriSpeed(const std::vector<double> &speed_limit, bool outside,
734  double timeout);
735 
736  /**
737  * FCSupvTCPSpeed is used to set up TCP speed supervision in Force Control.
738  * The supervision is activated when Force Control is activated with the
739  * instruction FCAct. The TCP speed supervision is set up by defining
740  * minimum and maximum limits for the TCP speed in the directions of the
741  * work object coordinate system. Once activated, the supervision will stop
742  * the execution if too high TCP speed values are detected.
743  *
744  * There are two speed supervisions: FCSupvTCPSpeed and FCSupvReorispeed,
745  * which is described in section FCSupvReoriSpeed on page 197.
746  *
747  * Both supervisions may be required because:
748  * - A robot axis can rotate with high speed while the TCP is stationary.
749  * - The TCP can be far from the rotating axisand asmallaxis rotation may
750  * result in a high speed movement of the TCP.
751  *
752  * @param speed_limit
753  * @param outside
754  * @param timeout
755  *
756  * @return 成功返回0;失败返回错误码
757  * AUBO_BUSY
758  * AUBO_BAD_STATE
759  * -AUBO_INVL_ARGUMENT
760  * -AUBO_BAD_STATE
761  *
762  * @throws arcs::common_interface::AuboException
763  *
764  * @par Python函数原型
765  * setSupvTcpSpeed(self: pyaubo_sdk.ForceControl, arg0: List[float], arg1:
766  * bool, arg2: float) -> int
767  *
768  * @par Lua函数原型
769  * setSupvTcpSpeed(speed_limit: table, outside: boolean, timeout: number) ->
770  * nil
771  *
772  */
773  int setSupvTcpSpeed(const std::vector<double> &speed_limit, bool outside,
774  double timeout);
775 
776  // 设置低通滤波器
777  // --- force frame filter: 过滤测量到的力/力矩
778  // +++ force loop filter: 力控输出参考速度的滤波器
779 
780  /**
781  * 设置低通滤波器
782  *
783  * --- force frame filter: 过滤测量到的力/力矩
784  * +++ force loop filter: 力控输出参考速度的滤波器
785  *
786  * FCSetLPFilterTune is used change the response of force loop according to
787  * description in Damping and LP-filter on page 103.
788  *
789  * @param cutoff_freq
790  *
791  * @return 成功返回0;失败返回错误码
792  * AUBO_BUSY
793  * AUBO_BAD_STATE
794  * -AUBO_INVL_ARGUMENT
795  * -AUBO_BAD_STATE
796  *
797  * @throws arcs::common_interface::AuboException
798  *
799  * @par Python函数原型
800  * setLpFilter(self: pyaubo_sdk.ForceControl, arg0: List[float]) -> int
801  *
802  * @par Lua函数原型
803  * setLpFilter(cutoff_freq: table) -> nil
804  *
805  */
806  int setLpFilter(const std::vector<double> &cutoff_freq);
807 
808  /**
809  * 重置低通滤波器
810  *
811  * @return 成功返回0;失败返回错误码
812  * AUBO_BUSY
813  * AUBO_BAD_STATE
814  * -AUBO_BAD_STATE
815  *
816  * @throws arcs::common_interface::AuboException
817  *
818  * @par Python函数原型
819  * resetLpFilter(self: pyaubo_sdk.ForceControl) -> int
820  *
821  * @par Lua函数原型
822  * resetLpFilter() -> nil
823  *
824  * @par JSON-RPC请求示例
825  * {"jsonrpc":"2.0","method":"rob1.ForceControl.resetLpFilter","params":[],"id":1}
826  *
827  * @par JSON-RPC响应示例
828  * {"id":1,"jsonrpc":"2.0","result":0}
829  *
830  */
831  int resetLpFilter();
832 
833  /**
834  * The FCSpdChgAct is used to activate FC SpeedChange function with desired
835  * reference and recover behavior. When FC SpeedChange function is active,
836  * the robot speed will be reduced/increased in order to keep the measured
837  * signal close to the reference.
838  *
839  * @param ref_force
840  *
841  * @return 成功返回0;失败返回错误码
842  * AUBO_BUSY
843  * AUBO_BAD_STATE
844  * -AUBO_INVL_ARGUMENT
845  * -AUBO_BAD_STATE
846  *
847  * @throws arcs::common_interface::AuboException
848  *
849  * @par Python函数原型
850  * speedChangeEnable(self: pyaubo_sdk.ForceControl, arg0: float) -> int
851  *
852  * @par Lua函数原型
853  * speedChangeEnable(ref_force: number) -> nil
854  *
855  */
856  int speedChangeEnable(double ref_force);
857 
858  /**
859  * Deactivate FC SpeedChange function.
860  *
861  * @return 成功返回0;失败返回错误码
862  * AUBO_BUSY
863  * AUBO_BAD_STATE
864  * -AUBO_BAD_STATE
865  *
866  * @throws arcs::common_interface::AuboException
867  *
868  * @par Python函数原型
869  * speedChangeDisable(self: pyaubo_sdk.ForceControl) -> int
870  *
871  * @par Lua函数原型
872  * speedChangeDisable() -> nil
873  *
874  * @par JSON-RPC请求示例
875  * {"jsonrpc":"2.0","method":"rob1.ForceControl.speedChangeDisable","params":[],"id":1}
876  *
877  * @par JSON-RPC响应示例
878  * {"id":1,"jsonrpc":"2.0","result":0}
879  *
880  */
881  int speedChangeDisable();
882 
883  /**
884  * FCSpdChgTunSet is used to set FC SpeedChange system parameters to a new
885  * value.
886  *
887  * @param speed_levels
888  * @param speed_ratio_min
889  *
890  * @return 成功返回0;失败返回错误码
891  * AUBO_BUSY
892  * AUBO_BAD_STATE
893  * -AUBO_INVL_ARGUMENT
894  * -AUBO_BAD_STATE
895  *
896  * @throws arcs::common_interface::AuboException
897  *
898  * @par Python函数原型
899  * speedChangeTune(self: pyaubo_sdk.ForceControl, arg0: int, arg1: float) ->
900  * int
901  *
902  * @par Lua函数原型
903  * speedChangeTune(speed_levels: number, speed_ratio_min: number) -> nil
904  *
905  */
906  int speedChangeTune(int speed_levels, double speed_ratio_min);
907 
908  /* Defines how many Newtons are required to make the robot move 1 m/s. The
909  higher the value, the less responsive the robot gets.
910  The damping can be tuned (as a percentage of the system parameter values)
911  by the RAPID instruction FCAct. */
912  // 设置阻尼系数,阻尼的系统参数需要通过配置文件设置
913  // [damping_fx, damping_fy, damping_fz, damping_tx, damping_ty, damping_tz]
914  // A value between min and 10,000,000 Ns/m.
915  // A value between minimum and 10,000,000 Nms/rad.
916 
917  /**
918  * FCSetDampingTune is used to tune the damping in the force control
919  * coordinate systems. The parameters tuned are those described in Damping
920  * in Torque x Direction - Damping in Torque z Direction on page 255 and
921  * Damping in Force x Direction - Damping in Force z Direction on page 254.
922  *
923  * Damping can be set in the configuration file or by the instruction FCAct.
924  * The difference is that this instruction can be used when force control is
925  * active. FCSetDampingTune tunes the actual values set by the instruction
926  * FCAct, not the value in the configuration file.
927  *
928  * @param damping
929  * @param ramp_time
930  *
931  * @return 成功返回0;失败返回错误码
932  * AUBO_BUSY
933  * AUBO_BAD_STATE
934  * -AUBO_INVL_ARGUMENT
935  * -AUBO_BAD_STATE
936  *
937  * @throws arcs::common_interface::AuboException
938  *
939  * @par Python函数原型
940  * setDamping(self: pyaubo_sdk.ForceControl, arg0: List[float], arg1: float)
941  * -> int
942  *
943  * @par Lua函数原型
944  * setDamping(damping: table, ramp_time: number) -> nil
945  *
946  */
947  int setDamping(const std::vector<double> &damping, double ramp_time);
948 
949  /**
950  *
951  *
952  * @return 成功返回0;失败返回错误码
953  * AUBO_BUSY
954  * AUBO_BAD_STATE
955  * -AUBO_BAD_STATE
956  *
957  * @throws arcs::common_interface::AuboException
958  *
959  * @par Python函数原型
960  * resetDamping(self: pyaubo_sdk.ForceControl) -> int
961  *
962  * @par Lua函数原型
963  * resetDamping() -> nil
964  *
965  * @par JSON-RPC请求示例
966  * {"jsonrpc":"2.0","method":"rob1.ForceControl.resetDamping","params":[],"id":1}
967  *
968  * @par JSON-RPC响应示例
969  * {"id":1,"jsonrpc":"2.0","result":0}
970  *
971  */
972  int resetDamping();
973 
974  /**
975  *
976  * @return 成功返回0;失败返回错误码
977  * AUBO_BUSY
978  * AUBO_BAD_STATE
979  * -AUBO_BAD_STATE
980  *
981  * @throws arcs::common_interface::AuboException
982  *
983  * @par JSON-RPC请求示例
984  * {"jsonrpc":"2.0","method":"rob1.ForceControl.softFloatEnable","params":[],"id":1}
985  *
986  * @par JSON-RPC响应示例
987  * {"id":1,"jsonrpc":"2.0","result":0}
988  *
989  */
990  int softFloatEnable();
991 
992  /**
993  *
994  * @return 成功返回0;失败返回错误码
995  * AUBO_BUSY
996  * AUBO_BAD_STATE
997  * -AUBO_BAD_STATE
998  *
999  * @throws arcs::common_interface::AuboException
1000  *
1001  * @par JSON-RPC请求示例
1002  * {"jsonrpc":"2.0","method":"rob1.ForceControl.softFloatDisable","params":[],"id":1}
1003  *
1004  * @par JSON-RPC响应示例
1005  * {"id":1,"jsonrpc":"2.0","result":-1}
1006  *
1007  */
1008  int softFloatDisable();
1009 
1010  /**
1011  * 返回是否开启了软浮动
1012  *
1013  * @return
1014  *
1015  * @throws arcs::common_interface::AuboException
1016  *
1017  * @par JSON-RPC请求示例
1018  * {"jsonrpc":"2.0","method":"rob1.ForceControl.isSoftFloatEnabled","params":[],"id":1}
1019  *
1020  * @par JSON-RPC响应示例
1021  * {"id":1,"jsonrpc":"2.0","result":false}
1022  *
1023  */
1024  bool isSoftFloatEnabled();
1025 
1026  /**
1027  * 设置软浮动参数
1028  *
1029  * @param joint_softfloat
1030  * @param select
1031  * @param stiff_percent
1032  * @param stiff_damp_ratio
1033  * @param force_threshold
1034  * @param force_limit
1035  * @return
1036  */
1037  int setSoftFloatParams(bool joint_space, const std::vector<bool> &select,
1038  const std::vector<double> &stiff_percent,
1039  const std::vector<double> &stiff_damp_ratio,
1040  const std::vector<double> &force_threshold,
1041  const std::vector<double> &force_limit);
1042 
1043  /**
1044  * 检测工具和外部物体的接触
1045  *
1046  * @param direction
1047  * 预期的接触方向,如果所有的元素为0,表示检测所有方向的接触
1048  * @return
1049  * 返回从当前点回退到碰撞开始点的周期步数,如果返回值为0,表示没有接触
1050  */
1051  int toolContact(const std::vector<bool> &direction);
1052 
1053 protected:
1054  void *d_{ nullptr };
1055 };
1056 using ForceControlPtr = std::shared_ptr<ForceControl>;
1057 
1058 // clang-format off
1059 #define ForceControl_DECLARES \
1060  _INST(ForceControl, 0, fcEnable) \
1061  _INST(ForceControl, 0, fcDisable) \
1062  _FUNC(ForceControl, 0, isFcEnabled) \
1063  _INST(ForceControl, 5, setTargetForce, feature, compliance, wrench, limits, type) \
1064  _INST(ForceControl, 3, setDynamicModel, m, d, k) \
1065  _FUNC(ForceControl, 0, getDynamicModel) \
1066  _INST(ForceControl, 4, setCondForce, min, max, outside, timeout) \
1067  _INST(ForceControl, 5, setCondOrient, frame, max_angle, max_rot, outside, timeout) \
1068  _INST(ForceControl, 2, setCondPlane, plane, timeout) \
1069  _INST(ForceControl, 4, setCondCylinder, axis, radius, outside, timeout) \
1070  _INST(ForceControl, 4, setCondSphere, center, radius, outside, timeout) \
1071  _INST(ForceControl, 4, setCondTcpSpeed, min, max, outside, timeout) \
1072  _INST(ForceControl, 0, setCondActive) \
1073  _INST(ForceControl, 2, setCondDistance, distance, timeout) \
1074  _INST(ForceControl, 3, setCondAdvanced, type, args, timeout) \
1075  _FUNC(ForceControl, 0, isCondFullfiled) \
1076  _INST(ForceControl, 2, setSupvForce, min, max) \
1077  _INST(ForceControl, 4, setSupvOrient, frame, max_angle, max_rot, outside) \
1078  _INST(ForceControl, 2, setSupvPosBox, frame, box) \
1079  _INST(ForceControl, 2, setSupvPosCylinder, frame, cylinder) \
1080  _INST(ForceControl, 2, setSupvPosSphere, frame, sphere) \
1081  _INST(ForceControl, 3, setSupvReoriSpeed, speed_limit, outside, timeout) \
1082  _INST(ForceControl, 3, setSupvTcpSpeed, speed_limit, outside, timeout) \
1083  _INST(ForceControl, 1, setLpFilter, cutoff_freq) \
1084  _INST(ForceControl, 0, resetLpFilter) \
1085  _INST(ForceControl, 2, speedChangeTune, speed_levels, speed_ratio_min) \
1086  _INST(ForceControl, 1, speedChangeEnable, ref_force) \
1087  _INST(ForceControl, 0, speedChangeDisable) \
1088  _INST(ForceControl, 2, setDamping, damping, ramp_time) \
1089  _INST(ForceControl, 0, resetDamping) \
1090  _INST(ForceControl, 0, softFloatEnable) \
1091  _INST(ForceControl, 0, softFloatDisable) \
1092  _FUNC(ForceControl, 0, isSoftFloatEnabled) \
1093  _INST(ForceControl, 6, setSoftFloatParams, joint_space, select, stiff_percent, stiff_damp_ratio, force_threshold, force_limit) \
1094  _FUNC(ForceControl, 1, toolContact, direction)
1095 // clang-format on
1096 } // namespace common_interface
1097 } // namespace arcs
1098 
1099 #endif // AUBO_SDK_FORCE_CONTROL_INTERFACE_H
数据类型的定义
std::vector< double > Box
Definition: type_def.h:688
std::shared_ptr< ForceControl > ForceControlPtr
std::vector< double > Cylinder
Definition: type_def.h:695
std::vector< double > Sphere
Definition: type_def.h:700
std::tuple< std::vector< double >, std::vector< double >, std::vector< double >> DynamicsModel
Definition: type_def.h:680
Definition: aubo_api.h:17