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(String[] keygen)
16.2. Issue SCP command
New in version Java: SDK-v1.0.6-3.8.3
1/**
2* @brief Issue SCP command
3* @param [in] mode 0-upload (host->controller), 1-download (controller->host)
4* @param [in] sshname Host username
5* @param [in] sship Host IP address
6* @param [in] usr_file_url Host 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 MD5 value of specified file
1/**
2* @brief Calculate MD5 value of specified file
3* @param [in] file_path File path including filename, default Traj folder path:"/fruser/traj/", e.g. "/fruser/traj/trajHelix_aima_1.txt"
4* @param [out] md5 File MD5 value
5* @return Error code
6*/
7int ComputeFileMD5(String file_path, String[] md5)
16.4. Robot SSH and MD5 command code example
1public static int TestSSHMd5(Robot robot)
2{
3 String file_path= "/fruser/airlab.lua";
4 String[] md5 =new String[]{""};
5
6 String[] ssh_keygen=new String[]{""};
7 int retval = robot.GetSSHKeygen(ssh_keygen);
8 System.out.println(ssh_keygen[0]);
9
10 String ssh_name = "fr";
11 String ssh_ip = "192.168.58.45";
12 String ssh_route = "/home/fr";
13 String ssh_robot_url = "/root/robot/dhpara.config";
14 retval = robot.SetSSHScpCmd(1, ssh_name, ssh_ip, ssh_route, ssh_robot_url);
15 System.out.println("SetSSHScpCmd retval is:"+ retval);
16 System.out.println("robot url is:"+ ssh_robot_url);
17
18 robot.ComputeFileMD5(file_path, md5);
19 System.out.println("md5 is:+"+ md5[0]);
20 return 0;
21}
16.5. Set robot port 20004 feedback period
1/**
2* @brief Set robot port 20004 feedback period
3* @param [in] period Robot port 20004 feedback period(ms)
4* @return Error code
5*/
6public int SetRobotRealtimeStateSamplePeriod(int period)
16.6. Get robot port 20004 feedback period
1/**
2* @brief Get robot port 20004 feedback period
3* @return List[0]:Error code; List[1]:Robot port 20004 feedback period(ms)
4*/
5public List<Integer> GetRobotRealtimeStateSamplePeriod()
16.7. Robot port 20004 status feedback period configuration example
1public static int TestRealtimePeriod(Robot robot)
2{
3 robot.SetRobotRealtimeStateSamplePeriod(10);
4 List<Integer> getPeriod = new ArrayList<>();
5 getPeriod=robot.GetRobotRealtimeStateSamplePeriod();
6 robot.Sleep(1000);
7
8 return 0;
9}
16.8. Robot software upgrade
1/**
2 * @brief Robot software upgrade
3 * @param [in] filePath Full path of software upgrade package
4 * @param [in] block Whether to block until upgrade completes true:block; false:non-block
5 * @return Error code
6 */
7public int SoftwareUpgrade(String filePath, boolean block)
16.9. Get robot software upgrade status
1/**
2* @brief Get robot software upgrade status
3* @return List[0]:Error code; List[1]:Robot software upgrade status 0-idle or uploading upgrade package; 1~100: upgrade completion percentage; -1:upgrade failed; -2:verification failed; -3:version verification failed; -4:decompression 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*/
5public List<Integer> GetSoftwareUpgradeState()
16.10. Robot software upgrade code example
1public static int TestUpgrade(Robot robot)
2{
3 robot.SoftwareUpgrade("D://zUP/QNX382/software.tar.gz", false);
4 while (true)
5 {
6 List<Integer> inter=new ArrayList<>();
7 inter=robot.GetSoftwareUpgradeState();
8 System.out.println("upgrade state is:"+ inter.get(1));
9 robot.Sleep(300);
10 }
11}
16.11. Download point table database
1/**
2* @brief Download point table database
3* @param [in] pointTableName Point table name to download pointTable1.db
4* @param [in] saveFilePath Storage path for downloaded point table C://test/
5* @return Error code
6*/
7int PointTableDownLoad(String pointTableName, String saveFilePath);
16.12. Upload point table database
1/**
2* @brief Upload point table database
3* @param [in] pointTableFilePath Full path name of point table to upload C://test/pointTable1.db
4* @return Error code
5*/
6int PointTableUpLoad(String pointTableFilePath);
16.13. Point table update lua file
1/**
2* @brief Point table update lua file
3* @param [in] pointTableName Point table name to switch to "pointTable1.db", when empty "", means updating lua program to initial program without applied point table
4* @param [in] luaFileName Lua file name to update "testPointTable.lua"
5* @param [out] errorStr Point table switching error message
6* @return Error code
7*/
8int PointTableUpdateLua(String pointTableName, String luaFileName, String errorStr);
16.14. Robot point table operation code example
1public static int TestPointTable(Robot robot)
2{
3 String save_path = "D://zDOWN/";
4 String point_table_name = "point_table_FR5.db";
5 int rtn = robot.PointTableDownLoad(point_table_name, save_path);
6
7 String upload_path = "D://zUP/point_table_FR5.db";
8 rtn = robot.PointTableUpLoad(upload_path);
9
10 String point_tablename = "point_table_FR5.db";
11 String lua_name = "airlab.lua";
12 String err="";
13 rtn = robot.PointTableUpdateLua(point_tablename, lua_name,err);
14
15 robot.CloseRPC();
16 return 0;
17}
16.15. Controller log download
New in version Java: SDK-v1.0.4-3.8.1
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.16. All data source download
New in version Java: SDK-v1.0.4-3.8.1
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.17. Data backup package download
New in version Java: SDK-v1.0.4-3.8.1
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.18. Download controller data code example
1public static int TestDownLoadRobotData(Robot robot)
2{
3 int rtn = robot.RbLogDownload("D://zDOWN/");
4
5 rtn = robot.AllDataSourceDownload("D://zDOWN/");
6
7 rtn = robot.DataPackageDownload("D://zDOWN/");
8 return 0;
9}
16.19. Set Encoder Upgrade
New in version Java: SDK-v1.0.7-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.20. Set Joint Firmware Upgrade
New in version Java: SDK-v1.0.7-3.8.4
1/**
2* @brief Set joint firmware upgrade
3* @param [in] type Upgrade file type: 1-Firmware upgrade; 2-Slave configuration file upgrade
4* @param [in] path Full local upgrade package path (D://zUP/XXXXX.bin)
5* @return Error code
6*/
7public int SetJointFirmwareUpgrade(int type, String path)
16.21. Set Controller Firmware Upgrade
New in version Java: SDK-v1.0.7-3.8.4
1/**
2* @brief Set controller firmware upgrade
3* @param [in] type Upgrade file type: 1-Firmware upgrade; 2-Slave configuration file upgrade
4* @param [in] path Full local upgrade package path (D://zUP/XXXXX.bin)
5* @return Error code
6*/
7public int SetCtrlFirmwareUpgrade(int type, String path)
16.22. Set End-Effector Firmware Upgrade
New in version Java: SDK-v1.0.7-3.8.4
1/**
2* @brief Set end-effector firmware upgrade
3* @param [in] type Upgrade file type: 1-Firmware upgrade; 2-Slave configuration file upgrade
4* @param [in] path Full local upgrade package path (D://zUP/XXXXX.bin)
5* @return Error code
6*/
7public int SetEndFirmwareUpgrade(int type, String path)
16.23. Joint Complete Parameter Configuration Upgrade
New in version Java: SDK-v1.0.7-3.8.4
1/**
2* @brief Joint complete parameter configuration upgrade
3* @param [in] path Full local upgrade package path (D://zUP/XXXXX.bin)
4* @return Error code
5*/
6public int JointAllParamUpgrade(String path)
16.24. Robot Slave Firmware Upgrade Code Example
1public static void TestFirmWareUpgrade(Robot robot)
2{
3 robot.RobotEnable(0);
4 robot.Sleep(200);
5 int rtn = robot.JointAllParamUpgrade("D://zUP/standardQX/jointallparametersFR56.0.db");
6 System.out.println("robot JointAllParamUpgrade rtn is:"+ rtn);
7
8 rtn = robot.SetCtrlFirmwareUpgrade(2, "D://zUP/upgrade/FAIR_Cobot_Cbd_Asix_V2.0.bin");
9 System.out.println("robot SetCtrlFirmwareUpgrade config param rtn is:"+ rtn);
10
11 rtn = robot.SetEndFirmwareUpgrade(2, "D://zUP/upgrade/FAIR_Cobot_Axle_Asix_V2.4.bin");
12 System.out.println("robot SetEndFirmwareUpgrade config param rtn is:"+ rtn);
13
14 robot.SetSysServoBootMode();
15 rtn = robot.SetCtrlFirmwareUpgrade(1, "D://zUP/standardQX/FR_CTRL_PRIMCU_FV201010_MAIN_U4_T01_20240529.bin");
16 System.out.println("robot SetCtrlFirmwareUpgrade rtn is:"+ rtn);
17
18 rtn = robot.SetEndFirmwareUpgrade(1, "D://zUP/standardQX/FR_END_FV201010_MAIN_U01_T01_20250522.bin");
19 System.out.println("robot SetEndFirmwareUpgrade rtn is:"+ rtn);
20
21 rtn = robot.SetJointFirmwareUpgrade(1, "D://zUP/standardQX/FR_SERVO_FV502211_MAIN_U7_T07_20250217.bin");
22 System.out.println("robot SetJointFirmwareUpgrade rtn is:"+ rtn);
23
24 robot.CloseRPC();
25}
16.25. Robot Operating System Upgrade (LA Control Box)
New in version Java: SDK-v1.0.9-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.26. Get Robot Operating System Upgrade Result (LA Control Box)
New in version Java: SDK-v1.0.9-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(int[] result)
16.27. Robot MCU Log Generation
1/**
2* @brief Robot MCU log generation
3* @return Error code
4*/
5public int RobotMCULogCollect()
16.28. 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 portID Port number 0-8080; 1-8083; 2-20002; 3-20004
4* @param enable 0-disable; 1-enable
5* @param confirmTime Communication disconnection confirmation duration (ms)[0-5000]
6* @return Error code
7*/
8public int SetRobotStopOnComDisc(int portID, bool enable, int confirmTime)
16.29. Get Robot Stop on Communication Disconnection Parameters
1/**
2* @brief Get robot stop on communication disconnection parameters
3* @param portID Port number 0-8080; 1-8083; 2-20002; 3-20004
4* @param enable Result array, index 0: 0-disable; 1-enable
5* @param confirmTime Result array, index 0: Communication disconnection confirmation duration (ms)[0-5000]
6* @return Error code
7*/
8public int GetRobotStopOnComDisc(int portID, int[] enable, int[] confirmTime)
16.30. Robot Stop on Communication Disconnection Parameter Code Example
1void TestRobotStopOnComDisc(Robot robot)
2{
3 int[] enable = {0};
4 int[] confirmTime = {0};
5 int rtn = 0;
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 System.out.printf("SetRobotStopOnComDisc %d\n", rtn);
11
12 robot.GetRobotStopOnComDisc(0, enable, confirmTime);
13 System.out.printf("GetRobotStopOnComDisc 8080 rtn %d; enable is %d; confirm time is %d\n", rtn, enable[0], confirmTime[0]);
14 robot.GetRobotStopOnComDisc(1, enable, confirmTime);
15 System.out.printf("GetRobotStopOnComDisc 8083 rtn %d; enable is %d; confirm time is %d\n", rtn, enable[0], confirmTime[0]);
16 robot.GetRobotStopOnComDisc(2, enable, confirmTime);
17 System.out.printf("GetRobotStopOnComDisc 20002 rtn %d; enable is %d; confirm time is %d\n", rtn, enable[0], confirmTime[0]);
18 robot.GetRobotStopOnComDisc(3, enable, confirmTime);
19 System.out.printf("GetRobotStopOnComDisc 20004 rtn %d; enable is %d; confirm time is %d\n", rtn, enable[0], confirmTime[0]);
20
21 return;
22}
16.31. Send UDP Instruction Frame
1/**
2* @brief Send UDP instruction frame
3* @param frame Instruction frame
4* @return Error code
5*/
6public int SendUDPFrame(String frame)
16.32. SDK Code Example for UDP Communication
1public static void TestRobotUDP (Robot robot) {
2 robot.udpCmdClient.SetUDPCmdRpyCallback((srcType, count, cmdID, dataLen, content) -> {
3 System.out.println("\n[Received robot UDP response]");
4 System.out.println("srcType: " + srcType);
5 System.out.println("count: " + count);
6 System.out.println("cmdID: " + cmdID);
7 System.out.println("dataLen: " + dataLen);
8 System.out.println("content: " + content);
9 return 0;
10 });
11 // Send frame
12 String frameToSend = "/f/bIII52III236III7IIIMode(1)III/b/f";
13 robot.SendUDPFrame(frameToSend);
14 robot.Sleep(2000);
15 frameToSend = "/f/bIII52III236III7IIIMode(0)III/b/f";
16 robot.SendUDPFrame(frameToSend);
17 robot.Sleep(2000);
18 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";
19 robot.SendUDPFrame(frameToSend);
20 robot.Sleep(2000);
21 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";
22 robot.SendUDPFrame(frameToSend);
23 robot.Sleep(2000);
24 frameToSend = "/f/bIII47III400III15IIIGetMCVersion(1)III/b/f/f/bIII48III424III21IIIGetSlaveFirmVersion()III/b/f";
25 robot.SendUDPFrame(frameToSend);
26 robot.Sleep(2000);
27}
16.33. Set User-Defined Robot End-Effector LED Color
1/**
2* @brief Set user-defined robot end-effector LED color
3* @param r End red LED control; 0-off; 1-on
4* @param g End green LED control; 0-off; 1-on
5* @param b End blue LED control; 0-off; 1-on
6* @return Error code
7*/
8public int SetUserLEDColor(bool r, bool g, bool b)
16.34. SDK Code Example for Setting User-Defined Robot End-Effector LED Color
1public void testled(robot)
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}