16. Altre Interfacce

16.1. Ottenere Chiave Pubblica SSH

1/**
2* @brief Ottenere Chiave Pubblica SSH
3* @param [out] keygen Chiave pubblica
4* @return Codice errore
5*/
6int GetSSHKeygen(ref string keygen);

16.2. Inviare Comando SCP

Nuovo nella versione C#SDK-V1.1.4: Web-3.8.3

 1/**
 2* @brief Inviare Comando SCP
 3* @param [in] mode 0-Caricamento (PC supervisore -> controller), 1-Scaricamento (controller -> PC supervisore)
 4* @param [in] sshname Nome utente PC supervisore
 5* @param [in] sship Indirizzo IP PC supervisore
 6* @param [in] usr_file_url Percorso file PC supervisore
 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 Percorso Specificato

1/**
2* @brief Calcolare Valore MD5 File Percorso Specificato
3* @param [in] file_path Percorso file incluso nome file, percorso cartella Traj predefinito:"/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, ref string md5);

16.4. Esempio Codice Istruzioni SSH, MD5 Robot

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

1/**
2* @brief Impostare Periodo Feedback Porta 20004 Robot
3* @param [in] period Periodo feedback porta 20004 robot(ms)
4* @return Codice errore
5*/
6int SetRobotRealtimeStateSamplePeriod(int period);

16.6. Ottenere Periodo Feedback Porta 20004 Robot

1/**
2* @brief Ottenere Periodo Feedback Porta 20004 Robot
3* @param [out] period Periodo feedback porta 20004 robot(ms)
4* @return Codice errore
5*/
6int GetRobotRealtimeStateSamplePeriod(ref int period);

16.7. Esempio Codice Configurazione Periodo Feedback Stato Porta 20004 Robot

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

1/**
2* @brief Aggiornamento Software Robot
3* @param [in] filePath Percorso completo pacchetto aggiornamento software
4* @param [in] block Se bloccare fino al completamento aggiornamento true:bloccante; false:non bloccante
5* @return   Codice errore
6*/
7int SoftwareUpgrade(string filePath, bool block);

16.9. Ottenere Stato Aggiornamento Software Robot

1/**
2* @brief  Ottenere Stato Aggiornamento Software Robot
3* @param [out] state Stato aggiornamento pacchetto software robot  0-inattivo o caricamento pacchetto aggiornamento in corso; 1~100: percentuale completamento aggiornamento; -1:fallimento aggiornamento software; -2: fallimento verifica; -3: fallimento verifica versione; -4: fallimento estrazione; -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* @return   Codice errore
5*/
6int GetSoftwareUpgradeState(ref int state);

16.10. Esempio Codice Aggiornamento Software Robot

 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. Scaricamento Tabella Punti

1/**
2* @brief Scaricamento Tabella Punti da Controller Robot a Computer Locale
3* @param [in] pointTableName Nome tabella punti nel controller: pointTable1.db
4* @param [in] saveFilePath Percorso scaricamento tabella punti sul computer C://test/
5* @return Codice errore
6*/
7int PointTableDownLoad(string pointTableName, string saveFilePath);

16.12. Caricamento Tabella Punti

1/**
2* @brief Caricamento Tabella Punti da Computer Locale a Controller Robot
3* @param [in] pointTableFilePath Percorso assoluto tabella punti su computer locale C://test/pointTabl e1.db
4* @return Codice errore
5*/
6int PointTableUpLoad(string pointTableFilePath);

16.13. Aggiornamento Programma Lua con Tabella Punti

1/**
2* @brief Aggiornamento punti nel programma Lua usando la tabella punti fornita
3* @param [in] pointTableName Nome tabella punti nel controller: "pointTable1.db", quando tabella punti vuota, cioè "", indica aggiornamento programma Lua al programma iniziale senza tabella punti applicata
4* @param [in] luaFileName Nome file Lua da aggiornare   "test.lua"
5* @param [out] errorStr Informazioni errore aggiornamento Lua tabella punti
6* @return Codice errore
7*/
8int PointTableUpdateLua(string pointTableName, string luaFileName, ref string errorStr);

16.14. Cambio Tabella Punti e Applicazione

1/**
2* @brief Cambio Tabella Punti e Applicazione
3* @param [in] pointTableName Nome tabella punti da cambiare   "pointTable1.db"
4* @param [out] errorStr Informazioni errore cambio tabella punti
5* @return Codice errore
6*/
7int PointTableSwitch(string pointTableName, ref string errorStr);

16.15. Esempio Codice Operazioni Tabella Punti Robot

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

1/**
2* @brief  Scaricamento Log Controller
3* @param [in] savePath Percorso salvataggio file "D://zDown/"
4* @return   Codice errore
5*/
6int RbLogDownload(string savePath);

16.17. Scaricamento Tutte Sorgenti Dati

