16. Altre Interfacce

16.1. Ottenere Chiave Pubblica SSH

1/**
2* @brief Ottiene chiave pubblica SSH
3* @param [out] keygen Chiave pubblica
4* @return Codice errore
5*/
6int GetSSHKeygen(String[] keygen)

16.2. Inviare Comando SCP

Nuovo nella versione Java: SDK-v1.0.6-3.8.3

 1/**
 2* @brief Invia comando SCP
 3* @param [in] mode 0-upload (PC -> controller), 1-download (controller -> PC)
 4* @param [in] sshname Nome utente PC
 5* @param [in] sship Indirizzo IP PC
 6* @param [in] usr_file_url Percorso file PC
 7* @param [in] robot_file_url Percorso file controller robot
 8* @return Codice errore
 9*/
10int SetSSHScpCmd(int mode, String sshname, String sship, String usr_file_url, String robot_file_url)

16.3. Calcolare Valore MD5 File in Percorso Specificato

1/**
2* @brief Calcola valore MD5 file in percorso specificato
3* @param [in] file_path Percorso file incluso nome file, percorso predefinito cartella Traj: "/fruser/traj/", es. "/fruser/traj/trajHelix_aima_1.txt"
4* @param [out] md5 Valore MD5 file
5* @return Codice errore
6*/
7int ComputeFileMD5(String file_path, String[] md5)

16.4. Esempio Codice Comandi SSH, MD5 Robot

 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. Impostare Periodo Feedback Porta 20004 Robot

1/**
2* @brief Imposta periodo feedback porta 20004 robot
3* @param [in] period Periodo feedback porta 20004 robot (ms)
4* @return  Codice errore
5*/
6public int SetRobotRealtimeStateSamplePeriod(int period)

16.6. Ottenere Periodo Feedback Porta 20004 Robot

1/**
2* @brief Ottiene periodo feedback porta 20004 robot
3* @return  List[0]:Codice errore; List[1]:Periodo feedback porta 20004 robot (ms)
4*/
5public List<Integer> GetRobotRealtimeStateSamplePeriod()

16.7. Esempio Codice Configurazione Periodo Feedback Porta 20004 Robot

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. Aggiornamento Software Robot

1/**
2 * @brief Aggiornamento software robot
3 * @param [in] filePath Percorso completo pacchetto aggiornamento software
4 * @param [in] block Blocco fino a completamento aggiornamento true:bloccante; false:non bloccante
5 * @return  Codice errore
6 */
7public int SoftwareUpgrade(String filePath, boolean block)

16.9. Ottenere Stato Aggiornamento Software Robot

1/**
2* @brief Ottiene stato aggiornamento software robot
3* @return  List[0]:Codice errore; List[1]:Stato aggiornamento software robot 0-inattivo o caricamento pacchetto; 1~100: percentuale completamento; -1: fallimento aggiornamento software; -2: fallimento verifica; -3: fallimento verifica versione; -4: fallimento decompressione; -5: fallimento aggiornamento configurazione utente; -6: fallimento aggiornamento configurazione periferiche; -7: fallimento aggiornamento configurazione assi estesi; -8: fallimento aggiornamento configurazione robot; -9: fallimento aggiornamento parametri DH
4*/
5public List<Integer> GetSoftwareUpgradeState()

16.10. Esempio Codice Aggiornamento Software Robot

 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 Database Tabella Punti

1/**
2* @brief Download database tabella punti
3* @param [in] pointTableName Nome tabella punti da scaricare    pointTable1.db
4* @param [in] saveFilePath Percorso salvataggio tabella punti   C://test/
5* @return Codice errore
6*/
7int PointTableDownLoad(String pointTableName, String saveFilePath);

16.12. Upload Database Tabella Punti

1/**
2* @brief Upload database tabella punti
3* @param [in] pointTableFilePath Percorso completo tabella punti da caricare   C://test/pointTable1.db
4* @return Codice errore
5*/
6int PointTableUpLoad(String pointTableFilePath);

