16. Other interfaces
16.1. Get SSH public key
1/**
2* @brief Get SSH public key
3* @param [out] keygen Public key
4* @return Error code
5*/
6int GetSSHKeygen(ref string keygen);
16.2. Send SCP command
New in version C#SDK-V1.1.4: Web-3.8.3
1/**
2* @brief Send SCP command
3* @param [in] mode 0-Upload (host computer -> controller), 1-Download (controller -> host computer)
4* @param [in] sshname Host computer username
5* @param [in] sship Host computer IP address
6* @param [in] usr_file_url Host computer file path
7* @param [in] robot_file_url Robot controller file path
8* @return Error code
9*/
10int SetSSHScpCmd(int mode, string sshname, string sship, string usr_file_url, string robot_file_url);
16.3. Calculate the MD5 value of a file in a specified path
1/**
2* @brief Calculate the MD5 value of a file in the specified path
3* @param [in] file_path File path including file name, default Traj folder path is "/fruser/traj/", such as "/fruser/traj/trajHelix_aima_1.txt"
4* @param [out] md5 The MD5 value of the file
5* @return Error code
6*/
7int ComputeFileMD5(string file_path, ref string md5);
16.4. Robot SSH and MD5 command code example
New in version C#SDK-V1.1.4: Web-3.8.3
1private void button46_Click(object sender, EventArgs e)
2{
3 string file_path = "/fruser/airlab.lua";
4 string md5 = "";
5 byte emerg_state = 0;
6 byte si0_state = 0;
7 byte si1_state = 0;
8 int sdk_com_state = 0;
9
10 string ssh_keygen = "";
11 int retval = robot.GetSSHKeygen(ref ssh_keygen);
12 Console.WriteLine("GetSSHKeygen retval is: {0}", retval);
13 Console.WriteLine("ssh key is: {0}", ssh_keygen);
14
15 string ssh_name = "fr";
16 string ssh_ip = "192.168.58.45";
17 string ssh_route = "/home/fr";
18 string ssh_robot_url = "/root/robot/dhpara.config";
19 retval = robot.SetSSHScpCmd(1, ssh_name, ssh_ip, ssh_route, ssh_robot_url);
20 Console.WriteLine("SetSSHScpCmd retval is: {0}", retval);
21 Console.WriteLine("robot url is: {0}", ssh_robot_url);
22
23 robot.ComputeFileMD5(file_path, ref md5);
24 Console.WriteLine("md5 is: {0}", md5);
25}
16.5. Set robot 20004 port feedback cycle
1/**
2* @brief Set the robot's 20004 port feedback period
3* @param [in] period Robot's 20004 port feedback period (ms)
4* @return Error code
5*/
6int SetRobotRealtimeStateSamplePeriod(int period);
16.6. Get the robot’s 20004 port feedback period
1/**
2* @brief Get the feedback period for robot port 20004
3* @param [out] period Feedback period for robot port 20004 (ms)
4* @return Error code
5*/
6int GetRobotRealtimeStateSamplePeriod((ref int period);
16.7. Robot 20004 port status feedback period configuration code example
1private void button47_Click(object sender, EventArgs e)
2{
3 robot.SetRobotRealtimeStateSamplePeriod(10);
4 int getPeriod = 0;
5 robot.GetRobotRealtimeStateSamplePeriod(ref getPeriod);
6 Console.WriteLine("period is {0}", getPeriod);
7 Thread.Sleep(1000);
8}
16.8. Robot Software Upgrade
1/**
2* @brief Robot software upgrade
3* @param [in] filePath Full path of the software upgrade package
4* @param [in] block Whether to block until the upgrade is complete true: block; false: non-blocking
5* @return Error code
6*/
7int SoftwareUpgrade(string filePath, bool block);
16.9. Get robot software upgrade status
1/**
2* @brief Get robot software upgrade status
3* @param [out] state Robot software package upgrade status 0-idle or uploading upgrade package; 1~100: upgrade completion percentage; -1: upgrade software failed; -2: verification failed; -3: Version verification failed; -4: Unzipping failed; -5: User configuration upgrade failed; -6: Peripheral configuration upgrade failed; -7: Extended axis configuration upgrade failed; -8: Robot configuration upgrade failed; -9: DH parameter configuration upgrade failed
4* @return Error code
5*/
6int GetSoftwareUpgradeState(ref int state);
16.10. Robot software upgrade code example
1private void button48_Click(object sender, EventArgs e)
2{
3 robot.SoftwareUpgrade("D://zUP/QNX382/software.tar.gz", false);
4 while (true)
5 {
6 int curState = -1;
7 robot.GetSoftwareUpgradeState(ref curState);
8 Console.WriteLine("upgrade state is {0}", curState);
9 Thread.Sleep(300);
10 }
11}
16.11. Download point table
1/**
2* @brief Download the point table from the robot controller to the local computer
3* @param [in] pointTableName The name of the point table in the controller: pointTable1.db
4* @param [in] saveFilePath The path where the point table is downloaded to the computer: C://test/
5* @return Error code
6*/
7int PointTableDownLoad(string pointTableName, string saveFilePath);
16.12. Upload point table
1/**
2* @brief Upload the point table from the local computer to the robot controller
3* @param [in] pointTableFilePath The absolute path of the point table on the local computer C://test/pointTable1.db
4* @return Error code
5*/
6int PointTableUpLoad(string pointTableFilePath);
16.13. Point Table Update Lua Program
1/**
2* @brief Use the given point table to update the points in the Lua program
3* @param [in] pointTableName The name of the point table in the controller: "pointTable1.db". When the point table is empty (i.e., ""), it indicates that the Lua program will be updated to the initial program without applying the point table.
4* @param [in] luaFileName The name of the Lua file to be updated: "test.lua"
5* @param [out] errorStr Error message for updating the point table in Lua
6* @return Error code
7*/
8int PointTableUpdateLua(string pointTableName, string luaFileName, ref string errorStr);
16.14. Switch point tables and apply
1/**
2* @brief Switch point table and apply
3* @param [in] pointTableName Name of the point table to switch to "pointTable1.db"
4* @param [out] errorStr Error message for switching point tables
5* @return Error code
6*/
7int PointTableSwitch(string pointTableName, ref string errorStr);
16.15. Robot point table operation code example
1private void btnUpload_Click(object sender, EventArgs e)
2{
3 string save_path = "D://zDOWN/";
4 string point_table_name = "test_point_A.db";
5 int rtn = robot.PointTableDownLoad(point_table_name, save_path);
6 Console.WriteLine("download : {0} fail: {1}", point_table_name, rtn);
7
8 string upload_path = "D://zUP/test_point_A.db";
9 rtn = robot.PointTableUpLoad(upload_path);
10 Console.WriteLine("retval is: {0}", rtn);
11
12 string point_tablename = "test_point_A.db";
13 string lua_name = "Text1.lua";
14
15 string errorStr = "";
16 rtn = robot.PointTableUpdateLua(point_tablename, lua_name, ref errorStr);
17 Console.WriteLine("retval is: {0}", rtn);
18}
16.16. Controller log download
1/**
2* @brief Controller log download
3* @param [in] savePath Save file path "D://zDown/"
4* @return Error code
5*/
6int RbLogDownload(string savePath);
16.17. All Data Source Download
1/**
2* @brief All Data Source Download
3* @param [in] savePath Save file path "D://zDown/"
4* @return Error code
5*/
6int AllDataSourceDownload(string savePath);
16.18. Data backup package download
1/**
2* @brief Data backup package download
3* @param [in] savePath Save file path "D://zDown/"
4* @return Error code
5*/
6int DataPackageDownload(string savePath);
16.19. Download controller data code example
1private void button50_Click(object sender, EventArgs e)
2{
3 int rtn = robot.RbLogDownload("D://zDOWN/");
4 Console.WriteLine("RbLogDownload rtn is {0}", rtn);
5
6 rtn = robot.AllDataSourceDownload("D://zDOWN/");
7 Console.WriteLine("AllDataSourceDownload rtn is {0}", rtn);
8
9 rtn = robot.DataPackageDownload("D://zDOWN/");
10 Console.WriteLine("DataPackageDownload rtn is {0}", rtn);
11}
16.20. Robot Operating System Upgrade (LA Control Box)
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2 * @brief Robot Operating System Upgrade (LA Control Box)
3 * @param [in] filePath Full path of the operating system upgrade package
4 * @return Error code
5 */
6public int KernelUpgrade(string filePath)
16.21. Get Robot Operating System Upgrade Result (LA Control Box)
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2 * @brief Get Robot Operating System Upgrade Result (LA Control Box)
3 * @param [out] result Upgrade result: 0: Success; -1: Failure
4 * @return Error code
5 */
6public int GetKernelUpgradeResult(ref int[] result)
16.22. Set encoder upgrade
New in version C#SDK-V1.1.5: Web-3.8.4
1/**
2* @brief Set encoder upgrade
3* @param [in] path Full local upgrade package path (D://zUP/XXXXX.bin)
4* @return Error code
5*/
6int SetEncoderUpgrade(string path);
16.23. Set joint firmware upgrade
New in version C#SDK-V1.1.5: Web-3.8.4
1/**
2* @brief Set joint firmware upgrade
3* @param [in] type Upgrade file type; 1 - Upgrade firmware; 2 - Upgrade slave configuration file
4* @param [in] path Full local upgrade package path (D://zUP/XXXXX.bin)
5* @return Error code
6*/
7int SetJointFirmwareUpgrade(int type, string path);
16.24. Set firmware upgrade for control box
New in version C#SDK-V1.1.5: Web-3.8.4
1/**
2* @brief Set firmware upgrade for control box
3* @param [in] type Type of upgrade file; 1 - Upgrade firmware; 2 - Upgrade slave station configuration file
4* @param [in] path Full local upgrade package path (D://zUP/XXXXX.bin)
5* @return Error code
6*/
7int SetCtrlFirmwareUpgrade(int type, string path);
16.25. Set end firmware upgrade
New in version C#SDK-V1.1.5: Web-3.8.4
1/**
2* @brief Set end firmware upgrade
3* @param [in] type Upgrade file type; 1 - Upgrade firmware; 2 - Upgrade slave configuration file
4* @param [in] path Full local upgrade package path (D://zUP/XXXXX.bin)
5* @return Error code
6*/
7int SetEndFirmwareUpgrade(int type, string path);
16.26. Upgrade of the joint full parameter configuration file
New in version C#SDK-V1.1.5: Web-3.8.4
1/**
2* @brief Upgrade of the joint full parameter configuration file
3* @param [in] path Full local upgrade package path (D://zUP/XXXXX.bin)
4* @return Error code
5*/
6int JointAllParamUpgrade(string path);
16.27. Example of upgrading code for robot from firmware
New in version C#SDK-V1.1.5: Web-3.8.4
1private void button83_Click(object sender, EventArgs e)
2{
3 robot.RobotEnable(0);
4 Thread.Sleep(200);
5 int rtn = robot.JointAllParamUpgrade("D://zUP/upgrade/jointallparameters.db");
6 Console.WriteLine($"robot JointAllParamUpgrade rtn is{rtn}");
7 rtn = robot.SetCtrlFirmwareUpgrade(2, "D://zUP/upgrade/FAIR_Cobot_Cbd_Asix_V2.0.bin");
8 Console.WriteLine($"robot SetCtrlFirmwareUpgrade rtn is{rtn}");
9 rtn = robot.SetEndFirmwareUpgrade(2, "D://zUP/upgrade/FAIR_Cobot_Axle_Asix_V2.4.bin");
10 Console.WriteLine($"robot SetEndFirmwareUpgrade rtn is {rtn}");
11 robot.SetSysServoBootMode();
12 rtn = robot.SetCtrlFirmwareUpgrade(1, "D://zUP/upgrade/FR_CTRL_PRIMCU_FV201212_MAIN_U4_T01_20250428(MT).bin");
13 Console.WriteLine($"robot SetCtrlFirmwareUpgrade rtn is{rtn}");
14 rtn = robot.SetEndFirmwareUpgrade(1, "D://zUP/upgrade/FR_END_FV201009_MAIN_U1_T01_20250428.bin");
15 Console.WriteLine($"robot SetEndFirmwareUpgrade rtn is {rtn}");
16 rtn = robot.SetJointFirmwareUpgrade(1, "D://zUP/upgrade/FR_SERVO_FV504214_MAIN_U7_T07_20250519.bin");
17 Console.WriteLine($"robot SetJointFirmwareUpgrade rtn is{rtn}");
18}
16.28. Robot MCU log generation
New in version C#SDK-V1.1.9: Web-3.8.7
1/**
2* @brief Robot MCU log generation
3* @return Error code
4*/
5public int RobotMCULogCollect();
16.29. Set Robot to Stop Running When Port Communication is Disconnected
1/**
2* @brief Set robot to stop running when port communication is disconnected
3* @param [in] portID Port number 0-8080; 1-8083; 2-20002; 3-20004
4* @param [in] enable 0-disable; 1-enable
5* @param [in] confirmTime Communication disconnection confirmation duration (ms)[0-5000]
6* @return Error code
7*/
8public int SetRobotStopOnComDisc(int portID, bool enable, int confirmTime)
16.30. Get Robot Stop on Communication Disconnection Parameters
1/**
2* @brief Get robot stop on communication disconnection parameters
3* @param [in] portID Port number 0-8080; 1-8083; 2-20002; 3-20004
4* @param [out] enable 0-disable; 1-enable
5* @param [out] confirmTime Communication disconnection confirmation duration (ms)[0-5000]
6* @return Error code
7*/
8public int GetRobotStopOnComDisc(int portID, ref bool enable, ref int confirmTime)
16.31. Robot Stop on Communication Disconnection Parameter Code Example
1void TestRobotStopOnComDisc()
2{
3 int rtn = 0;
4
5 // Set parameters for four ports
6 rtn = robot.SetRobotStopOnComDisc(0, true, 330);
7 rtn = robot.SetRobotStopOnComDisc(1, true, 550);
8 rtn = robot.SetRobotStopOnComDisc(2, true, 110);
9 rtn = robot.SetRobotStopOnComDisc(3, true, 220);
10 Console.WriteLine($"SetRobotStopOnComDisc {rtn}");
11
12 bool enable = false;
13 int confirmTime = 0;
14
15 // Get and print settings for each port
16 robot.GetRobotStopOnComDisc(0, ref enable, ref confirmTime);
17 Console.WriteLine($"GetRobotStopOnComDisc 8080 rtn {rtn}; enable is {(enable ? 1 : 0)}; confirm time is {confirmTime}");
18
19 robot.GetRobotStopOnComDisc(1, ref enable, ref confirmTime);
20 Console.WriteLine($"GetRobotStopOnComDisc 8083 rtn {rtn}; enable is {(enable ? 1 : 0)}; confirm time is {confirmTime}");
21
22 robot.GetRobotStopOnComDisc(2, ref enable, ref confirmTime);
23 Console.WriteLine($"GetRobotStopOnComDisc 20002 rtn {rtn}; enable is {(enable ? 1 : 0)}; confirm time is {confirmTime}");
24
25 robot.GetRobotStopOnComDisc(3, ref enable, ref confirmTime);
26 Console.WriteLine($"GetRobotStopOnComDisc 20004 rtn {rtn}; enable is {(enable ? 1 : 0)}; confirm time is {confirmTime}");
27
28}
16.32. Send UDP Instruction Frame
1/**
2* @brief Send UDP instruction frame
3* @param [in] Instruction frame
4* @return Error code
5*/
6public int SendUDPFrame(string frame)
16.33. UDP Communication-Based SDK Code Example
1void TestRobotUDP()
2{
3 robot.OnUdpFrameReceived += (comType, frameCount, frameCmdID, contentLen, content) =>
4 {
5 Console.WriteLine($"[UDP Response] comType={comType}, count={frameCount}, cmdID={frameCmdID}, content={content}");
6 };
7
8
9 //Send frame
10 string frameToSend = "/f/bIII52III236III7IIIMode(1)III/b/f";
11 robot.SendUDPFrame(frameToSend);
12 Thread.Sleep(2000);
13 frameToSend = "/f/bIII52III236III7IIIMode(0)III/b/f";
14 robot.SendUDPFrame(frameToSend);
15 Thread.Sleep(2000);
16 frameToSend = "/f/bIII41III201III153IIIMoveJ(53.857,-89.441,119.453,-22.664,61.059,3.369,-54.249,-491.930,375.396,96.474,-6.896,-7.783,0,0,100,100,100,0.000,0.000,0.000,0.000,-1,0,0,0,0,0,0,0)III/b/f";
17 robot.SendUDPFrame(frameToSend);
18 Thread.Sleep(2000);
19 frameToSend = "/f/bIII42III203III163IIIMoveL(81.736,-85.284,114.974,-23.261,88.746,6.799,125.744,-506.570,375.396,96.474,-6.896,-7.783,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";
20 robot.SendUDPFrame(frameToSend);
21 Thread.Sleep(2000);
22 frameToSend = "/f/bIII47III400III15IIIGetMCVersion(1)III/b/f/f/bIII48III424III21IIIGetSlaveFirmVersion()III/b/f";
23 robot.SendUDPFrame(frameToSend);
24 Thread.Sleep(2000);
25
26}
16.34. Set User-Defined Robot End-Effector LED Color
1/**
2* @brief Set user-defined robot end-effector LED color
3* @param [in] r End red LED control; 0-off; 1-on
4* @param [in] g End green LED control; 0-off; 1-on
5* @param [in] b End blue LED control; 0-off; 1-on
6* @return Error code
7*/
8public int SetUserLEDColor(bool r, bool g, bool b)
16.35. SDK Code Example for Setting User-Defined Robot End-Effector LED Color
1public void testled()
2{
3 robot.SetUserLEDColor(true, true, true);
4 robot.Sleep(1000);
5 robot.SetUserLEDColor(false, false, false);
6 robot.Sleep(1000);
7 robot.SetUserLEDColor(true, false, false);
8 robot.Sleep(1000);
9 robot.SetUserLEDColor(false, true, false);
10 robot.Sleep(1000);
11 robot.SetUserLEDColor(false, false, true);
12}