top of page

Python 7. Security Settings

7.1. Setting the collision level

Prototype

SetAnticollision (mode,level,config)

Description

Setting the collision level

Mandatory parameters

  • mode: 0 - level, 1 - percentage;

  • level=[j1,j2,j3,j4,j5,j6]: collision threshold;

  • config: 0 - do not update configuration file, 1 - update configuration file

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

  • strategy: 0 - report error and pause, 1 - keep running, 2 - error stop, 3 - heavy moment mode, 4 - shock response mode, 5 - impact rebound mode

Default parameters

  • safeTime: safe stop time [1000-2000] ms, default: 1000

  • safeDistance: safe stopping distance [1-150] mm, default: 100

  • safeVel: safe stopping speed[50-250]mm/s, default: 250

  • safetyMargin[6]: safety margin [1-10], default: [10,10,10,10,10,10,10]

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

  • flag: 1- Only joint detection is turned on; 2- Only TCP detection is enabled. 3- Joint and TCP detection are enabled simultaneously

  • jointDetectionThreshould: Joint collision detection threshold j1-j6

  • tcpDetectionThreshould: indicates TCP collision detection threshold, xyzabc

  • block: 0- non-blocking; 1- block

Default parameters

NULL

Return Value

  • errcode Success-0 Failure- errcode

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

  • errcode Success-0 Failure- errcode

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.02.03.04.05.06.0]
level2 = [50.020.030.040.050.060.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.669117.473-108.616-91.72674.256]
p2Joint = [-45.615-106.172124.296-107.151-91.28274.255]
p1Desc = [-419.524-13.000351.569-178.1180.3143.833]
p2Desc = [-321.222185.189335.520-179.030-1.284-29.869]
exaxisPos = [0.00.00.00.0]
offdese = [0.00.00.00.00.00.0]
robot.MoveL(desc_pos=p2Desc, tool=0, user=0, vel=100, blendR=2)
robot.ResetAllError()
safety = [555555]
rtn = robot.SetCollisionStrategy(31000150250, safety)
print(f"SetCollisionStrategy rtn is {rtn}")
jointDetectionThreshould = [0.10.10.10.10.10.1]
tcpDetectionThreshould = [606060606060]
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

  • p_limit=[j1,j2,j3,j4,j5,j6]: six joint positions

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

  • n_limit=[j1,j2,j3,j4,j5,j6]: six joint positions

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

  • errorcode Success-0 Failure- errcode

  • [j1min,j1max,j2min,j2max,j3min,j3max, j4min,j4max,j5min, j5max, j6min,j6max]: Axis 1 to Axis 6, joints with negative and positive limits, in [mm]

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.080.0150.080.0170.0160.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

  • method: collision detection method: 0 - current mode; 1 - dual encoder; 2 - current and dual encoder on at the same time

  • thresholdMode: Collision level threshold method 0-Collision level fixed threshold mode 1- Customize collision detection thresholds

Default parameters

NULL

Return Value

  • errcode Success-0 Failure- errcode

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

  • status: 0 - off; 1 - on

Default parameters

NULL

Return Value

  • errcode Success-0 Failure- errcode

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

  • status: 0 - off; 1 - on

  • power:Set the maximum power (W)

Default parameters

NULL

Return Value

  • errcode Success-0 Failure- errcode

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(1200)
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()

robotic arm
FAIRINO ROBOTIC ARMS

Contact

Location: 10637 Scripps Summit Court,

San Diego, CA. 92131
Phone: (619) 333-FAIR
Email: hello@fairino.us

© 2023 Fairino US official site Proudly created By G2T

bottom of page