16. Others

16.1. Get SSH public key

Prototype

GetSSHKeygen()

description

Get SSH public key

Mandatory parameters

NULL

Default parameters

NULL

Return Value

  • errorcode Success-0 Failure- errcode

  • keygen: public key

16.2. Issue the SCP command

New in version python: SDK-v2.1.3

Prototype

SetSSHScpCmd(mode, sshname, sship, usr_file_url, robot_file_url)

Description

Issue the SCP command

Mandatory parameters

  • mode: 0- Upload (Host Computer -> Controller), 1- Download (Controller -> Host Computer

  • sshname: User name of the upper computer

  • sship: The ip address of the upper computer

  • usr_file_url: File path of the upper computer

  • robot_file_url: Robot controller file path

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

16.3. Calculate the MD5 value of a file in a specified path

Prototype

ComputeFileMD5(file_path)

Description

Calculates the MD5 value of a file in the specified path.

Mandatory parameter

  • file_path: file path including filename, default Traj folder path is :/fruser/traj/, e.g. /fruser/traj/trajHelix_aima_1.txt

Default parameters

NULL

Return Value

  • errorcode Success-0 Failure- errcode

  • md5: the MD5 value of the file.

16.4. Robot SSH, MD5 instruction code example

 1from fairino import Robot
 2import time
 3# Establish a connection with the robot controller and return a robot object if the connection is successful
 4robot = Robot.RPC('192.168.58.2')
 5file_path = "/fruser/airlab.lua"
 6md5 = ""
 7emerg_state = 0
 8si0_state = 0
 9si1_state = 0
10sdk_com_state = 0
11ssh_keygen = ""
12retval,ssh_keygen = robot.GetSSHKeygen()
13print(f"GetSSHKeygen retval is: {retval}")
14print(f"ssh key is: {ssh_keygen}")
15ssh_name = "fr"
16ssh_ip = "192.168.58.45"
17ssh_route = "/home/fr"
18ssh_robot_url = "/root/robot/dhpara.config"
19retval = robot.SetSSHScpCmd(1, ssh_name, ssh_ip, ssh_route, ssh_robot_url)
20print(f"SetSSHScpCmd retval is: {retval}")
21print(f"robot url is: {ssh_robot_url}")
22error, md5 = robot.ComputeFileMD5(file_path)
23print(f"md5 is: {md5}")
24robot.CloseRPC()

16.5. Setting the Robot 20004 Port Feedback Cycle

New in version python: SDK-v2.0.5

Prototype

SetRobotRealtimeStateSamplePeriod(period)

Description

Setting the robot 20004 port feedback cycle

Mandatory parameter

  • period: robot 20004 port feedback period (ms)

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

16.6. Get robot 20004 port feedback cycle

New in version python: SDK-v2.0.5

Prototype

GetRobotRealtimeStateSamplePeriod()

Description

Get robot 20004 port feedback cycle

Mandatory parameters

NULL

Default parameters

NULL

Return Value

  • errorcode Success-0 Failure- errcode

  • period: robot 20004 port feedback period (ms)

16.7. Robot 20004 port state feedback cycle configuration code example

1from fairino import Robot
2import time
3# Establish a connection with the robot controller and return a robot object if the connection is successful
4robot = Robot.RPC('192.168.58.2')
5robot.SetRobotRealtimeStateSamplePeriod(10)
6error,getPeriod = robot.GetRobotRealtimeStateSamplePeriod()
7print(f"period is {getPeriod}")
8time.sleep(1)
9robot.CloseRPC()

16.8. Robot software upgrade

New in version python: SDK-v2.0.5

Prototype

SoftwareUpgrade(filePath, block)

Description

Robot Software Upgrade

Required parameters

  • filePath: full path of the software upgrade package

  • block: whether to block until the upgrade is complete true:blocking; false:non-blocking

Default parameters

NULL

Return Value

  • errcode Success-0 Failure- errcode

16.9. Get robot software upgrade status

New in version python: SDK-v2.0.5

Prototype

GetSoftwareUpgradeState()

Description

Get robot software upgrade status

Mandatory parameters

NULL

Default parameters

NULL

Return Value

  • errorcode Success-0 Failure- errcode

  • state: robot package upgrade status, 0: idle in progress or uploading upgrade package in progress, 1~100: percentage of upgrade completed, -1: upgrade software failure, -2: checksum failure, -3: version checksum failure, -4: unpacking failure, -5: user configuration upgrade failure, -6: peripheral configuration upgrade failure, -7: extended axis configuration upgrade failure, -8: robot configuration upgrade failure, -9: DH parameter configuration upgrade failure

16.10. Robot software upgrade code example

 1from fairino import Robot
 2import time
 3# Establish a connection with the robot controller and return a robot object if the connection is successful
 4robot = Robot.RPC('192.168.58.2')
 5error = robot.SoftwareUpgrade("D://zUP/QNX382/software.tar.gz", False)
 6print(f"SoftwareUpgrade error is {error}")
 7while True:
 8    curState = robot.GetSoftwareUpgradeState()
 9    print(f"upgrade state is {curState}")
10    time.sleep(3)
11robot.CloseRPC()

16.11. Download Point Table Database

New in version python: SDK-v2.0.1

Prototype

PointTableDownLoad(point_table_name, save_file_path)

Description

Download Points Table Database

Required Parameters

  • point_table_name: name of the point table to be downloaded pointTable1.db;

  • save_file_path: storage path to download the point table C://test/;

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

16.12. Upload point table database

New in version python: SDK-v2.0.1

Prototype

PointTableUpLoad(point_table_file_path)

Description

Upload point table database

Required Parameters

  • point_table_file_path: full pathname of uploaded point table C://test/pointTable1.db

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

16.13. Point table update lua file

New in version python: SDK-v2.0.1

prototype

PointTableUpdateLua(point_table_name, lua_file_name)

Description

Point table update lua file

Required Parameters

  • point_table_name: the name of the point table to be switched, pointTable1.db, when the point table is empty, i.e. “, it means updating the lua program to the initial program with no point table applied

  • lua_file_name: name of the lua file to update testPointTable.lua

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

16.14. Robot point table operation code example

 1from fairino import Robot
 2# Establish a connection with the robot controller and return a robot object if the connection is successful
 3robot = Robot.RPC('192.168.58.2')
 4save_path = "D://zDOWN/"
 5point_table_name = "point_table_FR5.db"
 6rtn = robot.PointTableDownLoad(point_table_name, save_path)
 7print(f"download : {point_table_name} fail: {rtn}")
 8upload_path = "D://zDOWN/point_table_FR5.db"
 9rtn = robot.PointTableUpLoad(upload_path)
10print(f"retval is: {rtn}")
11point_tablename = "point_table_FR5.db"
12lua_name = "test0610.lua"
13rtn,error = robot.PointTableUpdateLua(point_tablename, lua_name)
14print(f"retval is: {rtn}")
15robot.CloseRPC()

16.15. Controller log download

New in version python: SDK-v2.1.1

Prototype

RbLogDownload(savePath)

Description

Controller log download

Mandatory parameters

  • savePath: Save the file path D://zDown/

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

16.16. Download all data sources

New in version python: SDK-v2.1.1

Prototype

AllDataSourceDownload(savePath)

Description

Download all data sources

Mandatory parameters

  • savePath: Save the file path D://zDown/

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

16.17. Data backup package download

New in version python: SDK-v2.1.1

Prototype

DataPackageDownload(savePath)

Description

Data backup package download

Mandatory parameters

  • savePath: Save the file path D://zDown/

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

16.18. Download the controller data code example

 1from fairino import Robot
 2import time
 3# Establish a connection with the robot controller and return a robot object if the connection is successful
 4robot = Robot.RPC('192.168.58.2')
 5rtn = robot.RbLogDownload("D://zDOWN/")
 6print(f"RbLogDownload rtn is {rtn}")
 7rtn = robot.AllDataSourceDownload("D://zDOWN/")
 8print(f"AllDataSourceDownload rtn is {rtn}")
 9rtn = robot.DataPackageDownload("D://zDOWN/")
10print(f"DataPackageDownload rtn is {rtn}")
11robot.CloseRPC()

16.19. Set up encoder upgrade

New in version python: SDK-v2.1.4

Prototype

SetEncoderUpgrade(path)

Description

Set up encoder upgrade

Mandatory parameters

  • path:Local upgrade package full path(D://zUP/XXXXX.bin)

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

16.20. Set up joint firmware upgrade

New in version python: SDK-v2.1.4

Prototype

SetJointFirmwareUpgrade(type, path)

Description

Set up joint firmware upgrade

Mandatory parameters

  • type:Updating file types 1- Upgrade firmware; 2- Upgrade the slave profile

  • path:Local upgrade package full path(D://zUP/XXXXX.bin)

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

16.21. Set up control box firmware upgrade

New in version python: SDK-v2.1.4

Prototype

SetCtrlFirmwareUpgrade(type, path)

Description

Set up control box firmware upgrade

Mandatory parameters

  • type:Updating file types 1- Upgrade firmware; 2- Upgrade the slave profile

  • path:Local upgrade package full path(D://zUP/XXXXX.bin)

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

16.22. Set up the end firmware upgrade

New in version python: SDK-v2.1.4

Prototype

SetEndFirmwareUpgrade(type, path)

Description

Set up the end firmware upgrade

Mandatory parameters

  • type:Updating file types 1- Upgrade firmware; 2- Upgrade the slave profile

  • path:Local upgrade package full path(D://zUP/XXXXX.bin)

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

16.23. Joint full parameter profile upgrade

New in version python: SDK-v2.1.4

Prototype

JointAllParamUpgrade(path)

Description

Joint full parameter profile upgrade

Mandatory parameters

  • path:Local upgrade package full path(D://zUP/XXXXX.bin)

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

16.24. Example of robot slave firmware upgrade code

 1from fairino import Robot
 2import time
 3# Establish a connection with the robot controller and return a robot object if the connection is successful
 4robot = Robot.RPC('192.168.58.2')
 5robot.RobotEnable(0)
 6time.sleep(0.2)
 7rtn = robot.JointAllParamUpgrade("D://zUP/MT/joint0603/jointallparameters.db")
 8print(f"robot JointAllParamUpgrade rtn is {rtn}")
 9rtn = robot.SetCtrlFirmwareUpgrade(2, "D://zUP/MT/FAIR_Cobot_Cbd_Asix_V2.0.bin")
10print(f"robot SetCtrlFirmwareUpgrade rtn is {rtn}")
11rtn = robot.SetEndFirmwareUpgrade(2, "D://zUP/MT/FAIR_Cobot_Axle_Asix_V2.4.bin")
12print(f"robot SetEndFirmwareUpgrade rtn is {rtn}")
13robot.SetSysServoBootMode()
14time.sleep(0.2)
15rtn = robot.SetCtrlFirmwareUpgrade(1, "D://zUP/MT/FR_CTRL_PRIMCU_FV201412_MAIN_U4_T01_20250630(MT).bin")
16print(f"robot SetCtrlFirmwareUpgrade rtn is {rtn}")
17rtn = robot.SetEndFirmwareUpgrade(1, "D://zUP/MT/FR_END_FV2010010_MAIN_U1_T01_20250603.bin")
18print(f"robot SetEndFirmwareUpgrade rtn is {rtn}")
19rtn = robot.SetJointFirmwareUpgrade(1, "D://zUP/MT/FR_SERVO_FV504215_MAIN_U7_T07_20250603.bin")
20print(f"robot SetJointFirmwareUpgrade rtn is {rtn}")
21robot.CloseRPC()

16.25. Robot Operating System upgrade (LA control box)

New in version python: SDK-v2.1.6

Prototype

KernelUpgrade(filePath)

Description

Robot Operating System upgrade (LA control box)

Mandatory parameters

  • filePath:Operating system upgrade package full path

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

16.26. Obtain upgrade results of robot operating system (LA control box)

New in version python: SDK-v2.1.6

Prototype

GetKernelUpgradeResult()

Description

Obtain upgrade results of robot operating system (LA control box)

Mandatory parameters

NULL

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

16.27. Robot MCU log generation

New in version python: SDK-v2.1.7

Prototype

RobotMCULogCollect()

Description

Robot MCU log generation

Mandatory parameters

NULL

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

16.28. Set Robot to Stop Running When Port Communication is Disconnected

Prototype

SetRobotStopOnComDisc(portID, enable, confirmTime)

Description

Set robot to stop running when port communication is disconnected

Required Parameters

  • portID: Port number 0-8080; 1-8083; 2-20002; 3-20004

  • enable: 0-disable; 1-enable

  • confirmTime: Communication disconnection confirmation duration (ms)[0-5000]

Default Parameters

None

Return Value

Error code Success-0 Failure-errcode

16.29. Get Robot Stop on Communication Disconnection Parameters

Prototype

GetRobotStopOnComDisc(portID)

Description

Get robot stop on communication disconnection parameters

Required Parameters

  • portID: Port number 0-8080; 1-8083; 2-20002; 3-20004

  • enable: 0-disable; 1-enable

  • confirmTime: Communication disconnection confirmation duration (ms)[0-5000]

Default Parameters

None

Return Value

Error code Success-0 Failure-errcode

16.30. Robot Stop on Communication Disconnection Parameter Code Example

 1from time import sleep
 2import time
 3from fairino import Robot
 4# Establish connection with robot controller
 5robot = Robot.RPC('192.168.58.2')
 6
 7def test_robot_stop_on_com_disc(self):
 8    # Initialize parameters
 9    enable = False
10    confirm_time = 0
11
12    # Set robot stop on communication disconnection
13    rtn = robot.SetRobotStopOnComDisc(0, True, 330)
14    print(f"SetRobotStopOnComDisc index0: {rtn}")
15
16    rtn = robot.SetRobotStopOnComDisc(1, True, 550)
17    print(f"SetRobotStopOnComDisc index1: {rtn}")
18
19    rtn = robot.SetRobotStopOnComDisc(2, True, 110)
20    print(f"SetRobotStopOnComDisc index2: {rtn}")
21
22    rtn = robot.SetRobotStopOnComDisc(3, True, 220)
23    print(f"SetRobotStopOnComDisc index3: {rtn}")
24
25    # Get robot stop on communication disconnection settings
26    rtn, enable, confirm_time = robot.GetRobotStopOnComDisc(0)
27    print(f"GetRobotStopOnComDisc 8080 rtn {rtn}; enable is {enable}; confirm time is {confirm_time}")
28
29    rtn, enable, confirm_time = robot.GetRobotStopOnComDisc(1)
30    print(f"GetRobotStopOnComDisc 80803 rtn {rtn}; enable is {enable}; confirm time is {confirm_time}")
31
32    rtn, enable, confirm_time = robot.GetRobotStopOnComDisc(2)
33    print(f"GetRobotStopOnComDisc 20002 rtn {rtn}; enable is {enable}; confirm time is {confirm_time}")
34
35    rtn, enable, confirm_time = robot.GetRobotStopOnComDisc(3)
36    print(f"GetRobotStopOnComDisc 20004 rtn {rtn}; enable is {enable}; confirm time is {confirm_time}")
37
38    # Close RPC connection
39    robot.CloseRPC()
40    return 0
41
42test_robot_stop_on_com_disc(robot)

16.31. Send UDP Instruction Frame

Prototype

SendUDPFrame(frame)

Description

Send UDP instruction frame

Required Parameters

  • frame: UDP data to send, transparent transmission, no encapsulation

Default Parameters

None

Return Value

Error code Success-0 Failure-errcode

16.32. UDP Communication-Based SDK Code Example

 1from time import sleep
 2import time
 3from fairino import Robot
 4
 5# Establish connection with robot controller
 6robot = Robot.RPC('192.168.58.2')
 7
 8def TestSendUDPFrame(self):
 9    # Set callback
10    def callback(src_type, count, cmd_id, data_len, content):
11        print("Received reply: cmd_id={} count={} data_len={} content={}".format(cmd_id, count, data_len, content))
12        return 0
13    robot.SetUDPCmdRpyCallback(callback)
14
15    rtn = robot.SendUDPFrame("/f/bIII20III303III7IIIMode(0)III/b/f")
16    print(f"SendUDPFrame Mode(0) rtn is {rtn}")
17    time.sleep(1)
18
19    rtn = robot.SendUDPFrame("/f/bIII21III303III7IIIMode(1)III/b/f")
20    print(f"SendUDPFrame Mode(1) rtn is {rtn}")
21    time.sleep(1)
22
23    rtn = robot.SendUDPFrame(
24        "/f/bIII49III201III184IIIMoveJ(-15.625, -82.680, 101.654, -110.950, -88.290, 0.017, -383.012, -2.325, 242.655, -178.024, 1.710, 74.416, 0, 0, 100, 100, 100, 0.000, 0.000, 0.000, 0.000, -1, 0, 0, 0, 0, 0, 0, 0)III/b/f")
25    print(f"SendUDPFrame MoveJ(-15.625) rtn is {rtn}")
26    time.sleep(1)
27
28    rtn = robot.SendUDPFrame(
29        "/f/bIII48III203III199IIIMoveL(-75.622, -82.680, 101.654, -110.950, -88.290, 0.017, -193.537, 330.525, 242.657, -178.024, 1.710, 14.420, 0, 0, 100, 100, 100, -1, 0, 0.000, 0.000, 0.000, 0.000, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0)III/b/f")
30    print(f"SendUDPFrame MoveL(-75.622) rtn is {rtn}")
31    time.sleep(1)
32
33    rtn = robot.SendUDPFrame("/f/bIII4III905III20IIIGetSoftwareVersion()III/b/f")
34    print(f"SendUDPFrame GetSoftwareVersion() rtn is {rtn}")
35
36    time.sleep(1)
37
38    # Send UDP frame data validation test
39    rtn = robot.SendUDPFrame("/f/bIII20III303III7IIIMode(0)III/b/f")
40    print(f"SendUDPFrame rtn is {rtn}")
41
42    rtn = robot.SendUDPFrame("III20III303III7IIIMode(0)III/b/f")
43    print(f"SendUDPFrame rtn is {rtn}")
44
45    rtn = robot.SendUDPFrame("/f/bIII20III303III7IIIMode(0)")
46    print(f"SendUDPFrame rtn is {rtn}")
47
48    rtn = robot.SendUDPFrame("/f/bIII20III303III6IIIMode(0)III/b/f")
49    print(f"SendUDPFrame rtn is {rtn}")
50
51    rtn = robot.SendUDPFrame("/f/b|||20|||303|||7|||Mode(0)|||/b/f")
52    print(f"SendUDPFrame rtn is {rtn}")
53
54    rtn = robot.SendUDPFrame("/f/bII20II303II7IIMode(0)II/b/f")
55    print(f"SendUDPFrame rtn is {rtn}")
56
57    robot.CloseRPC()
58    time.sleep(1)
59
60TestSendUDPFrame(robot)

16.33. Set User-Defined Robot End-Effector LED Color

Prototype

SetUserLEDColor(r, g, b)

Description

Set user-defined robot end-effector LED color

Required Parameters

  • r: End red LED control; 0-off; 1-on

  • g: End green LED control; 0-off; 1-on

  • b: End blue LED control; 0-off; 1-on

Default Parameters

None

Return Value

Error code Success-0 Failure-errcode

16.34. SDK Code Example for Setting User-Defined Robot End-Effector LED Color

 1from time import sleep
 2import time
 3from fairino import Robot
 4
 5# Establish connection with robot controller
 6robot = Robot.RPC('192.168.58.2')
 7
 8
 9def testled(self):
10    # Set user LED color
11    # Parameter order: R, G, B (Red, Green, Blue)
12
13    # White (all lights on)
14    robot.SetUserLEDColor(True, True, True)
15    time.sleep(1)
16
17    # Turn off all lights
18    robot.SetUserLEDColor(False, False, False)
19    time.sleep(1)
20
21    # Red (red light only)
22    robot.SetUserLEDColor(True, False, False)
23    time.sleep(1)
24
25    # Green (green light only)
26    robot.SetUserLEDColor(False, True, False)
27    time.sleep(1)
28
29    # Blue (blue light only)
30    robot.SetUserLEDColor(False, False, True)
31
32    # Close connection
33    robot.CloseRPC()
34
35testled(robot)