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.9, 0.9, 0.9, 0.9, 0.9, 0.9]
wcoeff = [0.4, 0.4, 0.4, 0.4, 0.4, 0.4]
ccoeff = [0.6, 0.6, 0.6, 0.6, 0.6, 0.6]
fcoeff = [0.5, 0.5, 0.5, 0.5, 0.5, 0.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 |
|
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.137, 85.818, -125.599, -87.946, 74.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 |
|
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 |
|
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(1, 2)
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(0, 2)
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 |
|
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 |
|
Default parameters | NULL |
Return Value |
|
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 |
|
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 |
|
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.331, 487.913, 209.850, 149.030, 0.688, -114.347]
p1Joint = [-127.876, -75.341, 115.417, -122.741, -59.820, 74.300]
p2Desc = [69.721, 535.073, 202.882, -144.406, -14.775, -89.012]
p2Joint = [-101.780, -69.828, 110.917, -125.740, -127.841, 74.300]
p3Desc = [146.861, 578.426, 205.598, 175.997, -36.178, -93.437]
p3Joint = [-112.851, -60.191, 86.566, -80.676, -97.463, 74.300]
p4Desc = [136.284, 509.876, 225.613, 178.987, 1.372, -100.696]
p4Joint = [-116.397, -76.281, 113.845, -128.611, -88.654, 74.299]
p5Desc = [138.395, 505.972, 298.016, 179.134, 2.147, -101.110]
p5Joint = [-116.814, -82.333, 109.162, -118.662, -88.585, 74.302]
p6Desc = [105.553, 454.325, 232.017, -179.426, 0.444, -99.952]
p6Joint = [-115.649, -84.367, 122.447, -128.663, -90.432, 74.303]
exaxisPos = [0, 0, 0, 0]
offdese = [0, 0, 100, 0, 0, 0]
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, 0, 0, 1, 0)
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(50, 19, 710, 90, 0)
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 |
|
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 |
|
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 |
|
6.57. Get Joint Torque Sensor Repeatability
Prototype | JointRepeatability() |
Description | Get joint torque sensor repeatability |
Required Parameters | None |
Default Parameters | None |
Return Value |
|
6.58. Set Joint Force Sensor Parameters
Prototype | SetAdmittanceParams(M, B, K, threshold, sensitivity, setZeroFlag) |
Description | Set joint force sensor parameters |
Required Parameters |
|
Default Parameters | None |
Return Value |
|