top of page

Python 11.45. Setting Enable End LUA Execution

New in version python: SDK-v2.0.5

Prototype

SetAxleLuaEnable(enable)

Description

Set Enable End LUA Enforcement

Mandatory parameters

  • enable: 0 - not enabled; 1 - enabled

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.46. End LUA file exception error recovery

New in version python: SDK-v2.0.5

Prototype

SetRecoverAxleLuaErr(enable)

Description

End LUA File Exception Error Recovery

Mandatory parameters

  • status: 0 - no recovery; 1 - recovery

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.47. Get end LUA execution enable status

New in version python: SDK-v2.0.5

Prototype

GetAxleLuaEnableStatus()

description

Get end LUA execution enable state

Mandatory parameters

NULL

Default parameters

NULL

Return Value

  • errorcode Success-0 Failure- errcode

  • enable: 0-don’t enable; 1-enable

11.48. Setting the end LUA end device enable type

New in version python: SDK-v2.0.5

prototype

SetAxleLuaEnableDeviceType(forceSensorEnable, gripperEnable, IOEnable)

Description

Set end LUA end device enable type

Mandatory parameters

  • forceSensorEnable: force sensor enable status, 0 - not enabled; 1 - enabled

  • gripperEnable: gripper enable status, 0 - not enabled; 1 - enabled

  • IOEnable: IO device enable status, 0-not enabled; 1-enabled

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.49. Get End LUA End Device Enablement Type

New in version python: SDK-v2.0.5

Prototype

GetAxleLuaEnableDeviceType()

Description

Get End LUA End Device Enablement Type

Mandatory parameters

NULL

Default parameters

NULL

Return Value

  • errorcode Success-0 Failure- errcode

  • forceSensorEnable: force sensor enable status, 0 - not enabled; 1 - enabled

  • gripperEnable: gripper enable status, 0 - not enabled; 1 - enabled

  • IOEnable: IO device enable status, 0-not enabled; 1-enabled

11.50. Get the currently configured end device

New in version python: SDK-v2.0.5

Prototype

GetAxleLuaEnableDevice()

Description

Get the currently configured end device

Mandatory parameters

NULL

Default parameters

NULL

Return Value

  • errorcode Success-0 Failure- errcode

  • forceSensorEnable[8]: force sensor enable state, 0 - not enabled; 1 - enabled

  • gripperEnable[8]: gripper enable status, 0 - not enabled; 1 - enabled

  • IOEnable[8]: IO device enable status, 0-not enabled; 1-enabled

11.51. Setting to enable the jaw movement control function

New in version python: SDK-v2.0.5

Prototype

SetAxleLuaGripperFunc(id, func)

Description

Set to enable the jaw motion control function

Mandatory parameters

  • id: gripper device number

  • func: 0-jaw enable; 1-jaw initialization; 2-position setting; 3-speed setting; 4-torque setting; 6-reading the jaw status; 7-reading the initialization status; 8-reading the fault code; 9-reading the position; 10-reading the speed; 11-reading the torque,12-15 reserved

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.52. Getting to Enable Jaw Motion Control

New in version python: SDK-v2.0.5

Prototype

GetAxleLuaGripperFunc(id)

Description

Get the Enable Jaw Motion Control function

Mandatory parameter

  • id: gripper device number

Default parameters

NULL

Return Value

  • errorcode Success-0 Failure- errcode

  • func: 0-jaw enable; 1-jaw initialization; 2-position setting; 3-speed setting; 4-torque setting; 6-reading the jaw status; 7-reading the initialization status; 8-reading the fault code; 9-reading the position; 10-reading the speed; 11-reading the torque,12-15 reserved

11.53. The Ethercat slave file is written by the robot

New in version python: SDK-v2.0.5

Prototype

SlaveFileWrite(type,slaveID,fileName)

Description

The Ethercat slave file is written by the robot

Mandatory parameter

  • type:Slave file type, 1- Upgrade slave file; 2- Upgrade the slave station configuration file

  • slaveID:From the station number

  • fileName:Upload the file name

Default parameters

NULL

Return Value

errorcode Success-0 Failure- errcode

11.54. Upload the end Lua open protocol file

New in version python: SDK-v2.0.5

