6. Common Robot Settings
6.1. Setting Tool Reference Points - Six-Point Method
Prototype |
|
|---|---|
Description |
Setting Tool Reference Points - Six Point Method |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.2. Calculation tool coordinate system - six-point method
Prototype |
|
|---|---|
Description |
Calculate the tool coordinate system - six-point method (after setting the six tool reference points) |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
6.3. Setting Tool Reference Points - Four Point Method
Prototype |
|
|---|---|
Description |
Setting Tool Reference Points - Four Point Method |
Mandatory parameter |
|
Default parameters |
NULL |
Return Value |
|
6.4. Calculation Tool Coordinate System - Four Point Method
prototype |
|
|---|---|
Description |
Calculate tool coordinate system - four-point method (after setting the four tool reference points) |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
6.5. Calculate the tool coordinate system based on the point information
New in version python: SDK-v2.0.8
Prototype |
|
|---|---|
Description |
Calculate the tool coordinate system based on the point information |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
|
6.6. Setting the tool coordinate system
Prototype |
|
|---|---|
Description |
Setting the tool coordinate system |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.7. Setting the tool coordinate system list
Prototype |
|
|---|---|
Description |
Set up a list of tool coordinate systems |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.8. Get the current tool coordinate system
Prototype |
|
|---|---|
Description |
Get current tool coordinate system |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
6.9. Robot tool coordinate system manipulation code example
1from fairino import Robot
2import time
3# Establish a connection with the robot controller and return a robot object if the connection is successful
4robot = Robot.RPC('192.168.58.2')
5p1Desc = [186.331, 487.913, 209.850, 149.030, 0.688, -114.347]
6p2Desc = [69.721, 535.073, 202.882, -144.406, -14.775, -89.012]
7p3Desc = [146.861, 578.426, 205.598, 175.997, -36.178, -93.437]
8p4Desc = [136.284, 509.876, 225.613, 178.987, 1.372, -100.696]
9p5Desc = [138.395, 505.972, 298.016, 179.134, 2.147, -101.110]
10p6Desc = [105.553, 454.325, 232.017, -179.426, 0.444, -99.952]
11p1Joint = [-127.876, -75.341, 115.417, -122.741, -59.820, 74.300]
12p2Joint = [-101.780, -69.828, 110.917, -125.740, -127.841, 74.300]
13p3Joint = [-112.851, -60.191, 86.566, -80.676, -97.463, 74.300]
14p4Joint = [-116.397, -76.281, 113.845, -128.611, -88.654, 74.299]
15p5Joint = [-116.814, -82.333, 109.162, -118.662, -88.585, 74.302]
16p6Joint = [-115.649, -84.367, 122.447, -128.663, -90.432, 74.303]
17exaxisPos = [0, 0, 0, 0]
18offdese = [0, 0, 0, 0, 0, 0]
19posJ = [p1Joint, p2Joint, p3Joint, p4Joint, p5Joint, p6Joint]
20rtn,coordRtn = robot.ComputeToolCoordWithPoints(1, posJ)
21print(f"ComputeToolCoordWithPoints {rtn} coord is {coordRtn[0]} {coordRtn[1]} {coordRtn[2]} {coordRtn[3]} {coordRtn[4]} {coordRtn[5]}")
22robot.MoveJ(joint_pos=p1Joint,tool=0, user=0, vel=100)
23robot.SetToolPoint(1)
24robot.MoveJ(joint_pos=p2Joint,tool=0, user=0, vel=100)
25robot.SetToolPoint(2)
26robot.MoveJ(joint_pos=p3Joint,tool=0, user=0, vel=100)
27robot.SetToolPoint(3)
28robot.MoveJ(joint_pos=p4Joint,tool=0, user=0, vel=100)
29robot.SetToolPoint(4)
30robot.MoveJ(joint_pos=p5Joint,tool=0, user=0, vel=100)
31robot.SetToolPoint(5)
32robot.MoveJ(joint_pos=p6Joint,tool=0, user=0, vel=100)
33robot.SetToolPoint(6)
34rtn,coordRtn = robot.ComputeTool()
35print(f"6 Point ComputeTool {rtn} coord is {coordRtn[0]} {coordRtn[1]} {coordRtn[2]} {coordRtn[3]} {coordRtn[4]} {coordRtn[5]}")
36robot.SetToolList(1, coordRtn, 0, 0, 0)
37robot.MoveJ(joint_pos=p1Joint,tool=0, user=0, vel=100)
38robot.SetTcp4RefPoint(1)
39robot.MoveJ(joint_pos=p2Joint,tool=0, user=0, vel=100)
40robot.SetTcp4RefPoint(2)
41robot.MoveJ(joint_pos=p3Joint,tool=0, user=0, vel=100)
42robot.SetTcp4RefPoint(3)
43robot.MoveJ(joint_pos=p4Joint,tool=0, user=0, vel=100)
44robot.SetTcp4RefPoint(4)
45rtn,coordRtn = robot.ComputeTcp4()
46print(f"4 Point ComputeTool {rtn} coord is {coordRtn[0]} {coordRtn[1]} {coordRtn[2]} {coordRtn[3]} {coordRtn[4]} {coordRtn[5]}")
47robot.SetToolCoord(2, coordRtn, 0, 0, 1, 0)
48rtn,getCoord = robot.GetTCPOffset(0)
49print(f"GetTCPOffset {rtn} coord is {getCoord[0]} {getCoord[1]} {getCoord[2]} {getCoord[3]} {getCoord[4]} {getCoord[5]}")
50robot.CloseRPC()
6.10. Setting External Tool Reference Points-Six-Point Method
Prototype |
|
|---|---|
Description |
Setting the external tool reference point - three-point method |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.11. Calculation of the external tool coordinate system - Six-point method
Prototype |
|
|---|---|
Description |
Calculate external tool coordinate system - three-point method (after setting three reference points) |
Mandatory parameter |
|
Default parameters |
NULL |
Return Value |
|
6.12. Setting the external tool coordinate system
Prototype |
|
|---|---|
Description |
Setting the external tool coordinate system |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.13. Setting up a list of external tool coordinate systems
Prototype |
|
|---|---|
Description |
Set the list of external tool coordinate systems |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.14. Example code for robot external tool coordinate system operation
1from fairino import Robot
2import time
3# Establish a connection with the robot controller and return a robot object if the connection is successful
4robot = Robot.RPC('192.168.58.2')
5p1Desc = [-89.606, 779.517, 193.516, 178.000, 0.476, -92.484]
6p1Joint = [-108.145, -50.137, 85.818, -125.599, -87.946, 74.329]
7p2Desc = [-24.656, 850.384, 191.361, 177.079, -2.058, -95.355]
8p2Joint = [-111.024, -41.538, 69.222, -114.913, -87.743, 74.329]
9p3Desc = [-99.813, 766.661, 241.878, -176.817, 1.917, -91.604]
10p3Joint = [-107.266, -56.116, 85.971, -122.560, -92.548, 74.331]
11exaxisPos = [0, 0, 0, 0]
12offdese = [0, 0, 0, 0, 0, 0]
13posTCP = [p1Desc, p2Desc, p3Desc]
14robot.MoveJ(joint_pos=p1Joint,tool=1, user=0, vel=50)
15robot.SetExTCPPoint(1)
16robot.MoveJ(joint_pos=p2Joint,tool=1, user=0, vel=50)
17robot.SetExTCPPoint(2)
18robot.MoveJ(joint_pos=p3Joint,tool=1, user=0, vel=50)
19robot.SetExTCPPoint(3)
20rtn,coordRtn = robot.ComputeExTCF()
21print(f"ComputeExTCF {rtn} coord is {coordRtn[0]} {coordRtn[1]} {coordRtn[2]} {coordRtn[3]} {coordRtn[4]} {coordRtn[5]}")
22robot.SetExToolCoord(1, coordRtn, offdese)
23robot.SetExToolList(1, coordRtn, offdese)
24robot.CloseRPC()
6.15. Setting the workpiece reference point - three-point method
Prototype |
|
|---|---|
Description |
Setting the workpiece reference point - 3-point method |
Mandatory parameter |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.16. Calculation of the workpiece coordinate system - three-point method
Prototype |
|
|---|---|
Description |
Calculate the workpiece coordinate system - three-point method (three reference points are set and then calculated); |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
|
6.17. Setting the workpiece coordinate system
prototype |
|
|---|---|
Description |
Setting the workpiece coordinate system |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.18. Setting the list of workpiece coordinate systems
prototype |
|
|---|---|
Description |
Set the list of workpiece coordinate systems |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.19. Calculate the workpiece coordinate system based on the point information
New in version python: SDK-v2.0.8
Prototype |
|
|---|---|
Description |
Calculate the workpiece coordinate system based on the point information |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
|
6.20. Get the current workpiece coordinate system
prototype |
|
|---|---|
Description |
Get current workpiece coordinate system |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
6.21. Example of robot workpiece coordinate system manipulation code
1from fairino import Robot
2# Establish a connection with the robot controller and return a robot object if the connection is successful
3robot = Robot.RPC('192.168.58.2')
4p1Desc = [-89.606, 779.517, 193.516, 178.000, 0.476, -92.484]
5p2Desc = [-24.656, 850.384, 191.361, 177.079, -2.058, -95.355]
6p3Desc = [-99.813, 766.661, 241.878, -176.817, 1.917, -91.604]
7p1Joint = [-108.145, -50.137, 85.818, -125.599, -87.946, 74.329]
8p2Joint = [-111.024, -41.538, 69.222, -114.913, -87.743, 74.329]
9p3Joint = [-107.266, -56.116, 85.971, -122.560, -92.548, 74.331]
10exaxisPos = [0, 0, 0, 0]
11offdese = [0, 0, 0, 0, 0, 0]
12posTCP = [p1Desc, p2Desc, p3Desc]
13rtn,coordRtn = robot.ComputeWObjCoordWithPoints(1, posTCP, 0)
14print(f"ComputeWObjCoordWithPoints {rtn} coord is {coordRtn[0]} {coordRtn[1]} {coordRtn[2]} {coordRtn[3]} {coordRtn[4]} {coordRtn[5]}")
15robot.MoveJ(joint_pos=p1Joint,tool=1, user=0, vel=100)
16robot.SetWObjCoordPoint(1)
17robot.MoveJ(joint_pos=p2Joint,tool=1, user=0, vel=100)
18robot.SetWObjCoordPoint(2)
19robot.MoveJ(joint_pos=p3Joint,tool=1, user=0, vel=100)
20robot.SetWObjCoordPoint(3)
21rtn,coordRtn = robot.ComputeWObjCoord(1, 0)
22print(f"ComputeWObjCoord {rtn} coord is {coordRtn[0]} {coordRtn[1]} {coordRtn[2]} {coordRtn[3]} {coordRtn[4]} {coordRtn[5]}")
23robot.SetWObjCoord(1, coordRtn, 0)
24robot.SetWObjList(1, coordRtn, 0)
25rtn,getWobjDesc = robot.GetWObjOffset(0)
26print(f"GetWObjOffset {rtn} coord is {getWobjDesc[0]} {getWobjDesc[1]} {getWobjDesc[2]} {getWobjDesc[3]} {getWobjDesc[4]} {getWobjDesc[5]}")
27robot.CloseRPC()
6.22. Setting the global speed
Prototype |
|
|---|---|
Description |
Set global speed |
Mandatory parameter |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.23. Setting robot acceleration
New in version python: SDK-v2.0.4
Prototype |
|
|---|---|
Description |
Setting the robot acceleration |
Mandatory parameter |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.24. Getting the default speed
Prototype |
|
|---|---|
Description |
Get Default Speed |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
6.25. Setting the end load weight
Prototype |
|
|---|---|
Description |
Set the end load weight, incorrect load weight setting may cause the robot to go out of control in drag mode |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.26. Setting the end load center of mass coordinates
Prototype |
|
|---|---|
Description |
Set end-load center of mass coordinates, incorrect load center of mass setting may cause robot to go out of control in drag mode |
Mandatory parameter |
|
Default parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
6.27. Get the weight of the current load
Prototype |
|
|---|---|
Description |
Get the quality of the current load |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
6.28. Get the center of mass of the current load
Prototype |
|
|---|---|
Description |
Get the center of mass of the current load |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
6.29. Setting the robot mounting method - fixed mounting
Prototype |
|
|---|---|
description |
set robot mounting method - fixed mounting, wrong mounting method setting can cause robot to lose control in drag mode |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.30. Setting the robot mounting angle - free mounting
Prototype |
|
|---|---|
Description |
Setting the robot mounting angle - free mounting, wrong mounting angle setting can cause the robot to go out of control in drag mode |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.31. Getting the robot mounting angle
Prototype |
|
|---|---|
Description |
Get robot mounting angle |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
6.32. Setting system variable values
Prototype |
|
|---|---|
Description |
Setting System Variables |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.33. Getting system variable values
Prototype |
|
|---|---|
Description |
Get system variable values |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
|
6.34. Robot common setup code examples
1from fairino import Robot
2# Establish a connection with the robot controller and return a robot object if the connection is successful
3robot = Robot.RPC('192.168.58.2')
4for i in range(1, 100):
5 robot.SetSpeed(i)
6 robot.SetOaccScale(i)
7 time.sleep(0.03)
8error,defaultVel = robot.GetDefaultTransVel()
9print(f"GetDefaultTransVel is {defaultVel}")
10for i in range(1, 21):
11 robot.SetSysVarValue(i, i + 0.5)
12 time.sleep(0.1)
13for i in range(1, 21):
14 value = robot.GetSysVarValue(i)
15 print(f"sys value {i} is: {value}")
16 time.sleep(0.1)
17robot.SetLoadWeight(0, 2.5)
18robot.SetLoadCoord(3.0,4.0,5.0)
19time.sleep(1)
20error,getLoad = robot.GetTargetPayload(0)
21error,getLoadTran = robot.GetTargetPayloadCog(0)
22print(f"get load is {getLoad}; get load cog is {getLoadTran[0]} {getLoadTran[1]} {getLoadTran[2]}")
23robot.SetRobotInstallPos(0)
24robot.SetRobotInstallAngle(15.0, 25.0)
25error,[anglex, angley] = robot.GetRobotInstallAngle()
26print(f"GetRobotInstallAngle x: {anglex}; y: {angley}")
27robot.CloseRPC()
6.35. Joint Friction Compensation Switch
Prototype |
|
|---|---|
Description |
Joint Friction Compensation Switch |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.36. Setting the joint friction compensation coefficients - positive loading
Prototype |
|
|---|---|
Description |
Setting the joint friction compensation coefficient - Fixed mounting - Positive mounting |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.37. Setting the joint friction compensation coefficient - side mounting
Prototype |
|
|---|---|
Description |
Setting the joint friction compensation coefficient - fixed mounting - side mounting |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.38. Setting the Joint Friction Compensation Factor - Inverted
Prototype |
|
|---|---|
Description |
Setting the joint friction compensation coefficient - fixed mounting - inverted mounting |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.39. Setting the joint friction compensation factor - free mounting
Prototype |
|
|---|---|
Description |
Setting the joint friction compensation factor - free mounting |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.40. Robot setup joint friction compensation code example
1from fairino import Robot
2# Establish a connection with the robot controller and return a robot object if the connection is successful
3robot = Robot.RPC('192.168.58.2')
4lcoeff = [0.9, 0.9, 0.9, 0.9, 0.9, 0.9]
5wcoeff = [0.4, 0.4, 0.4, 0.4, 0.4, 0.4]
6ccoeff = [0.6, 0.6, 0.6, 0.6, 0.6, 0.6]
7fcoeff = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5]
8rtn = robot.FrictionCompensationOnOff(1)
9print(f"FrictionCompensationOnOff rtn is {rtn}")
10rtn = robot.SetFrictionValue_level(lcoeff)
11print(f"SetFrictionValue_level rtn is {rtn}")
12rtn = robot.SetFrictionValue_wall(wcoeff)
13print(f"SetFrictionValue_wall rtn is {rtn}")
14rtn = robot.SetFrictionValue_ceiling(ccoeff)
15print(f"SetFrictionValue_ceiling rtn is {rtn}")
16rtn = robot.SetFrictionValue_freedom(fcoeff)
17print(f"SetFrictionValue_freedom rtn is {rtn}")
18robot.CloseRPC()
6.41. Query Robot Error Code
Prototype |
|
|---|---|
Description |
Query Robot Error Code |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
6.42. Error state clearing
Prototype |
|
|---|---|
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
1from fairino import Robot
2import time
3# Establish a connection with the robot controller and return a robot object if the connection is successful
4robot = Robot.RPC('192.168.58.2')
5p1Joint = [-108.145, -50.137, 85.818, -125.599, -87.946, 74.329]
6robot.MoveJ(joint_pos=p1Joint, tool=5, user=2, vel=50)
7time.sleep(1)
8error,[maincode, subcode] = robot.GetRobotErrorCode()
9print(f"robot maincode is {maincode}; subcode is {subcode}")
10time.sleep(1)
11robot.ResetAllError()
12time.sleep(1)
13error,[maincode, subcode] = robot.GetRobotErrorCode()
14print(f"robot maincode is {maincode}; subcode is {subcode}")
15robot.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 |
|
|---|---|
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 |
|
|---|---|
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
1from fairino import Robot
2import time
3# Establish a connection with the robot controller and return a robot object if the connection is successful
4robot = Robot.RPC('192.168.58.2')
5robot.SetWideBoxTempFanMonitorParam(1, 2)
6error, enable, period = robot.GetWideBoxTempFanMonitorParam()
7print(f"GetWideBoxTempFanMonitorParam enable is:{enable},period is:{period}")
8for i in range(100):
9 error, pkg = robot.GetRobotRealTimeState()
10 print(f"robot ctrl box temp is:{pkg.wideVoltageCtrlBoxTemp},fan current is:{pkg.wideVoltageCtrlBoxFanCurrent}")
11 time.sleep(0.1)
12rtn = robot.SetWideBoxTempFanMonitorParam(0, 2)
13print(f"SetWideBoxTempFanMonitorParam rtn is:{rtn}")
14error, enable, period = robot.GetWideBoxTempFanMonitorParam()
15print(f"GetWideBoxTempFanMonitorParam enable is:{enable},period is:{period}")
16for i in range(100):
17 error, pkg = robot.GetRobotRealTimeState()
18 print(f"robot ctrl box temp is:{pkg.wideVoltageCtrlBoxTemp},fan current is:{pkg.wideVoltageCtrlBoxFanCurrent}")
19 time.sleep(0.1)
20robot.CloseRPC()
6.47. Sets the focus point
New in version python: SDK-v2.1.4
Prototype |
|
|---|---|
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 |
|
|---|---|
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 |
|
|---|---|
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 |
|
|---|---|
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 |
|
|---|---|
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
1from fairino import Robot
2import time
3# Establish a connection with the robot controller and return a robot object if the connection is successful
4robot = Robot.RPC('192.168.58.2')
5p1Desc = [186.331, 487.913, 209.850, 149.030, 0.688, -114.347]
6p1Joint = [-127.876, -75.341, 115.417, -122.741, -59.820, 74.300]
7p2Desc = [69.721, 535.073, 202.882, -144.406, -14.775, -89.012]
8p2Joint = [-101.780, -69.828, 110.917, -125.740, -127.841, 74.300]
9p3Desc = [146.861, 578.426, 205.598, 175.997, -36.178, -93.437]
10p3Joint = [-112.851, -60.191, 86.566, -80.676, -97.463, 74.300]
11p4Desc = [136.284, 509.876, 225.613, 178.987, 1.372, -100.696]
12p4Joint = [-116.397, -76.281, 113.845, -128.611, -88.654, 74.299]
13p5Desc = [138.395, 505.972, 298.016, 179.134, 2.147, -101.110]
14p5Joint = [-116.814, -82.333, 109.162, -118.662, -88.585, 74.302]
15p6Desc = [105.553, 454.325, 232.017, -179.426, 0.444, -99.952]
16p6Joint = [-115.649, -84.367, 122.447, -128.663, -90.432, 74.303]
17exaxisPos = [0, 0, 0, 0]
18offdese = [0, 0, 100, 0, 0, 0]
19robot.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)
20robot.SetTcp4RefPoint(1)
21robot.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)
22robot.SetTcp4RefPoint(2)
23robot.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)
24robot.SetTcp4RefPoint(3)
25robot.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)
26robot.SetTcp4RefPoint(4)
27rtn,coordRtn = robot.ComputeTcp4()
28print(f"4 Point ComputeTool {rtn} coord is {coordRtn[0]} {coordRtn[1]} {coordRtn[2]} "
29 f"{coordRtn[3]} {coordRtn[4]} {coordRtn[5]}")
30robot.SetToolCoord(1, coordRtn, 0, 0, 1, 0)
31error, p1Desc = robot.GetForwardKin(p1Joint)
32error, p2Desc = robot.GetForwardKin(p2Joint)
33error, p3Desc = robot.GetForwardKin(p3Joint)
34robot.SetFocusCalibPoint(1, p1Desc)
35robot.SetFocusCalibPoint(2, p2Desc)
36robot.SetFocusCalibPoint(3, p3Desc)
37rtn, resultPos, accuracy = robot.ComputeFocusCalib(pointNum=3)
38print(f"ComputeFocusCalib coord is {rtn} {resultPos[0]} {resultPos[1]} {resultPos[2]} accuracy is {accuracy}")
39rtn = robot.SetFocusPosition(resultPos)
40error, p5Desc = robot.GetForwardKin(p5Joint)
41error, p6Desc = robot.GetForwardKin(p6Joint)
42robot.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)
43robot.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)
44robot.FocusStart(50, 19, 710, 90, 0)
45robot.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)
46robot.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)
47robot.FocusEnd()
48robot.CloseRPC()
6.53. Joint torque sensor sensitivity calibration function is enabled
New in version python: SDK-v2.1.7
Prototype |
|
|---|---|
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 |
|
|---|---|
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 |
|
|---|---|
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 |
|
|---|---|
Description |
Get joint torque sensor hysteresis error |
Required Parameters |
None |
Default Parameters |
None |
Return Value |
|
6.57. Get Joint Torque Sensor Repeatability
Prototype |
|
|---|---|
Description |
Get joint torque sensor repeatability |
Required Parameters |
None |
Default Parameters |
None |
Return Value |
|
6.58. Set Joint Force Sensor Parameters
Prototype |
|
|---|---|
Description |
Set joint force sensor parameters |
Required Parameters |
|
Default Parameters |
None |
Return Value |
|
6.59. Sample code for automatic calibration of joint torque sensor sensitivity
1from fairino import Robot
2import time
3robot = Robot.RPC('192.168.58.2')
4rtn = robot.JointSensitivityEnable(0)
5rtn = robot.JointSensitivityEnable(1)
6print(f"JointSensitivityEnable rtn is {rtn}")
7curJPos = [0.0] * 6
8rtn, curJPos = robot.GetActualJointPosDegree(0)
9epos = [0.0] * 4
10offset_pos = [0.0] * 6
11jointPos1 = [curJPos[0], 0.0, 0.0, -90.0, 0.02, curJPos[5]]
12descPos1 = [0.0] * 6
13rtn, descPos1 = robot.GetForwardKin(jointPos1)
14robot.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)
15time.sleep(0.2)
16rtn = robot.JointSensitivityCollect()
17print(f"JointSensitivityCollect 1 rtn is {rtn}")
18time.sleep(0.1)
19jointPos2 = [curJPos[0], -30.0, 0.0, -90.0, 0.02, curJPos[5]]
20descPos2 = [0.0] * 6
21rtn, descPos2 = robot.GetForwardKin(jointPos2)
22robot.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)
23time.sleep(0.1)
24rtn = robot.JointSensitivityCollect()
25print(f"JointSensitivityCollect 2 rtn is {rtn}")
26time.sleep(0.1)
27jointPos3 = [curJPos[0], -60.0, 0.0, -90.0, 0.02, curJPos[5]]
28descPos3 = [0.0] * 6
29rtn, descPos3 = robot.GetForwardKin(jointPos3)
30robot.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)
31time.sleep(0.1)
32rtn = robot.JointSensitivityCollect()
33print(f"JointSensitivityCollect 3 rtn is {rtn}")
34time.sleep(0.1)
35jointPos4 = [curJPos[0], -90.0, 0.0, -90.0, 0.02, curJPos[5]]
36descPos4 = [0.0] * 6
37rtn, descPos4 = robot.GetForwardKin(jointPos4)
38robot.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)
39time.sleep(0.1)
40rtn = robot.JointSensitivityCollect()
41print(f"JointSensitivityCollect 4 rtn is {rtn}")
42time.sleep(0.1)
43jointPos5 = [curJPos[0], -120.0, 0.0, -90.0, 0.02, curJPos[5]]
44descPos5 = [0.0] * 6
45rtn, descPos5 = robot.GetForwardKin(jointPos5)
46robot.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)
47time.sleep(0.1)
48rtn = robot.JointSensitivityCollect()
49print(f"JointSensitivityCollect 5 rtn is {rtn}")
50time.sleep(0.1)
51jointPos6 = [curJPos[0], -150.0, 0.0, -90.0, 0.02, curJPos[5]]
52descPos6 = [0.0] * 6
53rtn, descPos6 = robot.GetForwardKin(jointPos6)
54robot.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)
55time.sleep(0.1)
56rtn = robot.JointSensitivityCollect()
57print(f"JointSensitivityCollect 6 rtn is {rtn}")
58time.sleep(0.1)
59jointPos7 = [curJPos[0], -180.0, 0.0, -90.0, 0.02, curJPos[5]]
60descPos7 = [0.0] * 6
61rtn, descPos7 = robot.GetForwardKin(jointPos7)
62robot.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)
63time.sleep(0.1)
64rtn = robot.JointSensitivityCollect()
65print(f"JointSensitivityCollect 7 rtn is {rtn}")
66time.sleep(0.1)
67robot.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)
68time.sleep(0.1)
69rtn = robot.JointSensitivityCollect()
70print(f"JointSensitivityCollect 8 rtn is {rtn}")
71time.sleep(0.1)
72robot.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)
73time.sleep(0.1)
74rtn = robot.JointSensitivityCollect()
75print(f"JointSensitivityCollect 9 rtn is {rtn}")
76time.sleep(0.1)
77robot.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)
78time.sleep(0.1)
79rtn = robot.JointSensitivityCollect()
80print(f"JointSensitivityCollect 10 rtn is {rtn}")
81time.sleep(0.1)
82robot.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)
83time.sleep(0.1)
84rtn = robot.JointSensitivityCollect()
85print(f"JointSensitivityCollect 11 rtn is {rtn}")
86time.sleep(0.1)
87robot.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)
88time.sleep(0.1)
89rtn = robot.JointSensitivityCollect()
90print(f"JointSensitivityCollect 12 rtn is {rtn}")
91time.sleep(0.1)
92robot.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)
93time.sleep(0.2)
94rtn = robot.JointSensitivityCollect()
95print(f"JointSensitivityCollect 13 rtn is {rtn}")
96time.sleep(0.1)
97calibResult = [0.0] * 6
98linearity = [0.0] * 6
99rtn,calibResult, linearity = robot.JointSensitivityCalibration()
100print(f"JointSensitivityCalibration rtn is {rtn}")
101rtn = robot.JointSensitivityEnable(0)
102print(f"JointSensitivityEnable rtn is {rtn}")
103print(f"jointSensor Calib result is {calibResult[0]},{calibResult[1]},{calibResult[2]},{calibResult[3]},{calibResult[4]},{calibResult[5]}")
104print( f"jointSensor linearity is {linearity[0]},{linearity[1]},{linearity[2]},{linearity[3]},{linearity[4]},{linearity[5]}")
105hysteresisError = [0.0] * 6
106rtn,hysteresisError = robot.JointHysteresisError()
107print(f"JointHysteresisError result is {hysteresisError[0]},{hysteresisError[1]},{hysteresisError[2]},{hysteresisError[3]},{hysteresisError[4]},{hysteresisError[5]}")
108repeatability = [0.0] * 6
109rtn,repeatability = robot.JointRepeatability()
110print(f"JointRepeatability result is {repeatability[0]},{repeatability[1]},{repeatability[2]},{repeatability[3]},{repeatability[4]},{repeatability[5]}")
111M = [1.0] * 6
112B = [1.0] * 6
113K = [0.0] * 6
114threshold = [1.0] * 6
115setZeroFlag = 1
116rtn = robot.SetAdmittanceParams(M, B, K, threshold, calibResult, setZeroFlag)
117print(f"SetAdmittanceParams rtn is {rtn}")
118robot.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 |
|
|---|---|
Description |
The number of error frames at eight slave ports of the robot is obtained |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
6.61. Slave port error frame reset
New in version python: SDK-v2.1.7
Prototype |
|
|---|---|
Description |
Slave port error frame reset |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
6.62. Get sample slave port error frame code
1from fairino import Robot
2import time
3import threading
4# Establish a connection with the robot controller and return a robot object if the connection is successful
5robot = Robot.RPC('192.168.58.2')
6inRecvErr = [0] * 8
7inCRCErr = [0] * 8
8inTransmitErr = [0] * 8
9inLinkErr = [0] * 8
10outRecvErr = [0] * 8
11outCRCErr = [0] * 8
12outTransmitErr = [0] * 8
13outLinkErr = [0] * 8
14rtn,inRecvErr, inCRCErr, inTransmitErr, inLinkErr, outRecvErr, outCRCErr, outTransmitErr, outLinkErr = robot.GetSlavePortErrCounter()
15for i in range(8):
16 if inRecvErr[i] != 0:
17 print(f"inRecvErr {i} is {inRecvErr[i]}")
18 if inCRCErr[i] != 0:
19 print(f"inCRCErr {i} is {inCRCErr[i]}")
20 if inTransmitErr[i] != 0:
21 print(f"inTransmitErr {i} is {inTransmitErr[i]}")
22 if inLinkErr[i] != 0:
23 print(f"inLinkErr {i} is {inLinkErr[i]}")
24 if outRecvErr[i] != 0:
25 print(f"outRecvErr {i} is {outRecvErr[i]}")
26 if outCRCErr[i] != 0:
27 print(f"outCRCErr {i} is {outCRCErr[i]}")
28 if outTransmitErr[i] != 0:
29 print(f"outTransmitErr {i} is {outTransmitErr[i]}")
30 if outLinkErr[i] != 0:
31 print(f"outLinkErr {i} is {outLinkErr[i]}")
32print("others has no err!")
33for i in range(8):
34 robot.SlavePortErrCounterClear(i)
35robot.CloseRPC()
6.63. Set the feed-forward coefficient of each axis speed
New in version python: SDK-v2.1.7
Prototype |
|
|---|---|
Description |
Set the feed-forward coefficient of each axis speed |
Mandatory parameters |
|
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 |
|
|---|---|
Description |
The velocity feedforward coefficients of each axis are obtained |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
6.65. Robot velocity feedforward coefficient code example
1from fairino import Robot
2import time
3import threading
4# Establish a connection with the robot controller and return a robot object if the connection is successful
5robot = Robot.RPC('192.168.58.2')
6setRadio = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
7robot.SetVelFeedForwardRatio(setRadio)
8getRadio = [0.0] * 6
9rtn,getRadio = robot.GetVelFeedForwardRatio()
10print(f"{getRadio[0]},{getRadio[1]},{getRadio[2]},{getRadio[3]},{getRadio[4]},{getRadio[5]}")
11robot.CloseRPC()
6.66. Photoelectric Sensor TCP Calibration - Compute Tool RPY
Prototype |
|
|---|---|
Description |
Photoelectric Sensor TCP Calibration - Compute Tool RPY |
Required Parameters |
|
Default Parameters |
None |
Return Value |
|
6.67. Photoelectric Sensor TCP Calibration - Compute Tool XYZ
Prototype |
|
|---|---|
Description |
Photoelectric Sensor TCP Calibration - Compute Tool XYZ |
Required Parameters |
|
Default Parameters |
None |
Return Value |
|
6.68. Photoelectric Sensor TCP Calibration - Start Recording Flange Center Position
Prototype |
|
|---|---|
Description |
Photoelectric Sensor TCP Calibration - Start Recording Flange Center Position |
Required Parameters |
None |
Default Parameters |
None |
Return Value |
|
6.69. Photoelectric Sensor TCP Calibration - Stop Recording Flange Center Position
Prototype |
|
|---|---|
Description |
Photoelectric Sensor TCP Calibration - Stop Recording Flange Center Position |
Required Parameters |
None |
Default Parameters |
None |
Return Value |
|
6.70. Photoelectric Sensor TCP Calibration - Get Tool Center Point Position
Prototype |
|
|---|---|
Description |
Photoelectric Sensor TCP Calibration - Get Tool Center Point Position |
Required Parameters |
None |
Default Parameters |
None |
Return Value |
|
6.71. Photoelectric Sensor TCP Calibration
Prototype |
|
|---|---|
Description |
Photoelectric Sensor TCP Calibration |
Required Parameters |
|
Default Parameters |
None |
Return Value |
|
6.72. Photoelectric Sensor TCP Calibration Code Example
1from fairino import Robot
2import time
3robot = Robot.RPC('192.168.58.2')
4offset = [10.0, 10.0, 3.0]
5TCP = [0.0] * 6
6rtn, TCP = robot.PhotoelectricSensorTCPCalibration("/fruser/FR_CalibrateTheToolTcp.lua", offset)
7print(f"PhotoelectricSensorTCPCalibration rtn is {rtn},{TCP[0]},{TCP[1]},{TCP[2]},{TCP[3]},{TCP[4]},{TCP[5]}")
8robot.CloseRPC()
9return 0