top of page

Python 13.30. Example of UDP extension axis configuration and tapping code

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"202121003200110051)
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(11)
print(f"ExtAxisServoOn axis id 1 rtn is {rtn}")
rtn = robot.ExtAxisServoOn(21)
print(f"ExtAxisServoOn axis id 2 rtn is {rtn}")
time.sleep(2)
robot.ExtAxisSetHoming(10102)
time.sleep(2)
rtn = robot.ExtAxisSetHoming(20102)
print(f"ExtAxisSetHoming rtn is {rtn}")
time.sleep(4)
rtn = robot.SetRobotPosToAxis(1)
print(f"SetRobotPosToAxis rtn is {rtn}")
rtn = robot.SetAxisDHParaConfig(10200000000)
print(f"SetAxisDHParaConfig rtn is {rtn}")
rtn = robot.ExtAxisParamConfig(1111000-1000100010001.905262144200100)
print(f"ExtAxisParamConfig axis 1 rtn is {rtn}")
rtn = robot.ExtAxisParamConfig(2111000-1000100010004.444262144200100)
print(f"ExtAxisParamConfig axis 2 rtn is {rtn}")
time.sleep(3)
robot.ExtAxisStartJog(10101030)
time.sleep(1)
robot.ExtAxisStopJog(1)
time.sleep(3)
robot.ExtAxisServoOn(10)
time.sleep(3)
robot.ExtAxisStartJog(20101030)
time.sleep(1)
robot.ExtAxisStopJog(2)
time.sleep(3)
robot.ExtAxisServoOn(20)
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

  • pointNum: point number [1-4];

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

  • errorcode Success-0 Failure- errcode.

  • coord: extended axis coordinate system values [x,y,z,rx,ry,rz];

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

  • pointNum: point number [1-4];

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

  • errorcode Success-0 Failure- errcode.

  • coord: the value of the coordinate system of the translocator [x,y,z,rx,ry,rz];

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

  • pos: bit position values [x,y,z,rx,ry,rz];

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

  • applyAxisId:Extended Axis Numbering bit0-bit3 corresponds to extended axis numbering 1-4, e.g., if you apply extended axes 1 and 3, it would be 0b 0000 0101, or 5;

  • axisCoordNum: extended axis coordinate system number;

  • coord: coordinate system value [x,y,z,rx,ry,rz];

  • calibFlag: calibration flag 0 - no, 1 - yes;

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

  • Error Code Success-0 Failure- errcode

  • coord:Extended axis coordinate system

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"202121003200110051)
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(11)
print(f"ExtAxisServoOn axis id 1 rtn is {rtn}")
rtn = robot.ExtAxisServoOn(21)
print(f"ExtAxisServoOn axis id 2 rtn is {rtn}")
time.sleep(2)
robot.ExtAxisSetHoming(10102)
time.sleep(2)
rtn = robot.ExtAxisSetHoming(20102)
print(f"ExtAxisSetHoming rtn is {rtn}")
time.sleep(4)
rtn = robot.SetRobotPosToAxis(1)
print(f"SetRobotPosToAxis rtn is {rtn}")
rtn = robot.SetAxisDHParaConfig(1128.5206.4000000)
print(f"SetAxisDHParaConfig rtn is {rtn}")
rtn = robot.ExtAxisParamConfig(1111000-1000100010001.905262144200100)
print(f"ExtAxisParamConfig axis 1 rtn is {rtn}")
rtn = robot.ExtAxisParamConfig(2111000-1000100010004.444262144200100)
print(f"ExtAxisParamConfig axis 2 rtn is {rtn}")
toolCoord = [00210000]
robot.SetToolCoord(1, toolCoord, 0010)
jSafe = [115.193-96.14992.489-87.068-89.15-83.488]
j1 = [117.559-92.624100.329-96.909-94.057-83.488]
j2 = [112.239-90.09699.282-95.909-89.824-83.488]
j3 = [110.839-83.47393.166-89.22-90.499-83.487]
j4 = [107.935-83.57295.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(10505010)
time.sleep(1)
robot.ExtAxisStartJog(20505010)
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(10505010)
time.sleep(1)
robot.ExtAxisStartJog(20505010)
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(10505010)
time.sleep(1)
robot.ExtAxisStartJog(20505010)
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(31, 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

  • pos=[exaxis[0],exaxis[1],exaxis[2],exaxis[3]]: target position Axis 1 position to Axis 4 position;

  • ovl: percentage of speed

Default parameters

  • blend:Smoothing parameter (mm or ms), -1, waiting for the motion to complete, Default -1

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

  • joint_pos: target joint position in [°];

  • desc_pos: Cartesian position of the target in [mm][°];

  • tool: tool number, [0 to 14]

  • user: artifact number, [0~14]

  • exaxis_pos: external axis 1 position ~ external axis 4 positions

Default Parameters

  • desc_pos: target Cartesian position in [mm][°] Default initial value [0.0,0.0,0.0,0.0,0.0,0.0,0.0], default value calls positive kinematics to solve for the return value.

  • vel: percentage of speed, [0~100] default 20.0;

  • acc: percentage of acceleration, [0~100] not open yet, default 0.0;

  • ovl: velocity scaling factor, [0~100] default 100.0 ;

  • blendT: [-1.0]-motion in place (blocking), [0~500.0]-smoothing time (non-blocking) in [ms] default -1.0;

  • offset_flag: [0] - no offset, [1] - offset in workpiece/base coordinate system, [2] - offset in tool coordinate system Default 0;

  • offset_pos: position offset in [mm][°] default [0.0,0.0,0.0,0.0,0.0,0.0] ;

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