16.13. Aggiornamento File Lua Tabella Punti

1/**
2* @brief Aggiornamento file Lua tabella punti
3* @param [in] pointTableName Nome tabella punti da cambiare   "pointTable1.db", quando tabella punti è vuota, cioè "", significa aggiornare programma Lua a programma iniziale senza tabella punti applicata
4* @param [in] luaFileName Nome file Lua da aggiornare   "testPointTable.lua"
5* @param [out] errorStr Informazioni errore cambio tabella punti
6* @return Codice errore
7*/
8int PointTableUpdateLua(String pointTableName, String luaFileName, String errorStr);

16.14. Esempio Codice Operazioni Tabella Punti Robot

 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. Download Log Controller

Nuovo nella versione Java: SDK-v1.0.4-3.8.1

1/**
2* @brief Download log controller
3* @param [in] savePath Percorso salvataggio file "D://zDown/"
4* @return Codice errore
5*/
6int RbLogDownload(String savePath);

16.16. Download Tutte Fonti Dati

Nuovo nella versione Java: SDK-v1.0.4-3.8.1

1/**
2* @brief Download tutte fonti dati
3* @param [in] savePath Percorso salvataggio file "D://zDown/"
4* @return Codice errore
5*/
6int AllDataSourceDownload(String savePath);

16.17. Download Pacchetto Backup Dati

Nuovo nella versione Java: SDK-v1.0.4-3.8.1

1/**
2* @brief Download pacchetto backup dati
3* @param [in] savePath Percorso salvataggio file "D://zDown/"
4* @return Codice errore
5*/
6int DataPackageDownload(String savePath);

16.18. Esempio Codice Download Dati Controller

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. Impostare Aggiornamento Encoder

Nuovo nella versione Java: SDK-v1.0.7-3.8.4

1/**
2* @brief Imposta aggiornamento encoder
3* @param [in] path Percorso completo pacchetto aggiornamento locale (D://zUP/XXXXX.bin)
4* @return Codice errore
5*/
6int SetEncoderUpgrade(String path)

16.20. Impostare Aggiornamento Firmware Giunti

Nuovo nella versione Java: SDK-v1.0.7-3.8.4

1/**
2* @brief Imposta aggiornamento firmware giunti
3* @param [in] type Tipo file aggiornamento; 1-aggiornamento firmware; 2-aggiornamento file configurazione slave
4* @param [in] path Percorso completo pacchetto aggiornamento locale (D://zUP/XXXXX.bin)
5* @return Codice errore
6*/
7public int SetJointFirmwareUpgrade(int type, String path)

16.21. Impostare Aggiornamento Firmware Box Controllo

Nuovo nella versione Java: SDK-v1.0.7-3.8.4

1/**
2* @brief Imposta aggiornamento firmware box controllo
3* @param [in] type Tipo file aggiornamento; 1-aggiornamento firmware; 2-aggiornamento file configurazione slave
4* @param [in] path Percorso completo pacchetto aggiornamento locale (D://zUP/XXXXX.bin)
5* @return Codice errore
6*/
7public int SetCtrlFirmwareUpgrade(int type, String path)

16.22. Impostare Aggiornamento Firmware Terminale

Nuovo nella versione Java: SDK-v1.0.7-3.8.4

1/**
2* @brief Imposta aggiornamento firmware terminale
3* @param [in] type Tipo file aggiornamento; 1-aggiornamento firmware; 2-aggiornamento file configurazione slave
4* @param [in] path Percorso completo pacchetto aggiornamento locale (D://zUP/XXXXX.bin)
5* @return Codice errore
6*/
7public int SetEndFirmwareUpgrade(int type, String path)

16.23. Aggiornamento File Configurazione Parametri Completi Giunti

Nuovo nella versione Java: SDK-v1.0.7-3.8.4