1/**
2* @brief Scaricamento Tutte Sorgenti Dati
3* @param [in] savePath Percorso salvataggio file "D://zDown/"
4* @return   Codice errore
5*/
6int AllDataSourceDownload(string savePath);

16.18. Scaricamento Pacchetto Backup Dati

1/**
2* @brief Scaricamento Pacchetto Backup Dati
3* @param [in] savePath Percorso salvataggio file "D://zDown/"
4* @return   Codice errore
5*/
6int DataPackageDownload(string savePath);

16.19. Esempio Codice Scaricamento Dati Controller

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

Nuovo nella versione C#SDK-V1.1.8: Web-3.8.6

1/**
2 * @brief Aggiornamento Sistema Operativo Robot (Quadro Controllo LA)
3 * @param [in] filePath Percorso completo pacchetto aggiornamento sistema operativo
4 * @return   Codice errore
5 */
6public int KernelUpgrade(string filePath)

16.21. Ottenere Risultato Aggiornamento Sistema Operativo Robot (Quadro Controllo LA)

Nuovo nella versione C#SDK-V1.1.8: Web-3.8.6

1/**
2 * @brief Ottenere Risultato Aggiornamento Sistema Operativo Robot (Quadro Controllo LA)
3 * @param [out] result Risultato aggiornamento: 0:successo; -1:fallimento
4 * @return   Codice errore
5 */
6public int GetKernelUpgradeResult(ref int[] result)

16.22. Impostare Aggiornamento Encoder

Nuovo nella versione C#SDK-V1.1.5: Web-3.8.4

1/**
2* @brief Impostare 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.23. Impostare Aggiornamento Firmware Giunto

Nuovo nella versione C#SDK-V1.1.5: Web-3.8.4

1/**
2* @brief Impostare Aggiornamento Firmware Giunto
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*/
7int SetJointFirmwareUpgrade(int type, string path);

16.24. Impostare Aggiornamento Firmware Quadro Controllo

Nuovo nella versione C#SDK-V1.1.5: Web-3.8.4

1/**
2* @brief Impostare Aggiornamento Firmware Quadro 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*/
7int SetCtrlFirmwareUpgrade(int type, string path);

16.25. Impostare Aggiornamento Firmware Estremità

Nuovo nella versione C#SDK-V1.1.5: Web-3.8.4

1/**
2* @brief Impostare Aggiornamento Firmware Estremità
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*/
7int SetEndFirmwareUpgrade(int type, string path);

16.26. Aggiornamento File Configurazione Parametri Completi Giunto

Nuovo nella versione C#SDK-V1.1.5: Web-3.8.4

1/**
2* @brief Aggiornamento File Configurazione Parametri Completi Giunto
3* @param [in] path Percorso completo pacchetto aggiornamento locale (D://zUP/XXXXX.bin)
4* @return Codice errore
5*/
6int JointAllParamUpgrade(string path);

16.27. Esempio Codice Aggiornamento Firmware Slave Robot

Nuovo nella versione 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. Generazione Log MCU Robot

Nuovo nella versione C#SDK-V1.1.9: Web-3.8.7

1/**
2* @brief Generazione Log MCU Robot
3* @return Codice errore
4*/
5public int RobotMCULogCollect();

16.29. 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 [in] portID Numero porta 0-8080; 1-8083; 2-20002; 3-20004
4* @param [in] enable 0-disabilitato; 1-abilitato
5* @param [in] confirmTime Durata conferma interruzione comunicazione (ms)[0-5000]
6* @return  Codice di errore
7*/
8public int SetRobotStopOnComDisc(int portID, bool enable, int confirmTime)

16.30. 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 [in] portID Numero porta 0-8080; 1-8083; 2-20002; 3-20004
4* @param [out] enable 0-disabilitato; 1-abilitato
5* @param [out] confirmTime Durata conferma interruzione comunicazione (ms)[0-5000]
6* @return  Codice di errore
7*/
8public int GetRobotStopOnComDisc(int portID, ref bool enable, ref int confirmTime)

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

 1void TestRobotStopOnComDisc()
 2{
 3    int rtn = 0;
 4
 5    // Imposta i parametri per quattro porte
 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    // Ottiene e stampa le impostazioni per ogni porta
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. Invia Frame di Istruzione UDP

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

16.33. Esempio di Codice SDK basato su Comunicazione UDP

 1void TestRobotUDP()
 2{
 3    robot.OnUdpFrameReceived += (comType, frameCount, frameCmdID, contentLen, content) =>
 4    {
 5        Console.WriteLine($"[Risposta UDP] comType={comType}, count={frameCount}, cmdID={frameCmdID}, content={content}");
 6    };
 7
 8
 9    //Invia 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. 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 [in] r Controllo LED rosso dell'end-effector; 0-spento; 1-acceso
4* @param [in] g Controllo LED verde dell'end-effector; 0-spento; 1-acceso
5* @param [in] 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.35. Esempio di Codice SDK per Impostare il Colore LED Personalizzato dell’End-Effector del Robot

 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}