top of page

Python 6.40. Robot setup joint friction compensation code example

from fairino import Robot
# Establish a connection with the robot controller and return a robot object if the connection is successful
robot = Robot.RPC('192.168.58.2')
lcoeff = [0.90.90.90.90.90.9]
wcoeff = [0.40.40.40.40.40.4]
ccoeff = [0.60.60.60.60.60.6]
fcoeff = [0.50.50.50.50.50.5]
rtn = robot.FrictionCompensationOnOff(1)
print(f"FrictionCompensationOnOff rtn is {rtn}")
rtn = robot.SetFrictionValue_level(lcoeff)
print(f"SetFrictionValue_level rtn is {rtn}")
rtn = robot.SetFrictionValue_wall(wcoeff)
print(f"SetFrictionValue_wall rtn is {rtn}")
rtn = robot.SetFrictionValue_ceiling(ccoeff)
print(f"SetFrictionValue_ceiling rtn is {rtn}")
rtn = robot.SetFrictionValue_freedom(fcoeff)
print(f"SetFrictionValue_freedom rtn is {rtn}")
robot.CloseRPC()

6.41. Query Robot Error Code

Prototype

GetRobotErrorCode()

Description

Query Robot Error Code

Mandatory parameters

NULL

Default parameters

NULL

Return Value

  • errorcode Success-0 Failure- errcode

  • [maincode subcode]: robot error code, maincode - main error code, subcode - suberror code

6.42. Error state clearing

Prototype

ResetAllError()

Description

Error state clearing, only resettable errors can be cleared

Mandatory parameters

NULL

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

6.43. Robot fault state acquisition and clearing error code examples

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')
p1Joint = [-108.145-50.13785.818-125.599-87.94674.329]
robot.MoveJ(joint_pos=p1Joint, tool=5, user=2, vel=50)
time.sleep(1)
error,[maincode, subcode] = robot.GetRobotErrorCode()
print(f"robot maincode is {maincode}; subcode is {subcode}")
time.sleep(1)
robot.ResetAllError()
time.sleep(1)
error,[maincode, subcode] = robot.GetRobotErrorCode()
print(f"robot maincode is {maincode}; subcode is {subcode}")
robot.CloseRPC()

6.44. Set the monitoring parameters for the temperature and fan speed of the wide-voltage control box

New in version python: SDK-v2.1.3

Prototype

SetWideBoxTempFanMonitorParam(enable, period)

Description

Set the monitoring parameters for the temperature and fan speed of the wide-voltage control box

Mandatory parameters

  • enable: 0- Monitoring is not enabled; 1- Enable monitoring

  • period: Monitoring period (s), ranging from 1 to 100

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

6.45. Obtain the monitoring parameters of the temperature and fan speed of the wide-voltage control box

New in version python: SDK-v2.1.3

Prototype

GetWideBoxTempFanMonitorParam()

Description

Obtain the monitoring parameters of the temperature and fan speed of the wide-voltage control box

Mandatory parameters

NULL

Default parameters

NULL

Return Value

  • Error Code Success-0 Failure- errcode

  • enable: 0- Monitoring is not enabled; 1- Enable monitoring

  • period: Monitoring period (s), ranging from 1 to 100

6.46. Sample code for obtaining wide voltage control box temperature and fan current status

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.SetWideBoxTempFanMonitorParam(12)
error, enable, period = robot.GetWideBoxTempFanMonitorParam()
print(f"GetWideBoxTempFanMonitorParam enable is:{enable},period is:{period}")
for i in range(100):
    error, pkg = robot.GetRobotRealTimeState()
    print(f"robot ctrl box temp is:{pkg.wideVoltageCtrlBoxTemp},fan current is:{pkg.wideVoltageCtrlBoxFanCurrent}")
    time.sleep(0.1)
rtn = robot.SetWideBoxTempFanMonitorParam(02)
print(f"SetWideBoxTempFanMonitorParam rtn is:{rtn}")
error, enable, period = robot.GetWideBoxTempFanMonitorParam()
print(f"GetWideBoxTempFanMonitorParam enable is:{enable},period is:{period}")
for i in range(100):
    error, pkg = robot.GetRobotRealTimeState()
    print(f"robot ctrl box temp is:{pkg.wideVoltageCtrlBoxTemp},fan current is:{pkg.wideVoltageCtrlBoxFanCurrent}")
    time.sleep(0.1)
