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.ExtDevSetUDPComParam("192.168.58.88", 2021, 2, 100, 3, 200, 1, 100, 5, 1)
print(f"ExtDevSetUDPComParam rtn is {rtn}")
ip = ""
port = 0
period = 0
lossPkgTime = 0
lossPkgNum = 0
disconnectTime = 0
reconnectEnable = 0
reconnectPeriod = 0
reconnectNum = 0
rtn,[ip, port, period, lossPkgTime, lossPkgNum,disconnectTime, reconnectEnable, reconnectPeriod, reconnectNum] = robot.ExtDevGetUDPComParam()
param_str = (f"\nip {ip}\nport {port}\nperiod {period}\nlossPkgTime {lossPkgTime}"
f"\nlossPkgNum {lossPkgNum}\ndisConntime {disconnectTime}"
f"\nreconnecable {reconnectEnable}\nreconnperiod {reconnectPeriod}"
f"\nreconnnun {reconnectNum}")
print(f"ExtDevGetUDPComParam rtn is {rtn}{param_str}")
robot.ExtDevLoadUDPDriver()
rtn = robot.ExtAxisServoOn(1, 1)
print(f"ExtAxisServoOn axis id 1 rtn is {rtn}")
rtn = robot.ExtAxisServoOn(2, 1)
print(f"ExtAxisServoOn axis id 2 rtn is {rtn}")
time.sleep(2)
robot.ExtAxisSetHoming(1, 0, 10, 2)
time.sleep(2)
rtn = robot.ExtAxisSetHoming(2, 0, 10, 2)
print(f"ExtAxisSetHoming rtn is {rtn}")
time.sleep(4)
rtn = robot.SetRobotPosToAxis(1)
print(f"SetRobotPosToAxis rtn is {rtn}")
rtn = robot.SetAxisDHParaConfig(10, 20, 0, 0, 0, 0, 0, 0, 0)
print(f"SetAxisDHParaConfig rtn is {rtn}")
rtn = robot.ExtAxisParamConfig(1, 1, 1, 1000, -1000, 1000, 1000, 1.905, 262144, 200, 1, 0, 0)
print(f"ExtAxisParamConfig axis 1 rtn is {rtn}")
rtn = robot.ExtAxisParamConfig(2, 1, 1, 1000, -1000, 1000, 1000, 4.444, 262144, 200, 1, 0, 0)
print(f"ExtAxisParamConfig axis 2 rtn is {rtn}")
time.sleep(3)
robot.ExtAxisStartJog(1, 0, 10, 10, 30)
time.sleep(1)
robot.ExtAxisStopJog(1)
time.sleep(3)
robot.ExtAxisServoOn(1, 0)
time.sleep(3)
robot.ExtAxisStartJog(2, 0, 10, 10, 30)
time.sleep(1)
robot.ExtAxisStopJog(2)
time.sleep(3)
robot.ExtAxisServoOn(2, 0)
robot.ExtDevUnloadUDPDriver()
robot.CloseRPC()
13.31. Setting the reference point of the extended axis coordinate system - four-point method
New in version python: SDK-v2.0.4
Prototype | ExtAxisSetRefPoint(pointNum) |
Description | Setting the reference point of the extended axis coordinate system - four-point method |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
13.32. Calculating the Extended Axis Coordinate System - Four Point Method
New in version python: SDK-v2.0.4
Prototype | ExtAxisComputeECoordSys() |
Description | Calculating Extended Axis Coordinate Systems - Four Point Method |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value |
|
13.33. Reference Point Setting for the Shifter Coordinate System - Four-Point Method
New in version python: SDK-v2.0.4
Prototype | PositionorSetRefPoint(pointNum) |
Description | Reference Point Setting for the Variable Position Machine Coordinate System - Four Point Method |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
13.34. Shifter Coordinate System Calculation - Four Point Method
New in version python: SDK-v2.0.4
Prototype | PositionorComputeECoordSys() |
Description | Translator Coordinate System Calculation - Four Point Method |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value |
|
13.35. Setting of the calibration reference point in the position in the coordinate system of the end of the translator
New in version python: SDK-v2.0.4
prototype | SetRefPointInExAxisEnd(pos) |
Description | Set the calibration reference point to be positioned in the coordinate system of the end of the variator |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
13.36. Applying the Extended Axis Coordinate System
New in version python: SDK-v2.0.4
Prototype | ExtAxisActiveECoordSys(applyAxisId,axisCoordNum,coord,calibFlag) |
Description | Apply extended axis coordinate system |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
13.37. Obtain the extended axis coordinate system
New in version python: SDK-v2.1.2
Prototype | ExtAxisGetCoord() |
Description | Obtain the extended axis coordinate system |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value |
|
13.38. Extended axis coordinate system calibration 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.ExtDevSetUDPComParam("192.168.58.88", 2021, 2, 100, 3, 200, 1, 100, 5, 1)
print(f"ExtDevSetUDPComParam rtn is {rtn}")
rtn,udp_params = robot.ExtDevGetUDPComParam()
ip, port, period, lossPkgTime, lossPkgNum, disconnectTime, reconnectEnable, reconnectPeriod, reconnectNum = udp_params
patam = (
f"\nip {ip}\nport {port}\nperiod {period}\nlossPkgTime {lossPkgTime}\n"
f"lossPkgNum {lossPkgNum}\ndisConntime {disconnectTime}\nreconnecable {reconnectEnable}\n"
f"reconnperiod {reconnectPeriod}\nreconnnun {reconnectNum}"
)
print(f"ExtDevGetUDPComParam rtn is {rtn}{patam}")
robot.ExtDevLoadUDPDriver()
rtn = robot.ExtAxisServoOn(1, 1)
print(f"ExtAxisServoOn axis id 1 rtn is {rtn}")
rtn = robot.ExtAxisServoOn(2, 1)
print(f"ExtAxisServoOn axis id 2 rtn is {rtn}")
time.sleep(2)
robot.ExtAxisSetHoming(1, 0, 10, 2)
time.sleep(2)
rtn = robot.ExtAxisSetHoming(2, 0, 10, 2)
print(f"ExtAxisSetHoming rtn is {rtn}")
time.sleep(4)
rtn = robot.SetRobotPosToAxis(1)
print(f"SetRobotPosToAxis rtn is {rtn}")
rtn = robot.SetAxisDHParaConfig(1, 128.5, 206.4, 0, 0, 0, 0, 0, 0)
print(f"SetAxisDHParaConfig rtn is {rtn}")
rtn = robot.ExtAxisParamConfig(1, 1, 1, 1000, -1000, 1000, 1000, 1.905, 262144, 200, 1, 0, 0)
print(f"ExtAxisParamConfig axis 1 rtn is {rtn}")
rtn = robot.ExtAxisParamConfig(2, 1, 1, 1000, -1000, 1000, 1000, 4.444, 262144, 200, 1, 0, 0)
print(f"ExtAxisParamConfig axis 2 rtn is {rtn}")
toolCoord = [0, 0, 210, 0, 0, 0]
robot.SetToolCoord(1, toolCoord, 0, 0, 1, 0)
jSafe = [115.193, -96.149, 92.489, -87.068, -89.15, -83.488]
j1 = [117.559, -92.624, 100.329, -96.909, -94.057, -83.488]
j2 = [112.239, -90.096, 99.282, -95.909, -89.824, -83.488]
j3 = [110.839, -83.473, 93.166, -89.22, -90.499, -83.487]
j4 = [107.935, -83.572, 95.424, -92.873, -87.933, -83.488]
descSafe = [0.0,0.0,0.0,0.0,0.0,0.0]
desc1 = [0.0,0.0,0.0,0.0,0.0,0.0]
desc2 = [0.0,0.0,0.0,0.0,0.0,0.0]
desc3 = [0.0,0.0,0.0,0.0,0.0,0.0]
desc4 = [0.0,0.0,0.0,0.0,0.0,0.0]
exaxisPos = [0.0,0.0,0.0,0.0]
offdese = [0.0,0.0,0.0,0.0,0.0,0.0]
error, descSafe = robot.GetForwardKin(jSafe)
robot.MoveJ(joint_pos=jSafe,tool= 1,user= 0,vel= 100)
time.sleep(2)
error, desc1 = robot.GetForwardKin(j1)
robot.MoveJ(joint_pos=j1,tool= 1,user= 0,vel= 100)
time.sleep(2)
actualTCPPos = [0.0,0.0,0.0,0.0,0.0,0.0]
error, actualTCPPos = robot.GetActualTCPPose(0)
robot.SetRefPointInExAxisEnd(actualTCPPos)
rtn = robot.PositionorSetRefPoint(1)
print(f"PositionorSetRefPoint 1 rtn is {rtn}")
time.sleep(2)
robot.MoveJ(joint_pos=jSafe,tool= 1,user= 0,vel= 100)
robot.ExtAxisStartJog(1, 0, 50, 50, 10)
time.sleep(1)
robot.ExtAxisStartJog(2, 0, 50, 50, 10)
time.sleep(1)
error, desc2 = robot.GetForwardKin(j2)
rtn = robot.MoveJ(joint_pos=j2,tool= 1,user= 0,vel= 100)
rtn = robot.PositionorSetRefPoint(2)
print(f"PositionorSetRefPoint 2 rtn is {rtn}")
time.sleep(2)
robot.MoveJ(joint_pos=jSafe,tool= 1,user= 0,vel= 100)
robot.ExtAxisStartJog(1, 0, 50, 50, 10)
time.sleep(1)
robot.ExtAxisStartJog(2, 0, 50, 50, 10)
time.sleep(1)
error, desc3 = robot.GetForwardKin(j3)
robot.MoveJ(joint_pos=j3,tool= 1,user= 0,vel= 100)
rtn = robot.PositionorSetRefPoint(3)
print(f"PositionorSetRefPoint 3 rtn is {rtn}")
time.sleep(2)
robot.MoveJ(joint_pos=jSafe,tool= 1,user= 0,vel= 100)
robot.ExtAxisStartJog(1, 0, 50, 50, 10)
time.sleep(1)
robot.ExtAxisStartJog(2, 0, 50, 50, 10)
time.sleep(1)
error, desc4 = robot.GetForwardKin(j4)
robot.MoveJ(joint_pos=j4,tool= 1,user= 0,vel= 100)
rtn = robot.PositionorSetRefPoint(4)
print(f"PositionorSetRefPoint 4 rtn is {rtn}")
time.sleep(2)
axisCoord = [0.0,0.0,0.0,0.0,0.0,0.0]
error,axisCoord = robot.PositionorComputeECoordSys()
robot.MoveJ(joint_pos=jSafe,tool= 1,user= 0,vel= 100)
print(f"PositionorComputeECoordSys rtn is {axisCoord[0]} {axisCoord[1]} {axisCoord[2]} {axisCoord[3]} {axisCoord[4]} {axisCoord[5]}")
rtn = robot.ExtAxisActiveECoordSys(3, 1, axisCoord, 1)
print(f"ExtAxisActiveECoordSys rtn is {rtn}")
robot.CloseRPC()
13.39. UDP Extended Axis Motion
New in version python: SDK-v2.1.4
Prototype | ExtAxisMove(pos,ovl,blend=-1) |
Description | UDP Extended Axis Motion |
Mandatory parameters |
|
Default parameters |
|
Return Value | Error Code Success-0 Failure- errcode |
13.40. UDP Extended axis motion 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')
axisPos = [20,0,0,0]
robot.ExtAxisMove(axisPos, 50, -1)
robot.CloseRPC()
return 0
13.41. UDP extension axes synchronized with robot joint motion
New in version python: SDK-v2.0.4
Prototype | ExtAxisSyncMoveJ(joint_pos,tool,user,exaxis_pos, desc_pos=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0], vel=20.0, acc=0.0, ovl= 100.0, blendT=-1.0, offset_flag=0, offset_pos=[ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) |
Description | UDP extension axis synchronized motion with robot joint motion |
Mandatory parameters |
|
Default Parameters |
|
Return Value | Error Code Success-0 Failure- errcode; |