Prototype

AxleLuaUpload(filePath)

Description

Upload the end Lua open protocol file

Mandatory parameter

  • filePath:Local lua file path name …/AXLE_LUA_End_DaHuan.lua

Default parameters

NULL

Return Value

errorcode Success-0 Failure- errcode

11.55. The robot Ethercat enters boot mode from the station

New in version python: SDK-v2.0.5

Prototype

SetSysServoBootMode(filePath)

Description

The robot Ethercat enters boot mode from the station

Mandatory parameter

NULL

Default parameters

NULL

Return Value

errorcode Success-0 Failure- errcode

11.56. Example of LUA file manipulation code at the end of the robot

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')
robot.AxleLuaUpload("D://zUP/AXLE_LUA_End_DaHuan.lua")
param = [7810531]  # 对应AxleComParam参数
robot.SetAxleCommunicationParam(7810531)
error,getParam0,getParam1,getParam2,getParam3,getParam4,getParam5,getParam6 = robot.GetAxleCommunicationParam()
print(f"GetAxleCommunicationParam param is:{getParam0} {getParam1} {getParam2} {getParam3} {getParam4} {getParam5} {getParam6}")
robot.SetAxleLuaEnable(1)
error,luaEnableStatus = robot.GetAxleLuaEnableStatus()
robot.SetAxleLuaEnableDeviceType(010)
error,forceEnable, gripperEnable, ioEnable = robot.GetAxleLuaEnableDeviceType()
print(f"GetAxleLuaEnableDeviceType param is:{forceEnable} {gripperEnable} {ioEnable}")
func = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
robot.SetAxleLuaGripperFunc(1, func)
error,getFunc = robot.GetAxleLuaGripperFunc(1)
error,getforceEnable, getgripperEnable, getioEnable = robot.GetAxleLuaEnableDevice()
print("\ngetforceEnable status:", end=" ")
for i in range(8):
    print(f"{getforceEnable[i]},", end="")
print("\ngetgripperEnable status:", end=" ")
for i in range(8):
    print(f"{getgripperEnable[i]},", end="")
print("\ngetioEnable status:", end=" ")
for i in range(8):
    print(f"{getioEnable[i]},", end="")
print()
robot.ActGripper(10)
time.sleep(2)
robot.ActGripper(11)
time.sleep(2)
robot.MoveGripper(190101005000000000)
while True:
    error,pkg = robot.GetRobotRealTimeState()
    print(f"gripper pos is:{pkg.gripper_position}")
    time.sleep(0.1)
robot.CloseRPC()

11.57. Obtain the status of the SmartTool button

New in version python: SDK-v2.1.2

Prototype

GetSmarttoolBtnState()

Description

Obtain the status of the SmartTool button

Mandatory parameters

NULL

Default parameters

NULL

