top of page

Python 13.47. Setting the Extended DO

New in version python: SDK-v2.0.4

Prototype

SetAuxDO(DONum,bOpen,smooth,block)

Description

Setting the Extended DO

Mandatory parameters

  • DONum: DO number;

  • bOpen: switch True-Open, False-Off;

  • smooth: smooth or not True - yes, False - no;

  • block: whether to block True - Yes, False - No;

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

13.48. Setting up Extended AO

New in version python: SDK-v2.0.4

Prototype

SetAuxAO(AONum,value,block)

Description

Setting the Extended AO

Mandatory parameters

  • AONum: AO number;

  • value: analog value [0-4095];

  • block: whether to block True - Yes, False - No;

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

13.49. Setting the Extended DI Input Filter Time

New in version python: SDK-v2.0.4

Prototype

SetAuxDIFilterTime(filterTime)

Description

Setting the Extended DI Input Filter Time

Mandatory parameters

  • filterTime: filter time (ms);

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

13.50. Setting the Extended AI Input Filter Time

New in version python: SDK-v2.0.4

Prototype

SetAuxAIFilterTime(AINum,filterTime)

Description

Set the extended AI input filter time

Mandatory parameters

  • AINum: AI number;

  • filterTime: filter time (ms);

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

13.51. Waiting for extended DI input

New in version python: SDK-v2.0.4

Prototype

WaitAuxDI(DINum,bOpen,time,errorAlarm)

Description

Waiting for extended DI input

Mandatory parameters

  • DINum: DI number;

  • bOpen: switch True-Open, False-Off;

  • time: maximum waiting time (ms);

  • errorAlarm: whether to continue the campaign True-Yes,False-No

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

13.52. Waiting for extended AI input

New in version python: SDK-v2.0.4

Prototype

WaitAuxAI(,AINum,sign,value,time,errorAlarm)

Description

Waiting for extended AI input

Mandatory parameters

  • AINum: AI number;

  • sign: 0 - greater than; 1 - less than;

  • value: AI value;

  • time: maximum waiting time (ms);

  • errorAlarm: whether to continue the campaign True-Yes,False-No

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

13.53. Get Extended DI Value

New in version python: SDK-v2.0.4

Prototype

GetAuxDI(DINum,isNoBlock)

Description

Get Extended DI Value

Mandatory parameters

  • DINum: DI number;

  • isNoBlock: whether to block True-blocking false-non-blocking;

Default parameters

NULL

Return Value

  • errorcode Success-0 Failure- errcode;

  • isOpen: 0 - off; 1 - on;

13.54. Get Extended AI Value

New in version python: SDK-v2.0.4

Prototype

GetAuxAI(AINum,isNoBlock)

Description

Get Extended AI Value

Mandatory parameters

  • AINum: AI number;

  • isNoBlock: whether to block True-blocking False-non-blocking

Default parameters

NULL

Return Value

  • errorcode Success-0 Failure- errcode;

  • value: input value;

13.55. Extended IO 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')
for i in range(128):
    robot.SetAuxDO(i, True, False, True)
    time.sleep(0.1)
for i in range(128):
    robot.SetAuxDO(i, False, False, True)
    time.sleep(0.1)
for i in range(409):
    value1 = i * 10
    value2 = 4095 - i * 10
    robot.SetAuxAO(0, value1, True)
    robot.SetAuxAO(1, value2, True)
    robot.SetAuxAO(2, value1, True)
    robot.SetAuxAO(3, value2, True)
    time.sleep(0.01)
robot.SetAuxDIFilterTime(10)
robot.SetAuxAIFilterTime(0, 10)
for i in range(20):
    curValue = False
    error, curValue = robot.GetAuxDI(i, False)  # 注意:如库内部需引用方式,这里需修改
    print(f"DI{i}   {curValue}")
curValue = -1
for i in range(4):
    error, curValue = robot.GetAuxAI(i, True)  # 同样注意引用传参问题
    print(f"AI{i}   {curValue}")
robot.WaitAuxDI(1, False, 1000, False)
robot.WaitAuxAI(1, 1, 132, 1000, False)
robot.CloseRPC()

13.56. Removable Device Enable

New in version python: SDK-v2.0.5

Prototype

TractorEnable(enable)

description

removable device enable

Mandatory parameters

  • enable: enable state, 0-de-enable, 1-enable

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

13.57. Zeroing of removable units

New in version python: SDK-v2.0.5

Prototype

TractorHoming()

Description

Removable unit back to zero

Mandatory parameters

NULL

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

13.58. Movable unit linear motion

New in version python: SDK-v2.0.5

Prototype

