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, TrueFalseTrue)
    time.sleep(0.1)
for i in range(128):
    robot.SetAuxDO(i, FalseFalseTrue)
    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(010)
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(1False1000False)
robot.WaitAuxAI(111321000False)
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"2021250550150101)
robot.ExtDevLoadUDPDriver()
rtn = robot.ExtAxisServoOn(11)
rtn = robot.ExtAxisServoOn(21)
time.sleep(2)
robot.ExtAxisSetHoming(10102)
time.sleep(2)
rtn = robot.ExtAxisSetHoming(20102)
time.sleep(4)
robot.ExtAxisParamConfig(10050000-50000100010006.28016384200000)
robot.ExtAxisParamConfig(20050000-50000100010006.28016384200000)
robot.SetAxisDHParaConfig(500000000)
robot.TractorEnable(False)
time.sleep(2)
robot.TractorEnable(True)
time.sleep(2)
robot.TractorHoming()
time.sleep(2)
robot.TractorMoveL(1002)
time.sleep(5)
robot.TractorStop()
robot.TractorMoveL(-10020)
time.sleep(5)
robot.TractorMoveC(3009020)
time.sleep(10)
robot.TractorMoveC(300-9020)
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 = [000]
rtn = robot.LaserTrackingSearchStart(2, direction_point, 10100100002)
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.217124.714-161.100-85.108-0.333]
joint_pos2 = [-21.083-46.613110.079-147.796-80.757-0.330]
joint_pos3 = [-25.572-60.090135.397-163.889-82.489-0.345]
desc_pos1 = [2.637-0.00130.673178.786-4.13468.326]
desc_pos2 = [213.812-1.44047.311177.4100.16668.946]
desc_pos3 = [444.342-12.72382.470-177.701-1.32565.151]
epos1 = [0.0010.0000.0000.000]
epos2 = [299.9770.0000.0000.000]
epos3 = [399.9690.0000.0000.000]
offset_pos = [0.00.00.00.00.00.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(01, 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(11100)
print(f"WaitSuckerState result is {ret}")
ctrl[0= 3
robot.SetSuckerCtrl(11, ctrl)
robot.SetSuckerCtrl(121, 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 = [101]  # DO0=1, DO1=0, DO2=1
robot.FieldBusSlaveWriteDO(03, ctrl)
# Write analog output
ctrl_ao = [0x1000]  # AO2 = 0x1000
robot.FieldBusSlaveWriteAO(21, ctrl_ao)
for i in range(100):
    rtn,di = robot.FieldBusSlaveReadDI(04)
    print(f"DI0 is {di[0]}, DI1 is {di[1]}, DI2 is {di[2]}, DI3 is {di[3]}")
    rtn, ai = robot.FieldBusSlaveReadAI(03)
    print(f"AI0 is {ai[0]}, AI1 is {ai[1]}, AI2 is {ai[2]}")
    time.sleep(0.01)
ret = robot.FieldBusSlaveWaitDI(01100)
print(f"FieldBusSlaveWaitDI result is {ret}")
ret = robot.FieldBusSlaveWaitAI(00400.00100)
print(f"FieldBusSlaveWaitAI result is {ret}")
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