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