7. Security Settings
7.1. Setting the collision level
Prototype |
|
|---|---|
Description |
Setting the collision level |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
7.2. Setting the post-collision strategy
Prototype |
|
|---|---|
Description |
Set post-crash strategy |
Mandatory parameters |
|
Default parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
7.3. The Custom collision detection threshold function starts to set the collision detection thresholds of the joint end and TCP end
New in version python: SDK-v2.1.0
Prototype |
|
|---|---|
Description |
The Custom collision detection threshold function starts to set the collision detection thresholds of the joint end and TCP end |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
|
7.4. The custom collision detection threshold function is disabled
New in version python: SDK-v2.1.0
Prototype |
|
|---|---|
Description |
The custom collision detection threshold function is disabled |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
7.5. Robot collision level setting code example
1from fairino import Robot
2import time
3# Establish a connection with the robot controller and return a robot object if the connection is successful
4robot = Robot.RPC('192.168.58.2')
5mode = 0
6config = 1
7level1 = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
8level2 = [50.0, 20.0, 30.0, 40.0, 50.0, 60.0]
9rtn = robot.SetAnticollision(mode, level1, config)
10print(f"SetAnticollision mode 0 rtn is {rtn}")
11mode = 1
12rtn = robot.SetAnticollision(mode, level2, config)
13print(f"SetAnticollision mode 1 rtn is {rtn}")
14p1Joint = [-11.904, -99.669, 117.473, -108.616, -91.726, 74.256]
15p2Joint = [-45.615, -106.172, 124.296, -107.151, -91.282, 74.255]
16p1Desc = [-419.524, -13.000, 351.569, -178.118, 0.314, 3.833]
17p2Desc = [-321.222, 185.189, 335.520, -179.030, -1.284, -29.869]
18exaxisPos = [0.0, 0.0, 0.0, 0.0]
19offdese = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
20robot.MoveL(desc_pos=p2Desc, tool=0, user=0, vel=100, blendR=2)
21robot.ResetAllError()
22safety = [5, 5, 5, 5, 5, 5]
23rtn = robot.SetCollisionStrategy(3, 1000, 150, 250, safety)
24print(f"SetCollisionStrategy rtn is {rtn}")
25jointDetectionThreshould = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1]
26tcpDetectionThreshould = [60, 60, 60, 60, 60, 60]
27rtn = robot.CustomCollisionDetectionStart(3, jointDetectionThreshould, tcpDetectionThreshould, 0)
28print(f"CustomCollisionDetectionStart rtn is {rtn}")
29robot.MoveL(desc_pos=p1Desc, tool=0, user=0, vel=100)
30robot.MoveL(desc_pos=p2Desc, tool=0, user=0, vel=100)
31rtn = robot.CustomCollisionDetectionEnd()
32print(f"CustomCollisionDetectionEnd rtn is {rtn}")
33robot.CloseRPC()
7.6. Setting the positive limit
Prototype |
|
|---|---|
Description |
Setting positive limits |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
7.7. Setting the negative limit
Prototype |
|
|---|---|
Description |
Setting negative limits |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
7.8. Obtaining the soft limiting angle of a joint
Prototype |
|
|---|---|
Description |
Acquisition of joint soft limiting angle |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
7.9. Robot limit setting code example
1from fairino import Robot
2import time
3# Establish a connection with the robot controller and return a robot object if the connection is successful
4robot = Robot.RPC('192.168.58.2')
5plimit = [170.0, 80.0, 150.0, 80.0, 170.0, 160.0]
6robot.SetLimitPositive(plimit)
7nlimit = [-170.0, -260.0, -150.0, -260.0, -170.0, -160.0]
8robot.SetLimitNegative(nlimit)
9error,neg_deg = robot.GetJointSoftLimitDeg(0)
10print(f"pos limit deg: {neg_deg[1]}, {neg_deg[3]}, {neg_deg[5]}, {neg_deg[7]}, {neg_deg[9]}, {neg_deg[11]}")
11print(f"neg limit deg: {neg_deg[0]}, {neg_deg[2]}, {neg_deg[4]}, {neg_deg[6]}, {neg_deg[8]}, {neg_deg[10]}")
12robot.CloseRPC()
7.10. Setting up a robot collision detection method
New in version python: SDK-v2.1.2
prototype |
|
|---|---|
Description |
Sets the robot collision detection method. |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
|
7.11. Set static undercollision detection to start off
New in version python: SDK-v2.0.5
Prototype |
|
|---|---|
Description |
Set static undercollision detection to start off |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
|
7.12. Set up the robot collision detection method code example
1from fairino import Robot
2import time
3# Establish a connection with the robot controller and return a robot object if the connection is successful
4robot = Robot.RPC('192.168.58.2')
5rtn = robot.SetCollisionDetectionMethod(0,0)
6rtn = robot.SetStaticCollisionOnOff(1)
7print(f"SetStaticCollisionOnOff On rtn is {rtn}")
8time.sleep(5)
9rtn = robot.SetStaticCollisionOnOff(0)
10print(f"SetStaticCollisionOnOff Off rtn is {rtn}")
11robot.CloseRPC()
7.13. Joint torque and power detection
New in version python: SDK-v2.0.5
Prototype |
|
|---|---|
Description |
Joint torque and power detection |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
|
7.14. Sample code for joint torque power detection
1from fairino import Robot
2import time
3# Establish a connection with the robot controller and return a robot object if the connection is successful
4robot = Robot.RPC('192.168.58.2')
5robot.DragTeachSwitch(1)
6robot.SetPowerLimit(1, 200)
7error,torques = robot.GetJointTorques(1)
8count = 100
9robot.ServoJTStart()
10while count > 0:
11 error = robot.ServoJT(torques, 0.001)
12 count -= 1
13 time.sleep(0.001) # 1ms delay
14error = robot.ServoJTEnd()
15robot.DragTeachSwitch(0)
16robot.CloseRPC()
7.15. Set Safety Speed Parameters
Prototype |
|
|---|---|
Description |
Set safety speed parameters |
Required Parameters |
|
Default Parameters |
None |
Return Value |
|
7.16. SDK Code Example for Setting Safety Speed Parameters
1from time import sleep
2import time
3from fairino import Robot
4
5# Establish connection with robot controller
6robot = Robot.RPC('192.168.58.2')
7
8def TestSetVelReducePara(self):
9 # Initialize joint position, external axis and offset
10 j1 = [0, -90, 90, 0, 0, 0]
11 j2 = [90, -90, 90, 0, 0, 0]
12 epos = [0, 0, 0, 0]
13 offset_pos = [0, 0, 0, 0, 0, 0]
14
15 # Set base speed
16 robot.SetSpeed(80)
17
18 # Test parameter error case (mode=2 invalid?)
19 rtn = robot.SetVelReducePara(2, 30, 1)
20 print(f"SetVelReducePara param error rtn is {rtn}")
21
22 # Disable speed reduction function (mode=0, action=1 indicates disable)
23 rtn = robot.SetVelReducePara(0, 30, 1)
24 print(f"SetVelReducePara disable reduce vel rtn is {rtn}")
25 robot.MoveJ(joint_pos=j1, tool=0, user=0, vel=100, acc=100, ovl=100,
26 exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
27 robot.MoveJ(joint_pos=j2, tool=0, user=0, vel=100, acc=100, ovl=100,
28 exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
29
30 # Enable speed reduction function (mode=1, action=1)
31 rtn = robot.SetVelReducePara(1, 30, 1)
32 print(f"SetVelReducePara reduce vel rtn is {rtn}")
33 robot.MoveJ(joint_pos=j1, tool=0, user=0, vel=100, acc=100, ovl=100,
34 exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
35 robot.MoveJ(joint_pos=j2, tool=0, user=0, vel=100, acc=100, ovl=100,
36 exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
37
38 # Test action=2 (may indicate emergency stop or disable robot)
39 rtn = robot.SetVelReducePara(2, 30, 2)
40 print(f"SetVelReducePara disable robot rtn is {rtn}")
41 robot.MoveJ(joint_pos=j1, tool=0, user=0, vel=100, acc=100, ovl=100,
42 exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
43 robot.MoveJ(joint_pos=j2, tool=0, user=0, vel=100, acc=100, ovl=100,
44 exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
45
46 # Wait, reset errors and re-enable robot
47 time.sleep(2)
48 robot.ResetAllError()
49 robot.RobotEnable(1)
50 time.sleep(1)
51
52 # Test action=0 (may indicate only report error, no action)
53 rtn = robot.SetVelReducePara(2, 30, 0)
54 print(f"SetVelReducePara report error rtn is {rtn}")
55 robot.MoveJ(joint_pos=j1, tool=0, user=0, vel=100, acc=100, ovl=100,
56 exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
57 robot.MoveJ(joint_pos=j2, tool=0, user=0, vel=100, acc=100, ovl=100,
58 exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
59
60 # Close connection
61 robot.CloseRPC()
62
63TestSetVelReducePara(robot)