7.1. Setting the collision level
Prototype | SetAnticollision (mode,level,config) |
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 | SetCollisionStrategy(strategy,safeTime,safeDistance,safeVel,safetyMargin) |
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 | CustomCollisionDetectionStart(flag, jointDetectionThreshould, tcpDetectionThreshould, block) |
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 | CustomCollisionDetectionEnd() |
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
from fairino import Robot
import time
# Establish a connection with the robot controller and return a robot object if the connection is successful
robot = Robot.RPC('192.168.58.2')
mode = 0
config = 1
level1 = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
level2 = [50.0, 20.0, 30.0, 40.0, 50.0, 60.0]
rtn = robot.SetAnticollision(mode, level1, config)
print(f"SetAnticollision mode 0 rtn is {rtn}")
mode = 1
rtn = robot.SetAnticollision(mode, level2, config)
print(f"SetAnticollision mode 1 rtn is {rtn}")
p1Joint = [-11.904, -99.669, 117.473, -108.616, -91.726, 74.256]
p2Joint = [-45.615, -106.172, 124.296, -107.151, -91.282, 74.255]
p1Desc = [-419.524, -13.000, 351.569, -178.118, 0.314, 3.833]
p2Desc = [-321.222, 185.189, 335.520, -179.030, -1.284, -29.869]
exaxisPos = [0.0, 0.0, 0.0, 0.0]
offdese = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
robot.MoveL(desc_pos=p2Desc, tool=0, user=0, vel=100, blendR=2)
robot.ResetAllError()
safety = [5, 5, 5, 5, 5, 5]
rtn = robot.SetCollisionStrategy(3, 1000, 150, 250, safety)
print(f"SetCollisionStrategy rtn is {rtn}")
jointDetectionThreshould = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1]
tcpDetectionThreshould = [60, 60, 60, 60, 60, 60]
rtn = robot.CustomCollisionDetectionStart(3, jointDetectionThreshould, tcpDetectionThreshould, 0)
print(f"CustomCollisionDetectionStart rtn is {rtn}")
robot.MoveL(desc_pos=p1Desc, tool=0, user=0, vel=100)
robot.MoveL(desc_pos=p2Desc, tool=0, user=0, vel=100)
rtn = robot.CustomCollisionDetectionEnd()
print(f"CustomCollisionDetectionEnd rtn is {rtn}")
robot.CloseRPC()
7.6. Setting the positive limit
Prototype | SetLimitPositive(p_limit) |
Description | Setting positive limits |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
7.7. Setting the negative limit
Prototype | SetLimitNegative(n_limit) |
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 | GetJointSoftLimitDeg(flag=1) |
Description | Acquisition of joint soft limiting angle |
Mandatory parameters | NULL |
Default parameters | flag: 0-blocking, 1-non-blocking Default 1 |
Return Value |
|
7.9. Robot limit setting code example
from fairino import Robot
import time
# Establish a connection with the robot controller and return a robot object if the connection is successful
robot = Robot.RPC('192.168.58.2')
plimit = [170.0, 80.0, 150.0, 80.0, 170.0, 160.0]
robot.SetLimitPositive(plimit)
nlimit = [-170.0, -260.0, -150.0, -260.0, -170.0, -160.0]
robot.SetLimitNegative(nlimit)
error,neg_deg = robot.GetJointSoftLimitDeg(0)
print(f"pos limit deg: {neg_deg[1]}, {neg_deg[3]}, {neg_deg[5]}, {neg_deg[7]}, {neg_deg[9]}, {neg_deg[11]}")
print(f"neg limit deg: {neg_deg[0]}, {neg_deg[2]}, {neg_deg[4]}, {neg_deg[6]}, {neg_deg[8]}, {neg_deg[10]}")
robot.CloseRPC()
7.10. Setting up a robot collision detection method
New in version python: SDK-v2.1.2
prototype | SetCollisionDetectionMethod(method, thresholdMode) |
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 | SetStaticCollisionOnOff(status) |
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
from fairino import Robot
import time
# Establish a connection with the robot controller and return a robot object if the connection is successful
robot = Robot.RPC('192.168.58.2')
rtn = robot.SetCollisionDetectionMethod(0,0)
rtn = robot.SetStaticCollisionOnOff(1)
print(f"SetStaticCollisionOnOff On rtn is {rtn}")
time.sleep(5)
rtn = robot.SetStaticCollisionOnOff(0)
print(f"SetStaticCollisionOnOff Off rtn is {rtn}")
robot.CloseRPC()
7.13. Joint torque and power detection
New in version python: SDK-v2.0.5
Prototype | SetPowerLimit(status, power) |
Description | Joint torque and power detection |
Mandatory parameters |
|
Default parameters | NULL |
Return Value |
|
7.14. Sample code for joint torque power detection
from fairino import Robot
import time
# Establish a connection with the robot controller and return a robot object if the connection is successful
robot = Robot.RPC('192.168.58.2')
robot.DragTeachSwitch(1)
robot.SetPowerLimit(1, 200)
error,torques = robot.GetJointTorques(1)
count = 100
robot.ServoJTStart()
while count > 0:
error = robot.ServoJT(torques, 0.001)
count -= 1
time.sleep(0.001) # 1ms delay
error = robot.ServoJTEnd()
robot.DragTeachSwitch(0)
robot.CloseRPC()