robot.CloseRPC()

6.47. Sets the focus point

New in version python: SDK-v2.1.4

Prototype

SetFocusCalibPoint(pointNum, point)

Description

Sets the focus point

Mandatory parameters

  • pointNum:The number of the focus calibration point 1-8

  • point:Coordinate the points

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

6.48. Calculate the focus calibration result

New in version python: SDK-v2.1.4

Prototype

ComputeFocusCalib(pointNum)

Description

Calculate the focus calibration result

Mandatory parameters

  • pointNum:Number of calibration points

Default parameters

NULL

Return Value

  • Error Code Success-0 Failure- errcode

  • resultPos:Calibration result XYZ

  • accuracy:Calibration accuracy error

6.49. Enable focus following

New in version python: SDK-v2.1.4

Prototype

FocusStart(kp=50.0, kpredic=19.0, aMax=1440, vMax=180, type=0)

Description

Enable focus following

Mandatory parameters

NULL

Default parameters

  • kp:Scale parameter. Default is 50.0

  • kpredic:Feedforward parameter, default 19.0

  • aMax:Maximum angular acceleration limit, default 1440°/s^2

  • vMax:Maximum angular speed limit, default 180°/s

  • type:Lock X-axis pointing (0-reference input vector; 1-level; 2- vertical), 0 by default

Return Value

Error Code Success-0 Failure- errcode

6.50. Stop focusing following

New in version python: SDK-v2.1.4

Prototype

FocusEnd()

Description

Stop focusing following

Mandatory parameters

NULL

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

6.51. Set the focus coordinates

New in version python: SDK-v2.1.4

Prototype

SetFocusPosition(pos)

Description

Set the focus coordinates

Mandatory parameters

  • pos:Focus coordinate XYZ

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

6.52. Robot focus following 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')
p1Desc = [186.331487.913209.850149.0300.688-114.347]
p1Joint = [-127.876-75.341115.417-122.741-59.82074.300]
p2Desc = [69.721535.073202.882-144.406-14.775-89.012]
p2Joint = [-101.780-69.828110.917-125.740-127.84174.300]
p3Desc = [146.861578.426205.598175.997-36.178-93.437]
p3Joint = [-112.851-60.19186.566-80.676-97.46374.300]
p4Desc = [136.284509.876225.613178.9871.372-100.696]
p4Joint = [-116.397-76.281113.845-128.611-88.65474.299]
p5Desc = [138.395505.972298.016179.1342.147-101.110]
p5Joint = [-116.814-82.333109.162-118.662-88.58574.302]
p6Desc = [105.553454.325232.017-179.4260.444-99.952]
p6Joint = [-115.649-84.367122.447-128.663-90.43274.303]
exaxisPos = [0000]
offdese = [00100000]
robot.MoveJ(joint_pos=p1Joint,tool=0,user=0,vel=100,acc=100,ovl=100,exaxis_pos=exaxisPos,blendT=-1,offset_flag=0,offset_pos=offdese)
robot.SetTcp4RefPoint(1)
robot.MoveJ(joint_pos=p2Joint,tool=0,user=0,vel=100,acc=100,ovl=100,exaxis_pos=exaxisPos,blendT=-1,offset_flag=0,offset_pos=offdese)
robot.SetTcp4RefPoint(2)
robot.MoveJ(joint_pos=p3Joint,tool=0,user=0,vel=100,acc=100,ovl=100,exaxis_pos=exaxisPos,blendT=-1,offset_flag=0,offset_pos=offdese)
robot.SetTcp4RefPoint(3)
robot.MoveJ(joint_pos=p4Joint,tool=0,user=0,vel=100,acc=100,ovl=100,exaxis_pos=exaxisPos,blendT=-1,offset_flag=0,offset_pos=offdese)
robot.SetTcp4RefPoint(4)
rtn,coordRtn = robot.ComputeTcp4()
print(f"4 Point ComputeTool {rtn} coord is {coordRtn[0]} {coordRtn[1]} {coordRtn[2]} "
      f"{coordRtn[3]} {coordRtn[4]} {coordRtn[5]}")