TractorMoveL(distance, vel)

Description

Movable device linear motion

Mandatory parameters

  • distance: distance of linear movement (mm)

  • vel: percentage of linear motion speed (0-100)

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

13.59. Movable unit circular motion

New in version python: SDK-v2.0.5

prototype

TractorMoveC(radio, angle, vel)

Description

Movable device circular motion

Mandatory parameters

  • radio: radius of circular motion (mm)

  • angle: angle of circular motion (°)

  • vel: Percentage of speed of circular motion (0-100)

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

13.60. Stopping motion of movable devices

New in version python: SDK-v2.0.5

Prototype

ProgramStop()

Description

Movable unit stops moving

Mandatory parameters

NULL

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

13.61. Portable device code example

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.ExtDevSetUDPComParam("192.168.58.2", 2021, 2, 50, 5, 50, 1, 50, 10, 1)
robot.ExtDevLoadUDPDriver()
rtn = robot.ExtAxisServoOn(1, 1)
rtn = robot.ExtAxisServoOn(2, 1)
time.sleep(2)
robot.ExtAxisSetHoming(1, 0, 10, 2)
time.sleep(2)
rtn = robot.ExtAxisSetHoming(2, 0, 10, 2)
time.sleep(4)
robot.ExtAxisParamConfig(1, 0, 0, 50000, -50000, 1000, 1000, 6.280, 16384, 200, 0, 0, 0)
robot.ExtAxisParamConfig(2, 0, 0, 50000, -50000, 1000, 1000, 6.280, 16384, 200, 0, 0, 0)
robot.SetAxisDHParaConfig(5, 0, 0, 0, 0, 0, 0, 0, 0)
robot.TractorEnable(False)
time.sleep(2)
robot.TractorEnable(True)
time.sleep(2)
robot.TractorHoming()
time.sleep(2)
robot.TractorMoveL(100, 2)
time.sleep(5)
robot.TractorStop()
robot.TractorMoveL(-100, 20)
time.sleep(5)
robot.TractorMoveC(300, 90, 20)
time.sleep(10)
robot.TractorMoveC(300, -90, 20)
time.sleep(1)
robot.CloseRPC()

13.62. Laser sensor recording points

New in version python: SDK-v2.1.4

Prototype

LaserRecordPoint(coordID)

Description

Laser sensor recording points

Mandatory par

  • coordID:Laser sensor coordinate system

Default param

NULL

Return Value

  • Error Code Success-0 Failure- errcode

  • joint:The laser sensor identifies the position of the point joint

  • desc:The laser sensor identifies the Cartesian position of the point

  • exaxis:The laser sensor identifies the extended axis position of the point

13.63. Sample code for laser sensor recording points

New in version python: SDK-v2.1.4

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')
direction_point = [0, 0, 0]
rtn = robot.LaserTrackingSearchStart(2, direction_point, 10, 100, 10000, 2)
print(f"LaserTrackingSearchStart rtn is {rtn}")
robot.LaserTrackingSearchStop()
coord_id = 2
rtn, joint, desc, exaxis = robot.LaserRecordPoint(coord_id)
print(f"rtn is {rtn}")
print(f"desc_pos:{desc[0]},{desc[1]},{desc[2]},"
      f"{desc[3]},{desc[4]},{desc[5]}")
print(f"joint_pos:{joint[0]},{joint[1]},{joint[2]},{joint[3]},{joint[4]},{joint[5]}")
print(f"exaxis pos is {exaxis[0]} {exaxis[1]} {exaxis[2]} {exaxis[3]}")
off = [0] * 6
robot.MoveJ(joint,tool=1,user=0,vel=100,acc=100,ovl=50,exaxis_pos=exaxis,blendT=-1,offset_flag=0,offset_pos=off)
robot.CloseRPC()

13.64. Set the synchronous movement strategy of the extended axis and the robot

New in version python: SDK-v2.1.5

Prototype

SetExAxisRobotPlan(strategy)

Description

Set the synchronous movement strategy of the extended axis and the robot

Mandatory par

  • strategy:Strategy; 0- Mainly robots; 1- The extended axis is synchronized with the robot

Default param

NULL

Return Value

Error Code Success-0 Failure- errcode

13.65. Code example for setting the synchronous motion strategy of the extended axis and the robot