1/**
2* @brief Aggiornamento file configurazione parametri completi giunti
3* @param [in] path Percorso completo pacchetto aggiornamento locale (D://zUP/XXXXX.bin)
4* @return Codice errore
5*/
6public int JointAllParamUpgrade(String path)

16.24. Esempio Codice Aggiornamento Firmware Slave Robot

 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. Aggiornamento Sistema Operativo Robot (Box Controllo LA)

Nuovo nella versione Java: SDK-v1.0.9-3.8.6

1/**
2 * @brief Aggiornamento sistema operativo robot (box controllo LA)
3 * @param [in] filePath Percorso completo pacchetto aggiornamento sistema operativo
4 * @return  Codice errore
5 */
6public int KernelUpgrade(String filePath)

16.26. Ottenere Risultato Aggiornamento Sistema Operativo Robot (Box Controllo LA)

Nuovo nella versione Java: SDK-v1.0.9-3.8.6

1/**
2 * @brief Ottiene risultato aggiornamento sistema operativo robot (box controllo LA)
3 * @param [out] result Risultato aggiornamento: 0:successo; -1:fallimento
4 * @return  Codice errore
5 */
6public int GetKernelUpgradeResult(int[] result)

16.27. Generazione Log MCU Robot

1/**
2* @brief Generazione log MCU robot
3* @return Codice errore
4*/
5public int RobotMCULogCollect()

16.28. Imposta l’arresto del robot quando la comunicazione della porta è disconnessa

1/**
2* @brief Imposta l'arresto del robot quando la comunicazione della porta è disconnessa
3* @param portID Numero porta 0-8080; 1-8083; 2-20002; 3-20004
4* @param enable 0-disabilitato; 1-abilitato
5* @param confirmTime Durata conferma interruzione comunicazione (ms)[0-5000]
6* @return Codice di errore
7*/
8public int SetRobotStopOnComDisc(int portID, bool enable, int confirmTime)

16.29. Ottieni i parametri di arresto del robot alla disconnessione della comunicazione della porta

1/**
2* @brief Ottiene i parametri di arresto del robot alla disconnessione della comunicazione della porta
3* @param portID Numero porta 0-8080; 1-8083; 2-20002; 3-20004
4* @param enable Array risultato, index 0: 0-disabilitato; 1-abilitato
5* @param confirmTime Array risultato, index 0: Durata conferma interruzione comunicazione (ms)[0-5000]
6* @return Codice di errore
7*/
8public int GetRobotStopOnComDisc(int portID, int[] enable, int[] confirmTime)

16.30. Esempio di Codice per i Parametri di Arresto del Robot alla Disconnessione della Comunicazione della Porta

 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. Invia Frame di Istruzione UDP

1/**
2* @brief Invia frame di istruzione UDP
3* @param frame Frame di istruzione
4* @return Codice di errore
5*/
6public int SendUDPFrame(String frame)

16.32. Esempio di Codice SDK per Comunicazione UDP

 1public static void TestRobotUDP (Robot robot) {
 2    robot.udpCmdClient.SetUDPCmdRpyCallback((srcType, count, cmdID, dataLen, content) -> {
 3        System.out.println("\n[Risposta UDP ricevuta dal robot]");
 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("contenuto: " + content);
 9        return 0;
10    });
11    // Invia 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. Imposta il Colore LED Personalizzato dell’End-Effector del Robot

1/**
2* @brief Imposta il colore LED personalizzato dell'end-effector del robot
3* @param r Controllo LED rosso dell'end-effector; 0-spento; 1-acceso
4* @param g Controllo LED verde dell'end-effector; 0-spento; 1-acceso
5* @param b Controllo LED blu dell'end-effector; 0-spento; 1-acceso
6* @return Codice di errore
7*/
8public int SetUserLEDColor(bool r, bool g, bool b)

16.34. Esempio di Codice SDK per Impostare il Colore LED Personalizzato dell’End-Effector del Robot

 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}