robot.SetToolCoord(1, coordRtn, 0010)
error, p1Desc = robot.GetForwardKin(p1Joint)
error, p2Desc = robot.GetForwardKin(p2Joint)
error, p3Desc = robot.GetForwardKin(p3Joint)
robot.SetFocusCalibPoint(1, p1Desc)
robot.SetFocusCalibPoint(2, p2Desc)
robot.SetFocusCalibPoint(3, p3Desc)
rtn, resultPos, accuracy = robot.ComputeFocusCalib(pointNum=3)
print(f"ComputeFocusCalib coord is {rtn} {resultPos[0]} {resultPos[1]} {resultPos[2]} accuracy is {accuracy}")
rtn = robot.SetFocusPosition(resultPos)
error, p5Desc = robot.GetForwardKin(p5Joint)
error, p6Desc = robot.GetForwardKin(p6Joint)
robot.MoveL(desc_pos=p5Desc,tool=1,user=0,vel=10,acc=100,ovl=100,blendR=-1,blendMode=0,exaxis_pos=exaxisPos,search=0,offset_flag=1,offset_pos=offdese)
robot.MoveL(desc_pos=p6Desc,tool=1,user=0,vel=10,acc=100,ovl=100,blendR=-1,blendMode=0,exaxis_pos=exaxisPos,search=0,offset_flag=1,offset_pos=offdese)
robot.FocusStart(5019710900)
robot.MoveL(desc_pos=p5Desc,tool=1,user=0,vel=10,acc=100,ovl=100,blendR=-1,blendMode=0,exaxis_pos=exaxisPos,search=0,offset_flag=1,offset_pos=offdese)
robot.MoveL(desc_pos=p6Desc,tool=1,user=0,vel=10,acc=100,ovl=100,blendR=-1,blendMode=0,exaxis_pos=exaxisPos,search=0,offset_flag=1,offset_pos=offdese)
robot.FocusEnd()
robot.CloseRPC()

6.53. Joint torque sensor sensitivity calibration function is enabled

New in version python: SDK-v2.1.7

Prototype

JointSensitivityEnable(status)

Description

Joint torque sensor sensitivity calibration function is enabled

Mandatory parameters

  • status:0- closed; 1- On

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

6.54. Joint torque sensor sensitivity data acquisition

New in version python: SDK-v2.1.7

Prototype

JointSensitivityCollect()

Description

Joint torque sensor sensitivity data acquisition

Mandatory parameters

NULL

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

6.55. The sensitivity calibration results of the joint torque sensor were obtained

New in version python: SDK-v2.1.7

Prototype

JointSensitivityCalibration()

Description

The sensitivity calibration results of the joint torque sensor were obtained

Mandatory parameters

NULL

Default parameters

NULL

Return Value

  • Error Code Success-0 Failure- errcode

  • calibResult:j1~j6 Joint sensitivity [0-1]

  • linearityn:j1~j6 joint linearity[0-1]

6.56. Get Joint Torque Sensor Hysteresis Error

Prototype

JointHysteresisError()

Description

Get joint torque sensor hysteresis error

Required Parameters

None

Default Parameters

None

Return Value

  • Error code Success-0 Failure- errcode

  • hysteresisError:j1~j6 joint hysteresis error

6.57. Get Joint Torque Sensor Repeatability

Prototype

JointRepeatability()

Description

Get joint torque sensor repeatability

Required Parameters

None

Default Parameters

None

Return Value

  • Error code Success-0 Failure- errcode

  • repeatability:j1~j6 joint repeatability

6.58. Set Joint Force Sensor Parameters

Prototype

SetAdmittanceParams(M, B, K, threshold, sensitivity, setZeroFlag)

Description

Set joint force sensor parameters

Required Parameters

  • M:J1-J6 mass coefficient [0.001 ~ 10]

  • B:J1-J6 damping coefficient [0.001 ~ 10]

  • K:J1-J6 stiffness coefficient [0.001 ~ 10]

  • threshold:Force control threshold, Nm

  • sensitivity:Sensitivity, Nm/V, [0 ~ 10]

  • setZeroFlag:Function enable flag; 0-Off; 1-On; 2-Record zero point at position 1; 3-Record zero point at position 2

Default Parameters

None

Return Value

  • Error code Success-0 Failure- errcode


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