Return Value

  • Error Code Success-0 Failure- errcode

  • state: SmartTool handle button status (bit0:0- Communication is normal; 1- Communication disconnection; bit1- Undo operation bit2- Clear the program; bit3-A key bit4-B key bit5-C key bit6-D key bit7-E key bit8-IO key bit9- Manual automatic Starting from bit10

11.58. SmartTool button 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')
while True:
    error,state = robot.GetSmarttoolBtnState()
    print(f"{state:016b}")
    time.sleep(0.1)

11.59. Set the load detection before drag is started

New in version python: SDK-v2.1.6

Prototype

SetTorqueDetectionSwitch(flag)

Description

Set the load detection before drag is started

Mandatory parameters

  • flag:0- closed; 1- On

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.60. Laser peripheral open and close function

New in version python: SDK-v2.1.6

Prototype

LaserTrackingLaserOnOff(OnOff, weldId)

Description

Laser peripheral open and close function

Mandatory parameters

  • OnOff:0- closed; 1- On

Default parameters

  • weldId:The default weld ID is 0

Return Value

Error Code Success-0 Failure- errcode

11.61. Laser tracking start-end function

New in version python: SDK-v2.1.6

Prototype

LaserTrackingTrackOnOff(OnOff, coordId)

Description

Laser tracking start-end function

Mandatory parameters

  • OnOff:0- closed; 1- On

  • coordId:Laser peripheral tool coordinate system No

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.62. Laser positioning - Fixed direction

New in version python: SDK-v2.1.6

Prototype

LaserTrackingSearchStart_xyz(direction, vel, distance, timeout, posSensorNum)

Description

Laser positioning - Fixed direction

Mandatory parameters

  • direction:0-x+ 1-x- 2-y+ 3-y- 4-z+ 5-z-

  • vel:Unit of speed %

  • distance:The maximum positioning distance unit is mm

  • timeout:The unit of seek timeout time is ms

  • posSensorNum:The coordinate number of the tool calibrated by laser

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.63. Laser positioning - in any direction

New in version python: SDK-v2.1.6

Prototype

LaserTrackingSearchStart_point(directionPoint, vel, distance, timeout, posSensorNum)

Description

Laser positioning - in any direction

Mandatory parameters

  • directionPoint:To the left of the xyz of the input point for positioning,[x,y,z]

  • vel:Unit of speed %

  • distance:The maximum positioning distance unit is mm

  • timeout:The unit of seek timeout time is ms

  • posSensorNum:The coordinate number of the tool calibrated by laser

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.64. Laser IP configuration

New in version python: SDK-v2.1.6

Prototype

LaserTrackingSensorConfig(ip, port)

Description

Laser IP configuration

Mandatory parameters

  • ip:The ip address of the laser peripheral

  • port:The port number of the laser peripheral

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.65. Configuration of sampling period for laser peripherals

New in version python: SDK-v2.1.6

Prototype

LaserTrackingSensorSamplePeriod(period)

Description

Configuration of sampling period for laser peripherals

Mandatory parameters

  • period:The unit of sampling period for laser peripherals is ms

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.66. Laser peripheral driver loading

New in version python: SDK-v2.1.6

Prototype

LoadPosSensorDriver(type)

Description

Laser peripheral driver loading

Mandatory parameters

  • type:Protocol type of the laser device driver: 101-Ruineng 102-Chuangxiang 103-Quanshi 104-Tongzhou 105-Aotai

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.67. Laser peripheral driver unloading

New in version python: SDK-v2.1.6

Prototype

UnLoadPosSensorDriver()

Description

Laser peripheral driver unloading

Mandatory parameters

NULL

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.68. Laser weld seam trajectory recording

New in version python: SDK-v2.1.6

Prototype

LaserSensorRecord1(status, delayTime)

Description

Laser weld seam trajectory recording

Mandatory parameters

  • status:0- Stop recording 1- Real-time tracking 2- Start recording

  • delayTime:The delay time unit is ms

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.69. Laser weld seam trajectory reproduction

New in version python: SDK-v2.1.6

Prototype

LaserSensorReplay(delayTime, speed)

Description

Laser weld seam trajectory reproduction

Mandatory parameters

  • delayTime:The delay time unit is ms

  • speed:Unit of speed %

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.70. Laser tracking reproduction

New in version python: SDK-v2.1.6

Prototype

MoveLTR()

Description

Laser tracking reproduction

Mandatory parameters

NULL

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.71. Laser weld seam trajectory reproduction

New in version python: SDK-v2.1.6

Prototype

LaserSensorRecordandReplay(delayMode, delayTime, delayDisExAxisNum, delayDis, sensitivePara, int trackMode, int triggerMode, double runTime, speed)

Description

Laser Weld Seam Trajectory Replay

Required Parameters

  • delayMode: Mode 0-Delay Time 1-Delay Distance

  • delayTime: Delay time in milliseconds (ms)

  • delayDisExAxisNum: Extended Axis Number

  • delayDis: Delay distance in millimeters (mm)

  • sensitivePara: Compensation Sensitivity Coefficient

  • trackMode: Fixed-point Tracking Type. 0-Extended Axis Asynchronous Motion; 1-Robot

  • triggerMode: Fixed-point Tracking Trigger Method. 0-Tracking Duration; 1-IO

  • runTime: Robot Fixed-point Tracking Duration in seconds (s)

  • speed: Speed in percentage (%)

Default Parameters

None

Return Value

Error Code. Success - 0, Failure - errcode

11.72. Movement to the starting point of weld record

New in version python: SDK-v2.1.6

Prototype

MoveToLaserRecordStart(moveType, ovl)

Description

Movement to the starting point of weld record

Mandatory parameters

  • moveType:0-PTP 1-LIN

  • ovl:Speed unit %

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.73. Movement to the end of the weld record

New in version python: SDK-v2.1.6

Prototype

MoveToLaserRecordEnd(moveType, ovl)

Description

Movement to the end of the weld record

Mandatory parameters

  • moveType:0-PTP 1-LIN

  • ovl:Speed unit %

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.74. Move to the laser sensor to find the site

New in version python: SDK-v2.1.6

Prototype

MoveToLaserSeamPos(moveFlag, ovl, dataFlag, plateType, trackOffectType, offset)

Description

Move to the laser sensor to find the site

Mandatory parameters

  • moveFlag:Motion type: 0-PTP; 1-LIN

  • ovl:Speed scaling factor, 0-100

  • dataFlag:Weld cache data selection: 0-execution planning data; 1- Perform logging data

  • plateType:Plate type: 0-corrugated plate; 1- Corrugated board; 2- Fence board; 3- oil barrel; 4- Corrugated shell steel

  • trackOffectType:Laser sensor offset type: 0-no offset; 1-base coordinate shift; 2- Tool coordinate offset; 3-Laser sensor raw data offset

  • offset:Offset value

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

11.75. Obtain the coordinate information of the laser sensor location

New in version python: SDK-v2.1.6

Prototype

GetLaserSeamPos(trackOffectType, offset)

Description

Obtain the coordinate information of the laser sensor location

Mandatory parameters

  • trackOffectType:Laser sensor offset type: 0-no offset; 1-base coordinate shift; 2- Tool coordinate offset; 3-Laser sensor raw data offset

  • offset:Offset value

Default parameters

NULL

Return Value

  • Error Code Success-0 Failure- errcode

  • jPos:Joint position[°]

  • descPos:Cartesian position[mm]

  • tool:Tool coordinate system

  • user:Workpiece coordinate system

  • exaxis:Extension axis position[mm]

11.76. Example of laser peripheral sensor parameter configuration and debugging code

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')
robot.LaserTrackingSensorConfig("192.168.58.20"5020)
robot.LaserTrackingSensorSamplePeriod(20)
robot.LoadPosSensorDriver(101)
robot.LaserTrackingLaserOnOff(00)
time.sleep(3)
robot.LaserTrackingLaserOnOff(10)
robot.CloseRPC()

11.77. Code example of laser trajectory scanning and trajectory reproduction

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')
robot.OpenLuaUpload("D://zUP/CtrlDev_laser_ruiniu-0117.lua")
time.sleep(2)
robot.SetCtrlOpenLUAName(0"CtrlDev_laser_ruiniu-0117.lua")
robot.UnloadCtrlOpenLUA(0)
robot.LoadCtrlOpenLUA(0)
time.sleep(8)
i = 0
while i<10:
    startjointPos = [56.205-117.951141.872-118.149-94.217-122.176]
    startdescPose = [-97.552-282.85526.675174.182-1.338-91.707]
    exaxisPos = [0.0* 4
    offdese = [0.0* 6
    robot.MoveL(desc_pos=startdescPose,tool= 1,user= 0,vel= 100,acc= 100,ovl= 100,blendR= -1,exaxis_pos= exaxisPos,search= 0,offset_flag= 0, offset_pos= offdese,overSpeedStrategy= 1,speedPercent= 1)
    robot.LaserSensorRecord1(210)
    endjointPos = [68.809-87.100121.120-127.233-95.038-109.555]
    enddescPose = [-103.555-464.23413.076174.179-1.344-91.709]
    robot.MoveL(desc_pos=enddescPose,tool= 1,user= 0,vel= 50,acc= 100,ovl= 100,blendR= -1,exaxis_pos= exaxisPos,search= 0,offset_flag= 0, offset_pos= offdese,overSpeedStrategy= 1,speedPercent= 1)
    robot.LaserSensorRecord1(010)
    robot.MoveToLaserRecordStart(130)
    robot.LaserSensorReplay(10100)
    robot.MoveLTR()
    robot.LaserSensorRecord1(010)
    i = i+1
robot.CloseRPC()

11.78. Code examples for laser locating and real-time tracking

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')
robot.OpenLuaUpload("D://zUP/CtrlDev_laser_ruiniu-0117.lua")
time.sleep(2)
robot.SetCtrlOpenLUAName(0"CtrlDev_laser_ruiniu-0117.lua")
robot.UnloadCtrlOpenLUA(0)
robot.LoadCtrlOpenLUA(0)
time.sleep(8)
time.sleep(8)
i = 0
while i < 10:
    startjointPos = [56.205-117.951141.872-118.149-94.217-122.176]
    startdescPose = [-97.552-282.85526.675174.182-1.338-91.707]
    exaxisPos = [0.0* 4
    offdese = [0.0* 6
    directionPoint = [0.0* 3
    robot.MoveL(desc_pos=startdescPose,tool= 1,user= 0,vel= 100,acc= 100,ovl= 100,blendR= -1,exaxis_pos= exaxisPos,search= 0,offset_flag= 0, offset_pos= offdese,overSpeedStrategy= 1,speedPercent= 1)
    robot.LaserTrackingSearchStart_xyz(310030010003)
    robot.LaserTrackingSearchStop()
    robot.MoveToLaserSeamPos(130000, offdese)
    robot.LaserTrackingTrackOnOff(13)
    endjointPos = [68.809-87.100121.120-127.233-95.038-109.555]
    enddescPose = [-103.555-464.23413.076174.179-1.344-91.709]
    robot.MoveL(desc_pos=enddescPose,tool= 1,user= 0,vel= 20,acc= 100,ovl= 100,blendR= -1,exaxis_pos= exaxisPos,search= 0,offset_flag= 0, offset_pos= offdese,overSpeedStrategy= 1,speedPercent= 1)
    robot.LaserTrackingTrackOnOff(03)
    i = i + 1
    print(i)
robot.CloseRPC()

11.79. Code example of the extended axis synchronized with the robot for laser tracking

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')
startexaxisPos = [0.00.00.00.0]
seamexaxisPos = [-10.00.00.00.0]
endexaxisPos = [-30.00.00.00.0]
offdese = [0.0* 6
seamjointPos = [0.0* 6
seamdescPose = [0.0* 6
i=0
while i < 10:
    startjointPos = [58.337-119.628146.037-116.358-92.224-117.654]
    startdescPose = [-53.375-255.3630.919178.0541.077-94.026]
    robot.ExtAxisSyncMoveJ(joint_pos=startjointPos, tool=1,user= 0,vel= 100,acc= 100, ovl=100,exaxis_pos= startexaxisPos,blendT= -1,offset_flag= 0,offset_pos= offdese)
    ret = robot.LaserTrackingSearchStart_xyz(310030010002)
    robot.LaserTrackingSearchStop()
    tool = 0
    user = 0
    rnte, seamjointPos, seamdescPose, tool, user, startexaxisPos = robot.GetLaserSeamPos(0, offdese)
    print(f"{seamjointPos[0]},{seamjointPos[1]},{seamjointPos[2]},{seamjointPos[3]},{seamjointPos[4]},{seamjointPos[5]},{seamdescPose[0]},{seamdescPose[1]},{seamdescPose[2]},{seamdescPose[3]},{seamdescPose[4]},{seamdescPose[5]}")
    if ret == 0:
        robot.ExtAxisSyncMoveJ(joint_pos=seamjointPos, tool=1,user= 0,vel= 100,acc= 100, ovl=100,exaxis_pos= seamexaxisPos,blendT= -1,offset_flag= 0,offset_pos= offdese)
        robot.LaserTrackingTrackOnOff(12)
        endjointPos = [70.580-90.918126.593-125.154-92.162-105.403]
        enddescPose = [-53.375-419.0200.920178.0541.076-94.026]
        robot.ExtAxisSyncMoveL(desc_pos=enddescPose, tool=1,user= 0,vel= 20,acc= 100, ovl=100,blendR= -1,exaxis_pos= endexaxisPos,offset_pos= offdese)
        robot.LaserTrackingTrackOnOff(02)
    i = i+1
    print(i)
robot.CloseRPC()

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