top of page

Python 5.11. Obtain the DO output status at the end of the robot

Prototype

GetToolDO()

Description

Obtain the DO output status at the end of the robot

Mandatory parameters

NULL

Default Parameters

NULL

Return Value

  • errorcode Success-0 Failure- errcode

  • do_state: DO output status: do0 to do1 correspond to bit1 to bit2, starting from bit0

5.12. Obtain the DO output status of the robot controller

Prototype

GetDO()

Description

Obtain the DO output status of the robot controller

Mandatory parameters

NULL

Default Parameters

NULL

Return Value

  • errorcode Success-0 Failure- errcode

  • do_state_h: DO output status: co0 to co7 correspond to bit0 to bit7. do_state_l DO output status: do0 to do7 correspond to bit0 to bit7

5.13. Get the robot DI, DO status 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')
block = 0
error,di = robot.GetDI(0, block)
print(f"di0: {di}")
error,tool_di = robot.GetToolDI(1, block)
print(f"tool_di1: {tool_di}")
error,ai = robot.GetAI(0, block)
print(f"ai0: {ai:.2f}")
error,tool_ai = robot.GetToolAI(0, block)
print(f"tool_ai0: {tool_ai:.2f}")
error,button_state = robot.GetAxlePointRecordBtnState()
print(f"_button_state is: {button_state}")
error,tool_do_state = robot.GetToolDO()
print(f"tool DO state: {tool_do_state}")
error,[do_state_h, do_state_l] = robot.GetDO()
print(f"DO state hight  : {do_state_h}")
print(f"DO state low : {do_state_l}")
robot.CloseRPC()

5.14. Waiting for control box digital inputs

prototype

WaitDI(id,status,maxtime,opt)

Description

Waiting for control box digital input

Mandatory parameters

  • id: io number, range [0~15];

  • status: 0-off, 1-on;

  • maxtime: maximum waiting time in [ms];

  • opt: post timeout policy, 0-program stops and prompts for timeout, 1-ignore timeout prompts program to continue execution, 2-always wait

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

5.15. Waiting for control box with multiple digital inputs

prototype

WaitMultiDI(mode,id,status,maxtime,opt)

Description

Waiting for control box with multiple digital inputs

Mandatory parameters

  • mode: [0]-multiple with, [1]-multiple or;

  • id: io number, bit0~bit7 correspond to DI0~DI7, bit8~bit15 correspond to CI0~CI7;

  • status: bit0~bit7 corresponds to DI0~DI7 status, bit8~bit15 corresponds to the status of CI0~CI7 status bits [0]-off, [1]-on;

  • maxtime: maximum waiting time in [ms];

  • opt: post-timeout policy, 0-program stops and prompts for timeout, 1-ignores timeout prompting program to continue execution, 2-always waits.

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

5.16. Waiting for tool digital inputs

prototype

WaitToolDI(id,status,maxtime,opt)

Description

Waiting for end digital input

Mandatory parameters

  • id: io number, range [0~1];

  • status: 0-off, 1-on;

  • maxtime: maximum waiting time in [ms];

  • opt: post timeout policy, 0-program stops and prompts for timeout, 1-ignore timeout prompts program to continue execution, 2-always wait

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

5.17. Waiting for control box analog inputs

prototype

WaitAI(id,sign,value,maxtime,opt)

Description

Waiting for control box analog input

Mandatory parameters

  • id: io number, range [0~1];

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

  • value: percentage of input current or voltage value, range [0~100] corresponding to current value [0~20mA] or voltage [0~10V];

  • maxtime: maximum waiting time in [ms];

  • opt: post timeout policy, 0-program stops and prompts for timeout, 1-ignore timeout prompts program to continue execution, 2-always wait

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

5.18. Waiting for tool analog inputs

prototype

WaitToolAI(id,sign,value,maxtime,opt)

Description

Waiting for end analog input

Mandatory parameters

  • id: io number, range [0];

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

  • value: percentage of input current or voltage value, range [0~100] corresponding to current value [0~20mA] or voltage [0~10V];

  • maxtime: maximum waiting time in [ms];

  • opt: post timeout policy, 0-program stops and prompts for timeout, 1-ignore timeout prompts program to continue execution, 2-always wait

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

5.19. Waiting control box digital, analog input signal 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')
status = 1
smooth = 0
block = 0
for i in range(16):
    robot.SetDO(i, status, smooth, block)
    time.sleep(0.3)
status = 0
for i in range(16):
    robot.SetDO(i, status, smooth, block)
    time.sleep(0.3)
status = 1
for i in range(2):
    robot.SetToolDO(i, status, smooth, block)
    time.sleep(1)
status = 0
for i in range(2):
    robot.SetToolDO(i, status, smooth, block)
    time.sleep(1)
for i in range(100):
    robot.SetAO(0, i, block)
    time.sleep(0.03)
for i in range(100):
    robot.SetToolAO(0, i, block)
    time.sleep(0.03)