New in version python: SDK-v2.1.5

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')
joint_pos1 = [-22.016, -49.217, 124.714, -161.100, -85.108, -0.333]
joint_pos2 = [-21.083, -46.613, 110.079, -147.796, -80.757, -0.330]
joint_pos3 = [-25.572, -60.090, 135.397, -163.889, -82.489, -0.345]
desc_pos1 = [2.637, -0.001, 30.673, 178.786, -4.134, 68.326]
desc_pos2 = [213.812, -1.440, 47.311, 177.410, 0.166, 68.946]
desc_pos3 = [444.342, -12.723, 82.470, -177.701, -1.325, 65.151]
epos1 = [0.001, 0.000, 0.000, 0.000]
epos2 = [299.977, 0.000, 0.000, 0.000]
epos3 = [399.969, 0.000, 0.000, 0.000]
offset_pos = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
rtn = robot.SetExAxisRobotPlan(0)
print(f"SetExAxisRobotPlan rtn is {rtn}")
time.sleep(1)
rtn = robot.ExtAxisSyncMoveL(desc_pos=desc_pos1,tool=1,user=0,vel=100,acc=100,ovl=100,blendR=-1,exaxis_pos=epos1,offset_flag=0,offset_pos=offset_pos)
print(f"ExtAxisSyncMoveL 1 rtn is {rtn}")
rtn = robot.ExtAxisSyncMoveL(desc_pos=desc_pos2,tool=1,user=0,vel=100,acc=100,ovl=100,blendR=-1,exaxis_pos=epos2,offset_flag=0,offset_pos=offset_pos)
print(f"ExtAxisSyncMoveL 2 rtn is {rtn}")
rtn = robot.ExtAxisSyncMoveL(desc_pos=desc_pos3,tool=1,user=0,vel=100,acc=100,ovl=100,blendR=-1,exaxis_pos=epos3,offset_flag=0,offset_pos=offset_pos)
print(f"ExtAxisSyncMoveL 3 rtn is {rtn}")
time.sleep(8)
robot.CloseRPC()

13.66. Control array type sucker

New in version python: SDK-v2.1.5

Prototype

SetSuckerCtrl(slaveID, len, ctrlValue)

Description

Control array type sucker

Mandatory par

  • slaveID:Slave station number

  • len:length

  • ctrlValue:Control value 1- Suction according to the maximum vacuum degree 2- suction according to the set vacuum degree 3- stop suction

Default param

NULL

Return Value

Error Code Success-0 Failure- errcode

13.67. Get the state of the array suction cup

New in version python: SDK-v2.1.5

Prototype

GetSuckerState(slaveID)

Description

Get the state of the array suction cup

Mandatory par

  • slaveID:Slave station number

Default param

NULL

Return Value

  • Error Code Success-0 Failure- errcode

  • state:Adsorption state 0 -released object 1 -successful adsorption of the workpiece was detected 2 -no adsorption to the object 3 -object detachment

  • pressValue:The current vacuum is in kpa

  • error:The current error code for the sucker

13.68. Wait for the sucker state

New in version python: SDK-v2.1.5

Prototype

WaitSuckerState(slaveID, state, ms)

Description

Wait for the sucker state

Mandatory par

  • slaveID:Slave station number

  • state:Adsorption state 0 -released object 1 -successful adsorption of the workpiece was detected 2 -no adsorption to the object 3 -object detachment

  • ms:Maximum waiting time

Default param

NULL

Return Value

Error Code Success-0 Failure- errcode

13.69. Array type sucker control command code example

New in version python: SDK-v2.1.5

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("C://Project/PeripheralSDK/CtrlDev_sucker.lua")
time.sleep(2)
robot.UnloadCtrlOpenLUA(1)
robot.LoadCtrlOpenLUA(1)
time.sleep(1)
ctrl = bytearray(20)
ctrl[0] = 1
robot.SetSuckerCtrl(0, 1, ctrl)
for i in range(100):
    rtn, state, press_value, error = robot.GetSuckerState(1)
    print(f"sucker1 state is {state}, pressValue is {press_value}, error num is {error}")
    rtn, state, press_value, error = robot.GetSuckerState(12)
    print(f"sucker12 state is {state}, pressValue is {press_value}, error num is {error}")
    time.sleep(0.1)
ret = robot.WaitSuckerState(1, 1, 100)
print(f"WaitSuckerState result is {ret}")
ctrl[0] = 3
robot.SetSuckerCtrl(1, 1, ctrl)
robot.SetSuckerCtrl(12, 1, ctrl)
robot.CloseRPC()

13.70. Upload an open protocol Lua file

New in version python: SDK-v2.1.5

Prototype

OpenLuaUpload(filePath)

Description

Upload an open protocol Lua file

Mandatory par

  • filePath:Local open protocol lua file path name

Default param

NULL

Return Value

Error Code Success-0 Failure- errcode

13.71. Get the slave board parameters

New in version python: SDK-v2.1.5

Prototype

GetFieldBusConfig()

