10.1. Setting the default job program to load automatically on boot
Prototype | LoadDefaultProgConfig(flag,program_name) |
Description | Sets the default job program to be automatically loaded on boot |
Required parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
10.2. Load the specified job program
Prototype | ProgramLoad(program_name) |
Description | Load the specified job program. |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
10.3. Get the name of the loaded job program
Prototype | GetLoadedProgram() |
Description | Get the name of the loaded job program |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value |
|
10.4. Get the line number of the current robot job program
Prototype | GetCurrentLine() |
Description | Get the execution line number of the current robot job program |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value |
|
10.5. Run the currently loaded job program
Prototype | ProgramRun() |
Description | Run the currently loaded job program |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
10.6. Suspend the currently running job program
Prototype | ProgramPause() |
Description | Suspend the currently running job program. |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
10.7. Resuming a currently suspended program
Prototype | ProgramResume() |
Description | Resume the currently suspended job program |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
10.8. Terminate the currently running job program
Prototype | ProgramStop() |
Description | Terminate the currently running job program. |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
10.9. Obtaining robot job program execution status
Prototype | GetProgramState() |
Description | Get robot job program execution status |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value |
|
10.10. Robot LUA program operation 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')
program_name = "/fruser/test0610.lua"
loaded_name = ""
state = 0
line = 0
robot.Mode(0)
robot.LoadDefaultProgConfig(0, program_name)
robot.ProgramLoad(program_name)
robot.ProgramRun()
time.sleep(1)
robot.ProgramPause()
error,state = robot.GetProgramState()
print(f"program state:{state}")
error,line = robot.GetCurrentLine()
print(f"current line:{line}")
error,loaded_name = robot.GetLoadedProgram()
print(f"program name:{loaded_name}")
time.sleep(1)
robot.ProgramResume()
time.sleep(1)
robot.ProgramStop()
time.sleep(1)
robot.CloseRPC()
10.11. Download Lua files
New in version python: SDK-v2.0.2
Prototype | LuaDownLoad(fileName, savePath) |
Description | Download Lua File |
Mandatory parameter |
|
| e.g. “D://Down/”” |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
10.12. Deleting Lua files
New in version python: SDK-v2.0.2
Prototype | LuaDelete(fileName) |
Description | Deleting Lua files. |
Required Parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
10.13. Get the names of all current lua files
New in version python: SDK-v2.0.2
Prototype | GetLuaList() |
Description | Get the names of all current lua files |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value |
|
10.14. Uploading Lua files
New in version python: SDK-v2.0.2
Prototype | LuaUpload(filePath) |
Description | Uploading a Lua file |
Mandatory parameter |
|
Default parameters | NULL |
Return Value |
|
10.15. Robot LUA file upload and download code examples
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')
rtn,lua_num,luaNames = robot.GetLuaList()
print(f"res is:{rtn}")
print(f"size is:{lua_num}")
for name in luaNames:
print(name)
rtn = robot.LuaDownLoad("test0610.lua", "D://zDOWN/")
print(f"LuaDownLoad rtn is:{rtn}")
rtn = robot.LuaUpload("D://zDOWN/test0610.lua")
print(f"LuaUpload rtn is:{rtn}")
rtn = robot.LuaDelete("test0610.lua")
print(f"LuaDelete rtn is:{rtn}")
robot.CloseRPC()