block = 0
error,di = robot.GetDI(0, block)
print(f"di0: {di}")
error,tool_di = robot.GetToolDI(1, block)
print(f"tool_di1: {tool_di}")
error,ai = robot.GetAI(0, block)
print(f"ai0: {ai:.2f}")
error,tool_ai = robot.GetToolAI(0, block)
print(f"tool_ai0: {tool_ai:.2f}")
error,button_state = robot.GetAxlePointRecordBtnState()
print(f"_button_state is: {button_state}")
error,tool_do_state = robot.GetToolDO()
print(f"tool DO state: {tool_do_state}")
error,[do_state_h, do_state_l] = robot.GetDO()
print(f"DO state hight  : {do_state_h}")
print(f"DO state low : {do_state_l}")
rtn = robot.WaitDI(0110001)
print(f"WaitDI over; rtn is: {rtn}")
rtn = robot.WaitMultiDI(13310001)
print(f"WaitDI over; rtn is: {rtn}")
rtn = robot.WaitToolDI(1110001)
print(f"WaitDI over; rtn is: {rtn}")
rtn = robot.WaitAI(005010001)
print(f"WaitDI over; rtn is: {rtn}")
rtn = robot.WaitToolAI(005010001)
print(f"WaitDI over; rtn is: {rtn}")
robot.CloseRPC()

5.20. Set Whether Control Box DO Output Resets After Stop/Pause

New in version python: SDK-v2.0.5

Prototype

SetOutputResetCtlBoxDO(resetFlag,reloadFlag)

Description

Set whether control box DO output resets after stop/pause

Required Parameters

  • resetFlag:0-Do not reset; 1-Reset

  • reloadFlag:Whether to reload after pause resume, 0-Do not load; 1-Load

Default Parameters

None

Return Value

Error code Success-0 Failure- errcode

5.21. Set Whether Control Box AO Output Resets After Stop/Pause

New in version python: SDK-v2.0.5

Prototype

SetOutputResetCtlBoxAO(resetFlag,reloadFlag)

Description

Set whether control box AO output resets after stop/pause

Required Parameters

  • resetFlag:0-Do not reset; 1-Reset

  • reloadFlag:Whether to reload after pause resume, 0-Do not load; 1-Load

Default Parameters

None

Return Value

Error code Success-0 Failure- errcode

5.22. Set Whether End Tool DO Output Resets After Stop/Pause

New in version python: SDK-v2.0.5

Prototype

SetOutputResetAxleDO(resetFlag,reloadFlag)

Description

Set whether end tool DO output resets after stop/pause

Required Parameters

  • resetFlag:0-Do not reset; 1-Reset

  • reloadFlag:Whether to reload after pause resume, 0-Do not load; 1-Load

Default Parameters

None

Return Value

Error code Success-0 Failure- errcode

5.23. Set Whether End Tool AO Output Resets After Stop/Pause

New in version python: SDK-v2.0.5

Prototype

SetOutputResetAxleAO(resetFlag,reloadFlag)

Description

Set whether end tool AO output resets after stop/pause

Required Parameters

  • resetFlag:0-Do not reset; 1-Reset

  • reloadFlag:Whether to reload after pause resume, 0-Do not load; 1-Load

Default Parameters

None

Return Value

Error code Success-0 Failure- errcode

5.24. Set Whether Extended DO Output Resets After Stop/Pause

New in version python: SDK-v2.0.5

Prototype

SetOutputResetExtDO (resetFlag,reloadFlag)

Description

Set whether extended DO output resets after stop/pause

Required Parameters

  • resetFlag:0-Do not reset; 1-Reset

  • reloadFlag:Whether to reload after pause resume, 0-Do not load; 1-Load

Default Parameters

None

Return Value

Error code Success-0 Failure- errcode

5.25. Set Whether Extended AO Output Resets After Stop/Pause

New in version python: SDK-v2.0.5

Prototype

SetOutputResetExtAO (resetFlag,reloadFlag)

Description

Set whether extended AO output resets after stop/pause

Required Parameters

  • resetFlag:0-Do not reset; 1-Reset

  • reloadFlag:Whether to reload after pause resume, 0-Do not load; 1-Load

Default Parameters

None

Return Value

Error code Success-0 Failure- errcode

5.26. Set Whether SmartTool Output Resets After Stop/Pause

New in version python: SDK-v2.0.5

Prototype

SetOutputResetSmartToolDO(resetFlag,reloadFlag)

Description

Set whether SmartTool output resets after stop/pause

Required Parameters

  • resetFlag:0-Do not reset; 1-Reset

  • reloadFlag:Whether to reload after pause resume, 0-Do not load; 1-Load

Default Parameters

None

Return Value

Error code Success-0 Failure- errcode

5.27. Code Example for Setting Output Reset After Lua Program Stop/Pause

from fairino import Robot
import time
robot = Robot.RPC('192.168.58.2')
for i in range(16):
    robot.SetDO(i, 100)
    time.sleep(0.2)
resetFlag = 0
resumeReloadFlag = 0
rtn = robot.SetOutputResetCtlBoxDO(resetFlag, resumeReloadFlag)
robot.SetOutputResetCtlBoxAO(resetFlag, resumeReloadFlag)
robot.SetOutputResetAxleDO(resetFlag, resumeReloadFlag)
robot.SetOutputResetAxleAO(resetFlag, resumeReloadFlag)
robot.SetOutputResetExtDO(resetFlag, resumeReloadFlag)
robot.SetOutputResetExtAO(resetFlag, resumeReloadFlag)
robot.SetOutputResetSmartToolDO(resetFlag, resumeReloadFlag)
robot.ProgramLoad("/fruser/test.lua")
robot.ProgramRun()
time.sleep(2)
robot.PauseMotion()
time.sleep(2)
robot.ResumeMotion()
time.sleep(2)
robot.CloseRPC()
return 0

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