Description

Get the slave board parameters

Mandatory par

NULL

Default param

NULL

Return Value

  • Error Code Success-0 Failure- errcode

  • type:0-Ethercat,1-CClink, 3-Ethercat, 4-EIP

  • version:Protocol version

  • connState:0- Not connected 1- Connected

13.72. Write the slave DO

New in version python: SDK-v2.1.5

Prototype

FieldBusSlaveWriteDO(DOIndex, wirteNum, status)

Description

Write the slave DO

Mandatory par

  • DOIndex:DO number

  • wirteNum:Number of writes

  • status:The number to write, up to 8

Default param

NULL

Return Value

Error Code Success-0 Failure- errcode

13.73. Write the slave AO

New in version python: SDK-v2.1.5

Prototype

FieldBusSlaveWriteAO(AOIndex, wirteNum, status)

Description

Write the slave AO

Mandatory par

  • AOIndex:AO number

  • wirteNum:Number of writes

  • status:The number to write, up to 8

Default param

NULL

Return Value

Error Code Success-0 Failure- errcode

13.74. Read the slave DI

New in version python: SDK-v2.1.5

Prototype

FieldBusSlaveReadDI(DOIndex, readeNum)

Description

Read the slave DI

Mandatory par

  • DOIndex:DI number

  • readeNum:Number of reads

Default param

NULL

Return Value

  • Error Code Success-0 Failure- errcode

  • status[8]:Read a maximum of 8 values

13.75. Read the slave AI

New in version python: SDK-v2.1.5

Prototype

FieldBusSlaveReadAI(AOIndex, readeNum)

Description

Read the slave AI

Mandatory par

  • AOIndex:AI number

  • readeNum:Number of reads

Default param

NULL

Return Value

  • Error Code Success-0 Failure- errcode

  • status[8]:Read a maximum of 8 values

13.76. Wait for the extension DI input

New in version python: SDK-v2.1.5

Prototype

FieldBusSlaveWaitDI(DIIndex, status, waitMs)

Description

Wait for the extension DI input

Mandatory par

  • DIIndex:DI number

  • status:0- low level; 1- High level

  • waitMs:Maximum waiting time (ms)

Default param

NULL

Return Value

Error Code Success-0 Failure- errcode

13.77. Wait for extended AI input

New in version python: SDK-v2.1.5

Prototype

FieldBusSlaveWaitAI(AIIndex, waitType, value, waitMs)

Description

Wait for extended AI input

Mandatory par

  • AIIndex:AI number

  • waitType:0- greater than; 1- less than

  • value:AI value

  • waitMs:Maximum waiting time (ms)

Default param

NULL

Return Value

Error Code Success-0 Failure- errcode

13.78. Example of slave mode related interface instruction code

New in version python: SDK-v2.1.5

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/Peripheral_equipment/CtrlDev_field.lua")
time.sleep(2)
robot.SetCtrlOpenLUAName(3,"CtrlDev_field.lua")
robot.UnloadCtrlOpenLUA(3)
robot.LoadCtrlOpenLUA(3)
time.sleep(8)
rtn,type, version, conn_state = robot.GetFieldBusConfig()
print(f"type is {type}, version is {version}, connState is {conn_state}")
# Write digital outputs
ctrl = [1, 0, 1]  # DO0=1, DO1=0, DO2=1
robot.FieldBusSlaveWriteDO(0, 3, ctrl)
# Write analog output
ctrl_ao = [0x1000]  # AO2 = 0x1000
robot.FieldBusSlaveWriteAO(2, 1, ctrl_ao)
for i in range(100):
    rtn,di = robot.FieldBusSlaveReadDI(0, 4)
    print(f"DI0 is {di[0]}, DI1 is {di[1]}, DI2 is {di[2]}, DI3 is {di[3]}")
    rtn, ai = robot.FieldBusSlaveReadAI(0, 3)
    print(f"AI0 is {ai[0]}, AI1 is {ai[1]}, AI2 is {ai[2]}")
    time.sleep(0.01)
ret = robot.FieldBusSlaveWaitDI(0, 1, 100)
print(f"FieldBusSlaveWaitDI result is {ret}")
ret = robot.FieldBusSlaveWaitAI(0, 0, 400.00, 100)
print(f"FieldBusSlaveWaitAI result is {ret}")
robot.CloseRPC()

robotic arm
Orange FAIRINO wordmark with U.S_edited.png

Contact

Location: 10637 Scripps Summit Court,

San Diego, CA. 92131
Phone: (619) 333-FAIR (3247)
Email: hello@fairino.us

© 2023 Fairino US official site created By G2T

bottom of page