top of page

Python 6.59. Sample code for automatic calibration of joint torque sensor sensitivity

from fairino import Robot
import time
robot = Robot.RPC('192.168.58.2')
rtn = robot.JointSensitivityEnable(0)
rtn = robot.JointSensitivityEnable(1)
print(f"JointSensitivityEnable rtn is {rtn}")
curJPos = [0.0* 6
rtn, curJPos = robot.GetActualJointPosDegree(0)
epos = [0.0* 4
offset_pos = [0.0* 6
jointPos1 = [curJPos[0], 0.00.0-90.00.02, curJPos[5]]
descPos1 = [0.0* 6
rtn, descPos1 = robot.GetForwardKin(jointPos1)
robot.MoveJ(joint_pos=jointPos1, desc_pos=descPos1, tool=0, user=0, vel=100, acc=100, ovl=100, exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
time.sleep(0.2)
rtn = robot.JointSensitivityCollect()
print(f"JointSensitivityCollect 1 rtn is {rtn}")
time.sleep(0.1)
jointPos2 = [curJPos[0], -30.00.0-90.00.02, curJPos[5]]
descPos2 = [0.0* 6
rtn, descPos2 = robot.GetForwardKin(jointPos2)
robot.MoveJ(joint_pos=jointPos2, desc_pos=descPos2, tool=0, user=0, vel=100, acc=100, ovl=100, exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
time.sleep(0.1)
rtn = robot.JointSensitivityCollect()
print(f"JointSensitivityCollect 2 rtn is {rtn}")
time.sleep(0.1)
jointPos3 = [curJPos[0], -60.00.0-90.00.02, curJPos[5]]
descPos3 = [0.0* 6
rtn, descPos3 = robot.GetForwardKin(jointPos3)
robot.MoveJ(joint_pos=jointPos3, desc_pos=descPos3, tool=0, user=0, vel=100, acc=100, ovl=100, exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
time.sleep(0.1)
rtn = robot.JointSensitivityCollect()
print(f"JointSensitivityCollect 3 rtn is {rtn}")
time.sleep(0.1)
jointPos4 = [curJPos[0], -90.00.0-90.00.02, curJPos[5]]
descPos4 = [0.0* 6
rtn, descPos4 = robot.GetForwardKin(jointPos4)
robot.MoveJ(joint_pos=jointPos4, desc_pos=descPos4, tool=0, user=0, vel=100, acc=100, ovl=100, exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
time.sleep(0.1)
rtn = robot.JointSensitivityCollect()
print(f"JointSensitivityCollect 4 rtn is {rtn}")
time.sleep(0.1)
jointPos5 = [curJPos[0], -120.00.0-90.00.02, curJPos[5]]
descPos5 = [0.0* 6
rtn, descPos5 = robot.GetForwardKin(jointPos5)
robot.MoveJ(joint_pos=jointPos5, desc_pos=descPos5, tool=0, user=0, vel=100, acc=100, ovl=100, exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
time.sleep(0.1)
rtn = robot.JointSensitivityCollect()
print(f"JointSensitivityCollect 5 rtn is {rtn}")
time.sleep(0.1)
jointPos6 = [curJPos[0], -150.00.0-90.00.02, curJPos[5]]
descPos6 = [0.0* 6
rtn, descPos6 = robot.GetForwardKin(jointPos6)
robot.MoveJ(joint_pos=jointPos6, desc_pos=descPos6, tool=0, user=0, vel=100, acc=100, ovl=100, exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
time.sleep(0.1)
rtn = robot.JointSensitivityCollect()
print(f"JointSensitivityCollect 6 rtn is {rtn}")
time.sleep(0.1)
jointPos7 = [curJPos[0], -180.00.0-90.00.02, curJPos[5]]
descPos7 = [0.0* 6
rtn, descPos7 = robot.GetForwardKin(jointPos7)
robot.MoveJ(joint_pos=jointPos7, desc_pos=descPos7, tool=0, user=0, vel=100, acc=100, ovl=100, exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
time.sleep(0.1)
rtn = robot.JointSensitivityCollect()
print(f"JointSensitivityCollect 7 rtn is {rtn}")
time.sleep(0.1)
robot.MoveJ(joint_pos=jointPos6, desc_pos=descPos6, tool=0, user=0, vel=100, acc=100, ovl=100, exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
time.sleep(0.1)
rtn = robot.JointSensitivityCollect()
print(f"JointSensitivityCollect 8 rtn is {rtn}")
time.sleep(0.1)
robot.MoveJ(joint_pos=jointPos5, desc_pos=descPos5, tool=0, user=0, vel=100, acc=100, ovl=100, exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
time.sleep(0.1)
rtn = robot.JointSensitivityCollect()
print(f"JointSensitivityCollect 9 rtn is {rtn}")
time.sleep(0.1)
robot.MoveJ(joint_pos=jointPos4, desc_pos=descPos4, tool=0, user=0, vel=100, acc=100, ovl=100, exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
time.sleep(0.1)
rtn = robot.JointSensitivityCollect()
print(f"JointSensitivityCollect 10 rtn is {rtn}")
time.sleep(0.1)
robot.MoveJ(joint_pos=jointPos3, desc_pos=descPos3, tool=0, user=0, vel=100, acc=100, ovl=100, exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
time.sleep(0.1)
rtn = robot.JointSensitivityCollect()
print(f"JointSensitivityCollect 11 rtn is {rtn}")
time.sleep(0.1)
robot.MoveJ(joint_pos=jointPos2, desc_pos=descPos2, tool=0, user=0, vel=100, acc=100, ovl=100, exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
time.sleep(0.1)
rtn = robot.JointSensitivityCollect()
print(f"JointSensitivityCollect 12 rtn is {rtn}")
time.sleep(0.1)
robot.MoveJ(joint_pos=jointPos1, desc_pos=descPos1, tool=0, user=0, vel=100, acc=100, ovl=100, exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
time.sleep(0.2)
rtn = robot.JointSensitivityCollect()
print(f"JointSensitivityCollect 13 rtn is {rtn}")
time.sleep(0.1)
calibResult = [0.0* 6
linearity = [0.0* 6
rtn,calibResult, linearity = robot.JointSensitivityCalibration()
print(f"JointSensitivityCalibration rtn is {rtn}")
rtn = robot.JointSensitivityEnable(0)
print(f"JointSensitivityEnable rtn is {rtn}")
print(f"jointSensor Calib result is {calibResult[0]},{calibResult[1]},{calibResult[2]},{calibResult[3]},{calibResult[4]},{calibResult[5]}")
printf"jointSensor linearity is {linearity[0]},{linearity[1]},{linearity[2]},{linearity[3]},{linearity[4]},{linearity[5]}")
hysteresisError = [0.0* 6
rtn,hysteresisError = robot.JointHysteresisError()
print(f"JointHysteresisError result is {hysteresisError[0]},{hysteresisError[1]},{hysteresisError[2]},{hysteresisError[3]},{hysteresisError[4]},{hysteresisError[5]}")
repeatability = [0.0* 6
rtn,repeatability = robot.JointRepeatability()
print(f"JointRepeatability result is {repeatability[0]},{repeatability[1]},{repeatability[2]},{repeatability[3]},{repeatability[4]},{repeatability[5]}")
M = [1.0* 6= [1.0* 6= [0.0* 6
threshold = [1.0* 6
setZeroFlag = 1
rtn = robot.SetAdmittanceParams(M, B, K, threshold, calibResult, setZeroFlag)
print(f"SetAdmittanceParams rtn is {rtn}")
robot.CloseRPC()

6.60. The number of error frames at eight slave ports of the robot is obtained

New in version python: SDK-v2.1.7

Prototype

GetSlavePortErrCounter()

Description

The number of error frames at eight slave ports of the robot is obtained

Mandatory parameters

NULL

Default parameters

NULL

Return Value

  • Error Code Success-0 Failure- errcode

  • inRecvErr:Input the number of error frames received

  • inCRCErr:Input the number of CRC error frames

  • inTransmitErr:Input the number of forwarding error frames

  • inLinkErr:Enter the number of link error frames

  • outRecvErr:Outputs the number of frames received incorrectly

  • outCRCErr:The number of CRC error frames is output

  • outTransmitErr:Outputs the number of forwarding error frames

  • outLinkErr:Output link error frames

6.61. Slave port error frame reset

New in version python: SDK-v2.1.7

Prototype

JointSensitivityEnable(slaveID)

Description

Slave port error frame reset

Mandatory parameters

  • slaveID:Slave station numbers 0 to 7

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

6.62. Get sample slave port error frame code

from fairino import Robot
import time
import threading
# Establish a connection with the robot controller and return a robot object if the connection is successful
robot = Robot.RPC('192.168.58.2')
inRecvErr = [0* 8
inCRCErr = [0* 8
inTransmitErr = [0* 8
inLinkErr = [0* 8
outRecvErr = [0* 8
outCRCErr = [0* 8
outTransmitErr = [0* 8
outLinkErr = [0* 8
rtn,inRecvErr, inCRCErr, inTransmitErr, inLinkErr, outRecvErr, outCRCErr, outTransmitErr, outLinkErr = robot.GetSlavePortErrCounter()
for i in range(8):
    if inRecvErr[i] != 0:
        print(f"inRecvErr {i} is {inRecvErr[i]}")
    if inCRCErr[i] != 0:
        print(f"inCRCErr {i} is {inCRCErr[i]}")
    if inTransmitErr[i] != 0:
        print(f"inTransmitErr {i} is {inTransmitErr[i]}")
    if inLinkErr[i] != 0:
        print(f"inLinkErr {i} is {inLinkErr[i]}")
    if outRecvErr[i] != 0:
        print(f"outRecvErr {i} is {outRecvErr[i]}")
    if outCRCErr[i] != 0:
        print(f"outCRCErr {i} is {outCRCErr[i]}")
    if outTransmitErr[i] != 0:
        print(f"outTransmitErr {i} is {outTransmitErr[i]}")
    if outLinkErr[i] != 0:
        print(f"outLinkErr {i} is {outLinkErr[i]}")
print("others has no err!")
for i in range(8):
    robot.SlavePortErrCounterClear(i)
robot.CloseRPC()

6.63. Set the feed-forward coefficient of each axis speed

New in version python: SDK-v2.1.7

Prototype

SetVelFeedForwardRatio(radio)

Description

Set the feed-forward coefficient of each axis speed

Mandatory parameters

  • radio:Each axis velocity feedforward coefficient

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

6.64. The velocity feedforward coefficients of each axis are obtained

New in version python: SDK-v2.1.7

Prototype

GetVelFeedForwardRatio()

Description

The velocity feedforward coefficients of each axis are obtained

Mandatory parameters

NULL

Default parameters

NULL

Return Value

  • Error Code Success-0 Failure- errcode

  • radio:Each axis velocity feedforward coefficient

6.65. Robot velocity feedforward coefficient code example

from fairino import Robot
import time
import threading
# Establish a connection with the robot controller and return a robot object if the connection is successful
robot = Robot.RPC('192.168.58.2')
setRadio = [1.01.01.01.01.01.0]
robot.SetVelFeedForwardRatio(setRadio)
getRadio = [0.0* 6
rtn,getRadio = robot.GetVelFeedForwardRatio()
print(f"{getRadio[0]},{getRadio[1]},{getRadio[2]},{getRadio[3]},{getRadio[4]},{getRadio[5]}")
robot.CloseRPC()

6.66. Photoelectric Sensor TCP Calibration - Compute Tool RPY

Prototype

TCPComputeRPY(Btool, Etool, sensor, radius, dz)

Description

Photoelectric Sensor TCP Calibration - Compute Tool RPY

Required Parameters

  • Btool: Robot Cartesian position

  • Etool: Current tool coordinate values

  • sensor: Current sensor coordinate values (not yet available)

  • radius: Circular motion radius in mm (not yet available)

  • dz: Movement distance along the negative Z-axis of the base coordinate system; when dz = 10000, the function directly returns tool RPY

Default Parameters

None

Return Value

  • Error code. Success - 0, Failure - errcode

6.67. Photoelectric Sensor TCP Calibration - Compute Tool XYZ

Prototype

TCPComputeXYZ(select, originDirection, pos1, pos2, pos3, pos4)

Description

Photoelectric Sensor TCP Calibration - Compute Tool XYZ

Required Parameters

  • select: 0-Compute tool TCP; 1-Compute sensor origin; 2-Compute sensor orientation; 3-Directly return tool TCP; 4-Record current workpiece coordinate system and tool coordinate system

  • originDirection: 0-X direction; 1-Y direction; 2-Z direction

  • pos1: Robot Cartesian position 1

  • pos2: Robot Cartesian position 2

  • pos3: Robot Cartesian position 3

  • pos4: Robot Cartesian position 4

Default Parameters

None

Return Value

  • Error code. Success - 0, Failure - errcode

  • Return value (returned on successful call) TCP Tool XYZ values

6.68. Photoelectric Sensor TCP Calibration - Start Recording Flange Center Position

Prototype

TCPRecordFlangePosStart()

Description

Photoelectric Sensor TCP Calibration - Start Recording Flange Center Position

Required Parameters

None

Default Parameters

None

Return Value

  • Error code. Success - 0, Failure - errcode

6.69. Photoelectric Sensor TCP Calibration - Stop Recording Flange Center Position

Prototype

TCPRecordFlangePosEnd()

Description

Photoelectric Sensor TCP Calibration - Stop Recording Flange Center Position

Required Parameters

None

Default Parameters

None

Return Value

  • Error code. Success - 0, Failure - errcode

6.70. Photoelectric Sensor TCP Calibration - Get Tool Center Point Position

Prototype

TCPGetRecordFlangePos()

Description

Photoelectric Sensor TCP Calibration - Get Tool Center Point Position

Required Parameters

None

Default Parameters

None

Return Value

  • Error code. Success - 0, Failure - errcode

  • Return value (returned on successful call) TCP Tool center point position (x, y, z)

6.71. Photoelectric Sensor TCP Calibration

Prototype

PhotoelectricSensorTCPCalibration(luaPath, offsetX)

Description

Photoelectric Sensor TCP Calibration

Required Parameters

  • luaPath: Automatic calibration Lua program path: For QX version robots - ‘/fruser/FR_CalibrateTheToolTcp.lua’; For LA version robots - ‘/usr/local/etc/controller/lua/FR_CalibrateTheToolTcp.lua’

  • offsetX: Teaching point offset (x, y, z) in mm

Default Parameters

None

Return Value

  • Error code. Success - 0, Failure - errcode

  • Return value (returned on successful call) TCP Tool XYZ values

6.72. Photoelectric Sensor TCP Calibration Code Example

from fairino import Robot
import time
robot = Robot.RPC('192.168.58.2')
offset = [10.010.03.0]
TCP = [0.0* 6
rtn, TCP = robot.PhotoelectricSensorTCPCalibration("/fruser/FR_CalibrateTheToolTcp.lua", offset)
print(f"PhotoelectricSensorTCPCalibration rtn is {rtn},{TCP[0]},{TCP[1]},{TCP[2]},{TCP[3]},{TCP[4]},{TCP[5]}")
robot.CloseRPC()
return 0

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