11. Periferiche Robot

11.1. Configurare Pinza

1/**
2* @brief  Configurare Pinza
3* @param  [in] company  Produttore pinza, da definire
4* @param  [in] device  Numero dispositivo, attualmente non utilizzato, default 0
5* @param  [in] softvesion  Numero versione software, attualmente non utilizzato, default 0
6* @param  [in] bus Posizione bus estremità dove è collegato il dispositivo, attualmente non utilizzato, default 0
7* @return   Codice errore
8*/
9int SetGripperConfig(int company, int device, int softvesion, int bus);

11.2. Ottenere Configurazione Pinza

1/**
2* @brief  Ottenere Configurazione Pinza
3* @param  [in] company  Produttore pinza, da definire
4* @param  [in] device  Numero dispositivo, attualmente non utilizzato, default 0
5* @param  [in] softvesion  Numero versione software, attualmente non utilizzato, default 0
6* @param  [in] bus Posizione bus estremità dove è collegato il dispositivo, attualmente non utilizzato, default 0
7* @return   Codice errore
8*/
9int GetGripperConfig(int *company, int *device, int *softvesion, int *bus);

11.3. Attivare Pinza

1/**
2* @brief  Attivare Pinza
3* @param  [in] index  Numero identificativo pinza
4* @param  [in] act  0-reset, 1-attiva
5* @return   Codice errore
6*/
7int ActGripper(int index, byte act);

11.4. Controllare Pinza

 1/**
 2* @brief  Controllare Pinza
 3* @param  [in] index  Numero identificativo pinza
 4* @param  [in] pos  Percentuale posizione, range [0~100]
 5* @param  [in] vel  Percentuale velocità, range [0~100]
 6* @param  [in] force  Percentuale coppia, range [0~100]
 7* @param  [in] max_time  Tempo di attesa massimo, range [0~30000], unità ms
 8* @param  [in] block  0-bloccante, 1-non bloccante
 9* @param  [in] type Tipo pinza, 0-pinza parallela; 1-pinza rotante
10* @param  [in] rotNum Numero di giri rotazione
11* @param  [in] rotVel Percentuale velocità rotazione [0-100]
12* @param  [in] rotTorque Percentuale coppia rotazione [0-100]
13* @return   Codice errore
14*/
15int MoveGripper(int index, int pos, int vel, int force, int max_time, byte block, int type, double rotNum, int rotVel, int rotTorque);

11.5. Ottenere Stato Movimento Pinza

1/**
2* @brief  Ottenere Stato Movimento Pinza
3* @param  [out] fault  0-nessun errore, 1-errore presente
4* @param  [out] staus  0-movimento non completato, 1-movimento completato
5* @return   Codice errore
6*/
7int GetGripperMotionDone(ref int fault, ref int status);

11.6. Ottenere Stato Attivazione Pinza

1/**
2* @brief  Ottenere Stato Attivazione Pinza
3* @param  [out] fault  0-nessun errore, 1-errore presente
4* @param  [out] status  bit0~bit15 corrispondono numeri pinza 0~15, bit=0 non attivato, bit=1 attivato
5* @return   Codice errore
6*/
7int GetGripperActivateStatus(ref int fault, ref int status);

11.7. Ottenere Posizione Pinza

1/**
2* @brief  Ottenere Posizione Pinza
3* @param  [out] fault  0-nessun errore, 1-errore presente
4* @param  [out] position  Percentuale posizione, range 0~100%
5* @return   Codice errore
6*/
7int GetGripperCurPosition(ref int fault, ref int position);

11.8. Ottenere Velocità Pinza

1/**
2* @brief  Ottenere Velocità Pinza
3* @param  [out] fault  0-nessun errore, 1-errore presente
4* @param  [out] speed  Percentuale velocità, range 0~100%
5* @return   Codice errore
6*/
7int GetGripperCurSpeed(ref int fault, ref int speed);

11.9. Ottenere Corrente Pinza

1/**
2* @brief  Ottenere Corrente Pinza
3* @param  [out] fault  0-nessun errore, 1-errore presente
4* @param  [out] current  Percentuale corrente, range 0~100%
5* @return   Codice errore
6*/
7int GetGripperCurCurrent(ref int fault, ref int current);

11.10. Ottenere Tensione Pinza

1/**
2* @brief  Ottenere Tensione Pinza
3* @param  [out] fault  0-nessun errore, 1-errore presente
4* @param  [out] voltage  Tensione, unità 0.1V
5* @return   Codice errore
6*/
7int GetGripperVoltage(ref int fault, ref int voltage);

11.11. Ottenere Temperatura Pinza

1/**
2* @brief  Ottenere Temperatura Pinza
3* @param  [out] fault  0-nessun errore, 1-errore presente
4* @param  [out] temp  Temperatura, unità ℃
5* @return   Codice errore
6*/
7int GetGripperTemp(ref int fault, ref int temp);

11.12. Calcolare Punto Pre-Presa - Visione

1/**
2* @brief Calcolare Punto Pre-Presa - Visione
3* @param [in] desc_pos Posa cartesiana punto di presa
4* @param [in] zlength Offset asse z
5* @param [in] zangle Offset rotazione attorno asse z
6* @param [out] pre_pos Punto pre-presa
7* @return Codice errore
8*/
9int ComputePrePick(DescPose desc_pos, double zlength, double zangle, ref DescPose pre_pos);

11.13. Calcolare Punto Post-Presa - Visione

1/**
2* @brief Calcolare Punto Post-Presa - Visione
3* @param [in] desc_pos Posa cartesiana punto post-presa
4* @param [in] zlength Offset asse z
5* @param [in] zangle Offset rotazione attorno asse z
6* @param [out] post_pos Punto post-presa
7* @return Codice errore
8*/
9int ComputePostPick(DescPose desc_pos, double zlength, double zangle, ref DescPose post_pos);

11.14. Esempio Codice Operazioni Pinza Robot

 1private void button36_Click(object sender, EventArgs e)
 2{
 3    int company = 4;
 4    int device = 0;
 5    int softversion = 0;
 6    int bus = 2;
 7    int index = 2;
 8    byte act = 0;
 9    int max_time = 30000;
10    byte block = 0;
11    int status=0;
12    int fault=0;
13    int active_status = 0;
14    int current_pos = 0;
15    int current = 0;
16    int voltage = 0;
17    int temp = 0;
18    int speed = 0;
19
20    robot.SetGripperConfig(company, device, softversion, bus);
21    Thread.Sleep(1000);
22    robot.GetGripperConfig(ref company, ref device, ref softversion, ref bus);
23    Console.WriteLine("gripper config:{0},{1},{2},{3}\n", company, device, softversion, bus);
24
25    robot.ActGripper(index, act);
26    Thread.Sleep(1000);
27    act = 1;
28    robot.ActGripper(index, act);
29    Thread.Sleep(1000);
30
31    robot.MoveGripper(index, 90, 50, 50, max_time, block, 0, 0, 0, 0);
32    Thread.Sleep(1000);
33    robot.MoveGripper(index, 30, 50, 0, max_time, block, 0, 0, 0, 0);
34
35    robot.GetGripperMotionDone(ref fault, ref status);
36    Console.WriteLine("motion status:{0},{1}\n", fault, status);
37
38    robot.GetGripperActivateStatus(ref fault, ref active_status);
39    Console.WriteLine("gripper active fault is: {0}, status is: {1}\n", fault, active_status);
40
41    robot.GetGripperCurPosition(ref fault, ref current_pos);
42    Console.WriteLine("fault is:{0}, current position is: {1}\n", fault, current_pos);
43
44    robot.GetGripperCurCurrent(ref fault, ref current);
45    Console.WriteLine("fault is:{0}, current current is: {1}\n", fault, current);
46
47    robot.GetGripperVoltage(ref fault, ref voltage);
48    Console.WriteLine("fault is:{0}, current voltage is: {1} \n", fault, voltage);
49
50    robot.GetGripperTemp(ref fault, ref temp);
51    Console.WriteLine("fault is:{0}, current temperature is: {1}\n", fault, temp);
52
53    robot.GetGripperCurSpeed(ref fault, ref speed);
54    Console.WriteLine("fault is:{0}, current speed is: {1}\n", fault, speed);
55
56    int retval = 0;
57    DescPose prepick_pose = new DescPose();
58    DescPose postpick_pose = new DescPose();
59
60    DescPose p1Desc = new DescPose(-419.524f, -13.000f, 351.569f, -178.118f, 0.314f, 3.833f);
61    DescPose p2Desc = new DescPose(-321.222f, 185.189f, 335.520f, -179.030f, -1.284f, -29.869f);
62
63    retval = robot.ComputePrePick(p1Desc, 10, 0, ref prepick_pose);
64    Console.WriteLine("ComputePrePick retval is: {0}\n", retval);
65    Console.WriteLine("xyz is: {0}, {1}, {2}; rpy is: {3}, {4}, {5}\n",
66        prepick_pose.tran.x, prepick_pose.tran.y, prepick_pose.tran.z,
67        prepick_pose.rpy.rx, prepick_pose.rpy.ry, prepick_pose.rpy.rz);
68
69    retval = robot.ComputePostPick( p2Desc, -10, 0, ref postpick_pose);
70    Console.WriteLine("ComputePostPick retval is: {0}\n", retval);
71    Console.WriteLine("xyz is: {0}, {1}, {2}; rpy is: {3}, {4}, {5}\n",
72        postpick_pose.tran.x, postpick_pose.tran.y, postpick_pose.tran.z,
73        postpick_pose.rpy.rx, postpick_pose.rpy.ry, postpick_pose.rpy.rz);
74
75}

11.15. Ottenere Numero Giri Pinza Rotante

1/**
2* @brief  Ottenere Numero Giri Pinza Rotante
3* @param  [out] fault  0-nessun errore, 1-errore presente
4* @param  [out] num  Numero giri rotazione
5* @return   Codice errore
6*/
7int GetGripperRotNum(ref UInt16 fault, ref double num);

11.16. Ottenere Percentuale Velocità Rotazione Pinza Rotante

1/**
2* @brief  Ottenere Percentuale Velocità Rotazione Pinza Rotante
3* @param  [out] fault  0-nessun errore, 1-errore presente
4* @param  [out] speed  Percentuale velocità rotazione
5* @return   Codice errore
6*/
7int GetGripperRotSpeed(ref UInt16 fault, ref int speed);

11.17. Ottenere Percentuale Coppia Rotazione Pinza Rotante

1/**
2* @brief  Ottenere Percentuale Coppia Rotazione Pinza Rotante
3* @param  [out] fault  0-nessun errore, 1-errore presente
4* @param  [out] torque  Percentuale coppia rotazione
5* @return   Codice errore
6*/
7int GetGripperRotTorque(ref UInt16 fault, ref int torque);

11.18. Esempio Codice Ottenimento Stato Pinza Rotante

 1int MoveRotGripper(int pos, double rotPos)
 2{
 3    robot.ResetAllError();
 4    robot.ActGripper(1, 1);
 5    Thread.Sleep(1000);
 6    int rtn = robot.MoveGripper(1, pos, 50, 50, 5000, 1, 1, rotPos, 50, 100);
 7    Console.WriteLine($"move gripper rtn is {rtn}" );
 8    UInt16 fault = 0;
 9    double rotNum = 0.0;
10    int rotSpeed = 0;
11    int rotTorque = 0;
12    robot.GetGripperRotNum(ref fault, ref rotNum);
13    robot.GetGripperRotSpeed(ref fault, ref rotSpeed);
14    robot.GetGripperRotTorque(ref fault, ref rotTorque);
15    Console.WriteLine($"gripper rot num :{ rotNum}, gripper rotSpeed :{rotSpeed}, gripper rotTorque : { rotTorque}");
16    return 0;
17}

11.19. Avvio, Arresto Nastro Trasportatore

1/**
2* @brief Avvio, Arresto Nastro Trasportatore
3* @param [in] status Stato, 1-avvio, 0-arresto
4* @return Codice errore
5*/
6int ConveyorStartEnd(byte status);

11.20. Registrare Punto Rilevamento IO

1/**
2* @brief Registrare Punto Rilevamento IO
3* @return Codice errore
4*/
5int ConveyorPointIORecord();

11.21. Registrare Punto A

1/**
2* @brief Registrare Punto A
3* @return Codice errore
4*/
5int ConveyorPointARecord();

11.22. Registrare Punto Riferimento

1/**
2* @brief Registrare Punto Riferimento
3* @return Codice errore
4*/
5int ConveyorRefPointRecord();

11.23. Registrare Punto B

1/**
2* @brief Registrare Punto B
3* @return Codice errore
4*/
5int ConveyorPointBRecord();

11.24. Rilevamento IO Pezzo Nastro Trasportatore

1/**
2* @brief Rilevamento IO Pezzo Nastro Trasportatore
3* @param [in] max_t Tempo massimo rilevamento, unità ms
4* @return Codice errore
5*/
6int ConveyorIODetect(int max_t);

11.25. Ottenere Posizione Corrente Oggetto

1/**
2* @brief Ottenere Posizione Corrente Oggetto
3* @param [in] mode 1-tracciamento presa, 2-tracciamento movimento, 3-tracciamento TPD
4* @return Codice errore
5*/
6int ConveyorGetTrackData(int mode);

11.26. Inizio Tracciamento Nastro Trasportatore

1/**
2* @brief Inizio Tracciamento Nastro Trasportatore
3* @param [in] status Stato, 1-avvio, 0-arresto
4* @return Codice errore
5*/
6int ConveyorTrackStart(byte status);

11.27. Fine Tracciamento Nastro Trasportatore

1/**
2* @brief Fine Tracciamento Nastro Trasportatore
3* @return Codice errore
4*/
5int ConveyorTrackEnd();

11.28. Configurazione Parametri Nastro Trasportatore

 1/**
 2* @brief Configurazione Parametri Nastro Trasportatore
 3* @param [in] para[0] Canale encoder 1~2
 4* @param [in] para[1] Numero impulsi per giro encoder
 5* @param [in] para[2] Distanza percorrenza nastro per giro encoder
 6* @param [in] para[3] Numero sistema coordinate pezzo Per funzione tracciamento movimento selezionare numero sistema coordinate pezzo, per tracciamento presa, TPD impostare 0
 7* @param [in] para[4] Se dotato di visione  0 no  1 sì
 8* @param [in] para[5] Rapporto velocità  Opzione tracciamento presa nastro (1-100)  Altre opzioni default 1
 9* @param [in] followType Tipo movimento tracciamento, 0-tracciamento movimento; 1-movimento inseguimento ispezione
10* @param [in] startDis Necessario per presa inseguimento ispezione, distanza inizio tracciamento, -1: calcolo automatico (inseguimento ispezione automatico dopo arrivo pezzo sotto robot), unità mm, valore default 0
11* @param [in] endDis Necessario per presa inseguimento ispezione, distanza fine tracciamento, unità mm, valore default 100
12* @return Codice errore
13*/
14int ConveyorSetParam(int encChannel, int resolution, double lead, int wpAxis, int vision, double speedRadio, int followType, int startDis=0, int endDis=100);

11.29. Impostare Compensazione Punto Presa Nastro Trasportatore

1/**
2* @brief Impostare Compensazione Punto Presa Nastro Trasportatore
3* @param [in] cmp Posizione compensazione double[3]{x, y, z}
4* @return Codice errore
5*/
6int ConveyorCatchPointComp(double[] cmp);

11.30. Movimento Lineare Tracciamento Nastro Trasportatore

 1/**
 2* @brief Movimento Lineare Tracciamento Nastro Trasportatore
 3* @param [in] name Nome punto movimento
 4* @param [in] tool Numero sistema coordinate utensile, range [0~14]
 5* @param [in] wobj Numero sistema coordinate pezzo, range [0~14]
 6* @param [in] vel Percentuale velocità, range [0~100]
 7* @param [in] acc Percentuale accelerazione, range [0~100], attualmente non disponibile
 8* @param [in] ovl Fattore di scala velocità, range [0~100]
 9* @param [in] blendR [-1.0]-movimento fino a posizione (bloccante), [0~1000.0]-raggio smoothing (non bloccante), unità mm
10* @return Codice errore
11*/
12int ConveyorTrackMoveL(string name, int tool, int wobj, float vel, float acc, float ovl, float blendR);

11.31. Rilevamento Input Comunicazione Nastro Trasportatore

1/**
2* @brief Rilevamento Input Comunicazione Nastro Trasportatore
3* @param [in] timeout Tempo attesa timeout ms
4* @return Codice errore
5*/
6int ConveyorComDetect(int timeout);

11.32. Trigger Rilevamento Input Comunicazione Nastro Trasportatore

1/**
2* @brief Trigger Rilevamento Input Comunicazione Nastro Trasportatore
3* @return Codice errore
4*/
5int ConveyorComDetectTrigger();

11.33. Esempio Programma Trigger Rilevamento Input Comunicazione Nastro Trasportatore

 1private void button3_Click(object sender, EventArgs e)
 2{
 3
 4    // Disabilitare pulsante per evitare clic ripetuti
 5    button3.Enabled = false;
 6
 7    // Eseguire operazione lunga in thread background
 8    Thread conveyorThread = new Thread(ConveyorTest);
 9    conveyorThread.IsBackground = true;
10    conveyorThread.Start();
11}
12
13private void button4_Click(object sender, EventArgs e)
14{
15    // Ottenere input utente
16    string input = texBox.Text;
17    Console.WriteLine($"please input a number to trigger:{input}");
18
19    int rtn = robot.ConveyorComDetectTrigger();
20    Console.WriteLine($"ConveyorComDetectTrigger valore restituito: {rtn}");
21
22}
23
24private void ConveyorTest()
25{
26    // Usare Invoke per aggiornare controlli sul thread UI
27    this.Invoke((MethodInvoker)delegate {
28        Console.WriteLine("Inizio test nastro trasportatore...");
29    });
30
31    int retval = 0;
32    int index = 1;
33    int max_time = 30000;
34    bool block = false;
35    retval = 0;
36
37    /* Processo presa nastro trasportatore */
38    DescPose startdescPose = new DescPose(139.176f, 4.717f, 9.088f, -179.999f, -0.004f, -179.990f);
39    JointPos startjointPos = new JointPos(-34.129f, -88.062f, 97.839f, -99.780f, -90.003f, -34.140f);
40
41    DescPose homePose = new DescPose(139.177f, 4.717f, 69.084f, -180.000f, -0.004f, -179.989f);
42    JointPos homejointPos = new JointPos(-34.129f, -88.618f, 84.039f, -85.423f, -90.003f, -34.140f);
43
44    ExaxisPos exaxisPos = new ExaxisPos(0, 0, 0, 0);
45    DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
46
47    // Spostarsi a posizione sicura
48    retval = robot.MoveL(homejointPos, homePose, 1, 1, 100, 100, 100, -1, exaxisPos, 0, 0, offdese, 1, 1);
49    Console.WriteLine($"MoveL a posizione sicura valore restituito: {retval}");
50
51    // Rilevamento nastro trasportatore
52    retval = robot.ConveryComDetect(1000 * 10);
53    Console.WriteLine($"ConveyorComDetect valore restituito: {retval}");
54
55    // Ottenere dati tracciamento
56    retval = robot.ConveyorGetTrackData(2);
57    Console.WriteLine($"ConveyorGetTrackData valore restituito: {retval}");
58
59    // Inizio tracciamento
60    retval = robot.ConveyorTrackStart(2);
61    Console.WriteLine($"ConveyorTrackStart valore restituito: {retval}");
62
63    // Spostarsi a posizione iniziale
64    robot.MoveL(startjointPos, startdescPose, 1, 1, 100, 100, 100, -1, exaxisPos, 0, 0, offdese, 1, 1);
65    robot.MoveL(startjointPos, startdescPose, 1, 1, 100, 100, 100, -1, exaxisPos, 0, 0, offdese, 1, 1);
66
67    // Fine tracciamento
68    retval = robot.ConveyorTrackEnd();
69    Console.WriteLine($"ConveyorTrackEnd valore restituito: {retval}");
70
71    // Ritorno a posizione sicura
72    robot.MoveL(homejointPos, homePose, 1, 1, 100, 100, 100, -1, exaxisPos, 0, 0, offdese, 1, 1);
73
74    this.Invoke((MethodInvoker)delegate {
75        Console.WriteLine("Test nastro trasportatore completato!");
76        button3.Enabled = true;
77    });
78}

11.34. Esempio Programma Operazioni Nastro Trasportatore Robot

 1private void btnConvert_Click(object sender, EventArgs e)
 2    {
 3    Robot robot = new Robot();
 4    robot.RPC("192.168.58.2");
 5    DescPose pos1 = new DescPose(0, 0, 0, 0 ,0 ,0);
 6    DescPose pos2 = new DescPose(0, 0, 0, 0, 0, 0);
 7
 8    pos1.tran.x = -351.175;
 9    pos1.tran.y = 3.389;
10    pos1.tran.z = 431.172;
11    pos1.rpy.rx = -179.111;
12    pos1.rpy.ry = -0.241;
13    pos1.rpy.rz = 90.388;
14
15    pos2.tran.x = -333.654;
16    pos2.tran.y = -229.003;
17    pos2.tran.z = 404.335;
18    pos2.rpy.rx = -179.139;
19    pos2.rpy.ry = -0.779;
20    pos2.rpy.rz = 91.269;
21    int rtn = -1;
22
23    double[] cmp = new double[3] { 0, 9.99, 0};
24    rtn = robot.ConveyorCatchPointComp(cmp);
25    if(rtn != 0)
26    {
27        return;
28    }
29    Console.WriteLine($"ConveyorCatchPointComp: rtn  {rtn}");
30
31    rtn = robot.MoveCart(pos1, 0, 0, 100.0f, 180.0f, 100.0f, -1.0f, -1);
32    Console.WriteLine($"MoveCart: rtn  {rtn}");
33
34    rtn = robot.ConveyorIODetect(10000);
35    Console.WriteLine($"ConveyorIODetect: rtn  {rtn}");
36
37    robot.ConveyorGetTrackData(1);
38    rtn = robot.ConveyorTrackStart(1);
39    Console.WriteLine($"ConveyorTrackStart: rtn  {rtn}");
40
41    rtn = robot.ConveyorTrackMoveL("cvrCatchPoint", 0, 0, 100.0f, 0.0f, 100.0f, -1.0f, 0, 0);
42    Console.WriteLine($"ConveyorTrackMoveL: rtn  {rtn}");
43
44    rtn = robot.MoveGripper(1, 59, 43, 21, 30000, 0);
45    Console.WriteLine($"MoveGripper: rtn  {rtn}");
46
47    rtn = robot.ConveyorTrackMoveL("cvrRaisePoint", 0, 0, 100.0f, 0.0f, 100.0f, -1.0f, 0, 0);
48    Console.WriteLine($"ConveyorTrackMoveL: rtn  {rtn}");
49
50    rtn = robot.ConveyorTrackEnd();
51    Console.WriteLine($"ConveyorTrackEnd: rtn  {rtn}");
52
53    rtn = robot.MoveCart(pos2, 0, 0, 100.0f, 180.0f, 100.0f, -1.0f, -1);
54    Console.WriteLine($"MoveCart: rtn  {rtn}");
55
56    rtn = robot.MoveGripper(1, 100, 43, 21, 30000, 0);
57    Console.WriteLine($"MoveGripper: rtn  {rtn}");
58}

11.35. Configurazione Sensore Estremità

1/**
2* @brief  Configurazione Sensore Estremità
3* @param  [in] idCompany Produttore, 18-JUNKONG;25-HUIDE
4* @param  [in] idDevice Tipo, 0-JUNKONG/RYR6T.V1.0
5* @param  [in] idSoftware Versione software, 0-J1.0/HuiDe1.0(attualmente non disponibile)
6* @param  [in] idBus Posizione montaggio, 1-porta 1 estremità; 2-porta 2 estremità...8-porta 8 estremità(attualmente non disponibile)
7* @return   Codice errore
8*/
9int AxleSensorConfig(int idCompany, int idDevice, int idSoftware, int idBus);

11.36. Ottenere Configurazione Sensore Estremità

1/**
2* @brief  Ottenere Configurazione Sensore Estremità
3* @param  [out] idCompany Produttore, 18-JUNKONG;25-HUIDE
4* @param  [out] idDevice Tipo, 0-JUNKONG/RYR6T.V1.0
5* @return   Codice errore
6*/
7int AxleSensorConfigGet(ref int idCompany, ref int idDevice);

11.37. Attivazione Sensore Estremità

1/**
2* @brief  Attivazione Sensore Estremità
3* @param  [in] actFlag 0-reset; 1-attiva
4* @return   Codice errore
5*/
6int AxleSensorActivate(int actFlag);

11.38. Scrittura Registro Sensore Estremità

 1/**
 2* @brief  Scrittura Registro Sensore Estremità
 3* @param  [in] devAddr  Numero indirizzo dispositivo 0-255
 4* @param  [in] regHAddr Indirizzo registro 8 bit alti
 5* @param  [in] regLAddr Indirizzo registro 8 bit bassi
 6* @param  [in] regNum  Numero registri 0-255
 7* @param  [in] data1 Valore scrittura registro 1
 8* @param  [in] data2 Valore scrittura registro 2
 9* @param  [in] isNoBlock 0-bloccante; 1-non bloccante
10* @return   Codice errore
11*/
12 int AxleSensorRegWrite(int devAddr, int regHAddr, int regLAddr, int regNum, int data1, int data2, int isNoBlock);

11.39. Esempio Codice Sensore Estremità

 1private void button2_Click_1(object sender, EventArgs e)
 2{
 3    robot.AxleSensorConfig(18, 0, 0, 1);
 4    int company = -1;
 5    int type = -1;
 6    robot.AxleSensorConfigGet(ref company, ref type);
 7    Console.WriteLine("company is " + company + ", type is " + type);
 8
 9    int rtn = robot.AxleSensorActivate(1);
10    Console.WriteLine("AxleSensorActivate rtn is " + rtn);
11
12    Thread.Sleep(1000);
13
14    rtn = robot.AxleSensorRegWrite(1, 4, 6, 1, 0, 0, 0);
15    Console.WriteLine("AxleSensorRegWrite rtn is " + rtn);
16}

11.40. Ottenere Protocollo Periferiche Robot

Nuovo nella versione C#SDK-v1.0.6.

1/**
2* @brief Ottenere Protocollo Periferiche Robot
3* @param [out] protocol Numero protocollo periferiche robot 4096-scheda controllo asse esteso; 4097-ModbusSlave; 4098-ModbusMaster
4* @return Codice errore
5*/
6int GetExDevProtocol(ref int protocol);

11.41. Impostare Protocollo Periferiche Robot

Nuovo nella versione C#SDK-v1.0.6.

1/**
2* @brief Impostare Protocollo Periferiche Robot
3* @param [in] protocol Numero protocollo periferiche robot 4096-scheda controllo asse esteso; 4097-ModbusSlave; 4098-ModbusMaster
4* @return Codice errore
5*/
6int SetExDevProtocol(int protocol);

11.42. Esempio Programma Impostazione Protocollo Periferiche Robot

1private void btnSetProto_Click(object sender, EventArgs e)
2{
3  int protocol = 4096;
4  int rtn = robot.SetExDevProtocol(protocol);
5  Console.WriteLine("SetExDevProtocol rtn " + rtn);
6  rtn = robot.GetExDevProtocol(ref protocol);
7  Console.WriteLine("GetExDevProtocol rtn " + rtn + " protocol is: " + protocol);
8}

11.43. Ottenere Parametri Comunicazione Estremità

1/**
2* @brief Ottenere Parametri Comunicazione Estremità
3* @param param Parametri comunicazione estremità
4* @return   Codice errore
5*/
6int GetAxleCommunicationParam(ref AxleComParam getParam);

11.44. Impostare Parametri Comunicazione Estremità

1/**
2* @brief Impostare Parametri Comunicazione Estremità
3* @param param  Parametri comunicazione estremità
4* @return   Codice errore
5*/
6int SetAxleCommunicationParam(AxleComParam param);

11.45. Impostare Tipo Trasmissione File Estremità

1/**
2* @brief Impostare Tipo Trasmissione File Estremità
3* @param type 1-file aggiornamento MCU; 2-file LUA
4* @return   Codice errore
5*/
6int SetAxleFileType(int type);

11.46. Impostare Abilitazione Esecuzione LUA Estremità

1/**
2* @brief Impostare Abilitazione Esecuzione LUA Estremità
3* @param enable 0-non abilitato; 1-abilitato
4* @return   Codice errore
5*/
6int SetAxleLuaEnable(int enable);

11.47. Recupero Errore Anomalo File LUA Estremità

1/**
2* @brief Recupero Errore Anomalo File LUA Estremità
3* @param status 0-non recuperare; 1-recupera
4* @return   Codice errore
5*/
6int SetRecoverAxleLuaErr(int status);

11.48. Ottenere Stato Abilitazione Esecuzione LUA Estremità

1/**
2* @brief Ottenere Stato Abilitazione Esecuzione LUA Estremità
3* @param [out] status 0-non abilitato; 1-abilitato
4* @return   Codice errore
5*/
6int GetAxleLuaEnableStatus(ref int status);

11.49. Impostare Tipo Dispositivi Estremità Abilitati LUA Estremità

1/**
2* @brief Impostare Tipo Dispositivi Estremità Abilitati LUA Estremità
3* @param [in] forceSensorEnable Stato abilitazione sensore forza, 0-non abilitato; 1-abilitato
4* @param [in] gripperEnable Stato abilitazione pinza, 0-non abilitato; 1-abilitato
5* @param [in] IOEnable Stato abilitazione dispositivo IO, 0-non abilitato; 1-abilitato
6* @return   Codice errore
7*/
8int SetAxleLuaEnableDeviceType(int forceSensorEnable, int gripperEnable, int IOEnable);

11.50. Ottenere Tipo Dispositivi Estremità Abilitati LUA Estremità

1/**
2* @brief Ottenere Tipo Dispositivi Estremità Abilitati LUA Estremità
3* @param [out] forceSensorEnable Stato abilitazione sensore forza, 0-non abilitato; 1-abilitato
4* @param [out] gripperEnable Stato abilitazione pinza, 0-non abilitato; 1-abilitato
5* @param [out] IOEnable Stato abilitazione dispositivo IO, 0-non abilitato; 1-abilitato
6* @return   Codice errore
7*/
8int GetAxleLuaEnableDeviceType(ref int forceSensorEnable, ref int gripperEnable, ref int IOEnable);

11.51. Ottenere Dispositivi Estremità Configurati Correntemente

1/**
2* @brief Ottenere Dispositivi Estremità Configurati Correntemente
3* @param [out] forceSensorEnable Numero dispositivo sensore forza abilitato 0-non abilitato; 1-abilitato
4* @param [out] gripperEnable Numero dispositivo pinza abilitato, 0-non abilitato; 1-abilitato
5* @param [out] IODeviceEnable Numero dispositivo IO abilitato, 0-non abilitato; 1-abilitato
6* @return   Codice errore
7*/
8int GetAxleLuaEnableDevice(ref int[] forceSensorEnable, ref int[] gripperEnable, ref int[] IODeviceEnable);

11.52. Impostare Funzione Controllo Azione Pinza Abilitata

1/**
2* @brief Impostare Funzione Controllo Azione Pinza Abilitata
3* @param [in] id Numero dispositivo pinza
4* @param [in] func func[0]-abilitazione pinza; func[1]-inizializzazione pinza; 2-impostazione posizione; 3-impostazione velocità; 4-impostazione coppia; 6-lettura stato pinza; 7-lettura stato inizializzazione; 8-lettura codice errore; 9-lettura posizione; 10-lettura velocità; 11-lettura coppia
5* @return   Codice errore
6*/
7int SetAxleLuaGripperFunc(int id, int[] func);

11.53. Ottenere Funzione Controllo Azione Pinza Abilitata

1/**
2* @brief Ottenere Funzione Controllo Azione Pinza Abilitata
3* @param [in] id Numero dispositivo pinza
4* @param [out] func func[0]-abilitazione pinza; func[1]-inizializzazione pinza; 2-impostazione posizione; 3-impostazione velocità; 4-impostazione coppia; 6-lettura stato pinza; 7-lettura stato inizializzazione; 8-lettura codice errore; 9-lettura posizione; 10-lettura velocità; 11-lettura coppia
5* @return   Codice errore
6*/
7int GetAxleLuaGripperFunc(int id, ref int[] func);

11.54. Scrittura File Slave Robot Ethercat

1/**
2* @brief Scrittura File Slave Robot Ethercat
3* @param [in] type Tipo file slave, 1-aggiornamento file slave; 2-aggiornamento file configurazione slave
4* @param [in] slaveID Numero slave
5* @param [in] fileName Nome file caricamento
6* @return   Codice errore
7*/
8int SlaveFileWrite(int type, int slaveID, string fileName);

11.55. Caricamento File Protocollo Aperto LUA Estremità

1/**
2* @brief Caricamento File Protocollo Aperto LUA Estremità
3* @param filePath Nome percorso file lua locale ".../AXLE_LUA_End_DaHuan.lua"
4* @return Codice errore
5*/
6int AxleLuaUpload(string filePath);

11.56. Impostare Modalità Boot Slave Ethercat Robot

1/**
2* @brief Impostare Modalità Boot Slave Ethercat Robot
3* @return   Codice errore
4*/
5int SetSysServoBootMode();

11.57. Esempio Codice Operazioni File LUA Estremità Robot

 1private void button41_Click(object sender, EventArgs e)
 2{
 3    ROBOT_STATE_PKG pkg = new ROBOT_STATE_PKG();
 4    robot.AxleLuaUpload("D://zUP/AXLE_LUA_End_JunDuo_Xinjingcheng.lua");
 5
 6    AxleComParam param = new AxleComParam(7, 8, 1, 0, 5, 3, 1);
 7    robot.SetAxleCommunicationParam(param);
 8
 9    AxleComParam getParam = new AxleComParam();
10    robot.GetAxleCommunicationParam(ref getParam);
11    Console.WriteLine("GetAxleCommunicationParam param is {0} {1} {2} {3} {4} {5} {6}",
12        getParam.baudRate, getParam.dataBit, getParam.stopBit, getParam.verify,
13        getParam.timeout, getParam.timeoutTimes, getParam.period);
14
15    robot.SetAxleLuaEnable(1);
16    int luaEnableStatus = 0;
17    robot.GetAxleLuaEnableStatus(ref luaEnableStatus);
18    robot.SetAxleLuaEnableDeviceType(0, 1, 0);
19
20    int forceEnable = 0;
21    int gripperEnable = 0;
22    int ioEnable = 0;
23    robot.GetAxleLuaEnableDeviceType(ref forceEnable, ref gripperEnable, ref ioEnable);
24    Console.WriteLine("GetAxleLuaEnableDeviceType param is {0} {1} {2}", forceEnable, gripperEnable, ioEnable);
25
26    int[] func = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
27    robot.SetAxleLuaGripperFunc(1, func);
28    int[] getFunc = new int[16];
29    robot.GetAxleLuaGripperFunc(1, ref getFunc);
30    int[] getforceEnable = new int[16];
31    int[] getgripperEnable = new int[16];
32    int[] getioEnable = new int[16];
33    robot.GetAxleLuaEnableDevice(ref getforceEnable, ref getgripperEnable, ref getioEnable);
34    Console.WriteLine("\ngetforceEnable status : ");
35    foreach (int i in getforceEnable)
36    {
37        Console.Write(i + ",");
38    }
39    Console.WriteLine("\ngetgripperEnable status : ");
40    foreach (int i in getgripperEnable)
41    {
42        Console.Write(i + ",");
43    }
44    Console.WriteLine("\ngetioEnable status : ");
45    foreach (int i in getioEnable)
46    {
47        Console.Write(i + ",");
48    }
49    Console.WriteLine();
50    robot.ActGripper(1, 0);
51    Thread.Sleep(2000);
52    robot.ActGripper(1, 1);
53    Thread.Sleep(2000);
54    robot.MoveGripper(1, 90, 10, 100, 50000, 0, 0, 0, 0, 0);
55    int pos = 0;
56    while (true)
57    {
58        robot.GetRobotRealTimeState(ref pkg);
59        Console.WriteLine("gripper pos is " + pkg.gripper_position);
60        Thread.Sleep(100);
61    }
62}

11.58. Ottenere Stato Pulsante SmartTool

Nuovo nella versione C#SDK-V1.1.3: Web-3.8.2

1/**
2* @brief Ottenere Stato Pulsante SmartTool
3* @param [out] state Stato pulsanti manopola SmartTool;(bit0:0-comunicazione normale; 1-perdita comunicazione; bit1-annulla operazione; bit2-svuota programma;
4    bit3-pulsante A; bit4-pulsante B; bit5-pulsante C; bit6-pulsante D; bit7-pulsante E; bit8-pulsante IO; bit9-manuale/automatico; bit10-inizia)
5* @return Codice errore
6*/
7int GetSmarttoolBtnState(ref int state);

11.59. Esempio Codice

Nuovo nella versione C#SDK-V1.1.3: Web-3.8.2

 1private void button11_Click(object sender, EventArgs e)
 2{
 3
 4    ROBOT_STATE_PKG pkg = new ROBOT_STATE_PKG();
 5    int state = 0;
 6    while (true)
 7    {
 8        int rtn = robot.GetSmarttoolBtnState(ref state);
 9        string binaryString = Convert.ToString(state, 2).PadLeft(32, '0');
10        Console.WriteLine($"GetSmarttoolBtnState rtn (binario): {binaryString}");
11        Thread.Sleep(100);
12    }
13
14}

11.60. Caricamento File Lua Protocollo Aperto

Nuovo nella versione C#SDK-V1.1.7: Web-3.8.5

1/**
2* @brief Caricamento File Lua Protocollo Aperto
3* @param  filePath Nome percorso file lua protocollo aperto locale
4* @return Codice errore
5*/
6public int OpenLuaUpload(string filePath)

11.61. Ottenere Parametri Scheda Slave

Nuovo nella versione C#SDK-V1.1.7: Web-3.8.5

1/**
2* @brief  Ottenere Parametri Scheda Slave
3* @param  type  0-Ethercat,1-CClink, 3-Ethercat, 4-EIP
4* @param  version  Versione protocollo
5* @param  connState  0-non connesso 1-connesso
6* @return   Codice errore
7*/
8public int GetFieldBusConfig(int[] type, int[] version, int[] connState)

11.62. Scrittura DO Slave

Nuovo nella versione C#SDK-V1.1.7: Web-3.8.5

1/**
2* @brief  Scrittura DO Slave
3* @param   DOIndex  Numero DO
4* @param   wirteNum  Quantità scrittura
5* @param   status Valori scrittura, massimo 8
6* @return   Codice errore
7*/
8public int FieldBusSlaveWriteDO(int DOIndex, int wirteNum, int[] status)

11.63. Scrittura AO Slave

Nuovo nella versione C#SDK-V1.1.7: Web-3.8.5

1/**
2* @brief  Scrivere AO della stazione slave
3* @param [in] AOIndex Numero AO
4* @param [in] writeNum Numero di valori da scrivere
5* @param [in] status Array di valori da scrivere (massimo 8), AO0~AO15 sono di tipo intero, AO16~AO31 sono di tipo floating point
6* @return Codice di errore
7*/
8public int FieldBusSlaveWriteAO(int AOIndex, int writeNum, double[] status)

11.64. Lettura DI Slave

Nuovo nella versione C#SDK-V1.1.7: Web-3.8.5

1/**
2* @brief  Lettura DI Slave
3* @param  DOIndex  Numero DI
4* @param  readNum  Quantità lettura
5* @param  status Valori letti, massimo 8
6* @return   Codice errore
7*/
8public int FieldBusSlaveReadDI(int DOIndex, int readNum, int[] status)

11.65. Lettura AI Slave

Nuovo nella versione C#SDK-V1.1.7: Web-3.8.5

1/**
2* @brief  Lettura AI Slave
3* @param  AIIndex  Numero AI
4* @param  readNum  Quantità lettura
5* @param  status Valori letti, massimo 8
6* @return   Codice errore
7*/
8public int FieldBusSlaveReadAI(int AIIndex, int readNum, double[] status)

11.66. Attesa Input DI Esteso

Nuovo nella versione C#SDK-V1.1.7: Web-3.8.5

1/**
2* @brief Attesa Input DI Esteso
3* @param  DIIndex Numero DI
4* @param  status 0-livello basso; 1-livello alto
5* @param  waitMs Tempo massimo attesa(ms)
6* @return Codice errore
7*/
8public int FieldBusSlaveWaitDI(int DIIndex, int status, int waitMs)

11.67. Attesa Input AI Esteso

Nuovo nella versione C#SDK-V1.1.7: Web-3.8.5

1/**
2* @brief Attesa Input AI Esteso
3* @param  AIIndex Numero AI
4* @param  waitType 0-maggiore; 1-minore
5* @param  value Valore AI
6* @param  waitMs Tempo massimo attesa(ms)
7* @return Codice errore
8*/
9public int FieldBusSlaveWaitAI(int AIIndex, int waitType, double value, int waitMs)

11.68. Esempio Codice Istruzioni Interfacce Relative Modalità Slave

 1private void button101_Click(object sender, EventArgs e)
 2{
 3    int rtn = 0;
 4
 5    int type = 0, version = 0, connState = 0;
 6    int[] ctrl = new int[8];
 7    double[] ctrlAO = new double[8];
 8    int[] DI = new int[8];
 9    double[] AI = new double[8];
10    if (rtn != 0)
11    {
12        return;
13    }
14    // Caricare e caricare file protocollo aperto
15    robot.OpenLuaUpload("E://temp/CtrlDev_field.lua");
16    Thread.Sleep(2000);
17    robot.SetCtrlOpenLUAName(3, "CtrlDev_field.lua");
18    robot.UnloadCtrlOpenLUA(3);
19    robot.LoadCtrlOpenLUA(3);
20    Thread.Sleep(8000);
21
22    // Ottenere tipo protocollo, versione software, stato connessione con PLC
23    robot.GetFieldBusConfig(ref type, ref version, ref connState);
24    Console.WriteLine($"type is {type}, version is {version}, connState is {connState}");
25
26    // Scrivere DO0 = 1, DO1 = 0, DO2 = 1
27    ctrl[0] = 1;
28    ctrl[1] = 0;
29    ctrl[2] = 1;
30    robot.FieldBusSlaveWriteDO(0, 3, ctrl);
31
32    // Scrivere AO2 = 0x1000
33    ctrlAO[0] = 0x1000;
34    robot.FieldBusSlaveWriteAO(2, 1, ctrlAO);
35
36    for (int i = 0; i < 100; i++)
37    {
38        robot.FieldBusSlaveReadDI(0, 4, ref DI);
39        Console.WriteLine($"DI0 is {DI[0]}, DI1 is {DI[1]}, DI2 is {DI[2]}, DI3 is {DI[3]}");
40        robot.FieldBusSlaveReadAI(0, 3, ref AI);
41        Console.WriteLine($"AI0 is {AI[0]}, AI1 is {AI[1]}, AI2 is {AI[2]}");
42        Thread.Sleep(10);
43    }
44    int ret = robot.FieldBusSlaveWaitDI(0, 1, 100);
45    Console.WriteLine($"FieldBusSlaveWaitDI result is {ret}");
46
47    ret = robot.FieldBusSlaveWaitAI(0, 0, 400.00f, 100);
48    Console.WriteLine($"FieldBusSlaveWaitAI result is {ret}");
49}

11.69. Controllo Ventosa a Matrice

Nuovo nella versione C#SDK-V1.1.7: Web-3.8.5

1/**
2* @brief Controllo Ventosa a Matrice
3* @param  slaveID Numero slave
4* @param  len Lunghezza
5* @param  ctrlValue Valore controllo 1-aspirazione massima pressione vuoto 2-aspirazione pressione vuoto impostata 3-fermare aspirazione
6* @return Codice errore
7*/
8public int SetSuckerCtrl(int slaveID, int len, int[] ctrlValue)

11.70. Ottenere Stato Ventosa a Matrice

Nuovo nella versione C#SDK-V1.1.7: Web-3.8.5

1/**
2* @brief Ottenere Stato Ventosa a Matrice
3* @param  slaveID Numero slave
4* @param  state Stato aspirazione 0-rilascio oggetto 1-rilevato presa oggetto riuscita 2-nessun oggetto aspirato 3-oggetto staccato
5* @param  pressValue Pressione vuoto corrente unità kpa
6* @param  error Codice errore corrente ventosa
7* @return Codice errore
8*/
9public int GetSuckerState(int slaveID, int[] state, int[] pressValue, int[] error)

11.71. Attesa Stato Ventosa

Nuovo nella versione C#SDK-V1.1.7: Web-3.8.5

1/**
2* @brief Attesa Stato Ventosa
3* @param  slaveID Numero slave
4* @param  state Stato aspirazione 0-rilascio oggetto 1-rilevato presa oggetto riuscita 2-nessun oggetto aspirato 3-oggetto staccato
5* @param  ms Tempo massimo attesa
6* @return Codice errore
7*/
8public int WaitSuckerState(int slaveID, int state, int ms)

11.72. Esempio Codice Istruzioni Controllo Ventosa a Matrice

 1private void TestSucker(Robot robot)
 2{
 3
 4    int[] ctrl = new int[20];
 5    int state=0;
 6    int pressValue=0;
 7    int error=0;
 8    int rtn;
 9
10
11    // Caricare e caricare file protocollo aperto
12    robot.OpenLuaUpload(@"C:\SDK\CtrlDev_sucker.lua");
13    Thread.Sleep(2000);
14    robot.UnloadCtrlOpenLUA(1);
15    robot.LoadCtrlOpenLUA(1);
16    Thread.Sleep(1000);
17
18    // Controllare ventosa in modalità broadcast con capacità aspirazione massima
19    ctrl[0] = 1;
20    robot.SetSuckerCtrl(0, 1, ctrl);
21
22    // Monitorare stati ventosa 1 e ventosa 12 in ciclo
23    for (int i = 0; i < 100; i++)
24    {
25        robot.GetSuckerState(1, ref state, ref pressValue, ref error);
26        Console.WriteLine($"sucker1 state is {state}, pressValue is {pressValue}, error num is {error}");
27        robot.GetSuckerState(12, ref state, ref pressValue, ref error);
28        Console.WriteLine($"sucker12 state is {state}, pressValue is {pressValue}, error num is {error}");
29        Thread.Sleep(100);
30    }
31    // Attendere ventosa 1 raggiunga stato aspirato, timeout 100ms
32    int ret = robot.WaitSuckerState(1, 1, 100);
33    Console.WriteLine($"WaitSuckerState result is {ret}");
34
35    // Modalità unicast spegnere ventosa 1 e 12
36    ctrl[0] = 3;
37    robot.SetSuckerCtrl(1, 1, ctrl);
38    robot.SetSuckerCtrl(12, 1, ctrl);
39
40    robot.CloseRPC();
41}

11.73. Funzione Accensione/Spegnimento Periferica Laser

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

1/**
2 * @brief Funzione Accensione/Spegnimento Periferica Laser
3 * @param [in] OnOff 0-spegnere 1-accendere
4 * @param [in] weldId ID saldatura default 0
5 * @return Codice errore
6 */
7public int LaserTrackingLaserOnOff(int OnOff, int weldId)

11.74. Funzione Inizio/Fine Tracciamento Laser

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

1/**
2 * @brief Funzione Inizio/Fine Tracciamento Laser
3 * @param [in] OnOff 0-fine 1-inizio
4 * @param [in] coordId Numero sistema coordinate utensile periferica laser
5 * @return Codice errore
6 */
7public int LaserTrackingTrackOnOff(int OnOff, int coordId)

11.75. Ricerca Posizione Laser - Direzione Fissa Inversa

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

 1/**
 2 * @brief Ricerca Posizione Laser - Direzione Fissa Inversa
 3 * @param [in] direction 0-x+ 1-x- 2-y+ 3-y- 4-z+ 5-z-
 4 * @param [in] vel Velocità unità%
 5 * @param [in] distance Distanza massima ricerca unità mm
 6 * @param [in] timeout Timeout ricerca unità ms
 7 * @param [in] posSensorNum Numero sistema coordinate utensile calibrato laser
 8 * @return Codice errore
 9 */
10public int LaserTrackingSearchStart_xyz(int direction, int vel, int distance, int timeout, int posSensorNum)

11.76. Ricerca Posizione Laser - Direzione Arbitraria

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

 1/**
 2 * @brief Ricerca Posizione Laser - Direzione Arbitraria
 3 * @param [in] directionPoint Coordinate xyz punto input ricerca
 4 * @param [in] vel Velocità unità%
 5 * @param [in] distance Distanza massima ricerca unità mm
 6 * @param [in] timeout Timeout ricerca unità ms
 7 * @param [in] posSensorNum Numero sistema coordinate utensile calibrato laser
 8 * @return Codice errore
 9 */
10public int LaserTrackingSearchStart_point(DescTran directionPoint, int vel, int distance, int timeout, int posSensorNum)

11.77. Fine Ricerca Posizione Laser

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

1/**
2* @brief  Fine Ricerca Posizione Laser
3* @return Codice errore
4*/
5public int LaserTrackingSearchStop()

11.78. Configurazione IP Laser

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

1/**
2 * @brief Configurazione IP Laser
3 * @param [in] ip Indirizzo IP periferica laser
4 * @param [in] port Numero porta periferica laser
5 * @return Codice errore
6 */
7public int LaserTrackingSensorConfig(string ip, int port)

11.79. Configurazione Periodo Campionamento Periferica Laser

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

1/**
2 * @brief Configurazione Periodo Campionamento Periferica Laser
3 * @param [in] period Periodo campionamento periferica laser unità ms
4 * @return Codice errore
5 */
6public int LaserTrackingSensorSamplePeriod(int period)

11.80. Caricamento Driver Periferica Laser

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

1/**
2 * @brief Caricamento Driver Periferica Laser
3 * @param [in] type Tipo protocollo driver periferica laser 101-Ruiniao 102-Chuangxiang 103-Quanshi 104-Tongzhou 105-Aotai
4 * @return Codice errore
5 */
6public int LoadPosSensorDriver(int type)

11.81. Scaricamento Driver Periferica Laser

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

1/**
2 * @brief Scaricamento Driver Periferica Laser
3 * @return Codice errore
4 */
5public int UnLoadPosSensorDriver()

11.82. Registrazione Traiettoria Saldatura Laser

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

1/**
2 * @brief Registrazione Traiettoria Saldatura Laser
3 * @param [in] status 0-fermare registrazione 1-tracciamento tempo reale  2-iniziare registrazione
4 * @param [in] delayTime Tempo ritardo unità ms
5 * @return Codice errore
6 */
7public int LaserSensorRecord1(int status, int delayTime)

11.83. Riproduzione Traiettoria Saldatura Laser

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

1/**
2 * @brief Riproduzione Traiettoria Saldatura Laser
3 * @param [in] delayTime Tempo ritardo unità ms
4 * @param [in] speed Velocità unità%
5 * @return Codice errore
6 */
7public int LaserSensorReplay(int delayTime, double speed)

11.84. Riproduzione Tracciamento Laser

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

1/**
2 * @brief Riproduzione Tracciamento Laser
3 * @return Codice errore
4 */
5public int MoveLTR()

11.85. Riproduzione Traiettoria Saldatura Laser

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

 1/**
 2* @brief Riproduzione Traiettoria Saldatura Laser
 3* @param [in] delayMode Modalità 0-Tempo Ritardo 1-Distanza Ritardo
 4* @param [in] delayTime Tempo di ritardo in millisecondi (ms)
 5* @param [in] delayDisExAxisNum Numero Asse Esteso
 6* @param [in] delayDis Distanza di ritardo in millimetri (mm)
 7* @param [in] sensitivePara Coefficiente di Sensibilità della Compensazione
 8* @param [in] trackMode Tipo Tracciamento a Punto Fisso. 0-Movimento Asincrono Asse Esteso; 1-Robot
 9* @param [in] triggerMode Metodo di Attivazione Tracciamento a Punto Fisso. 0-Durata Tracciamento; 1-IO
10* @param [in] runTime Durata Tracciamento a Punto Fisso del Robot in secondi (s)
11* @param [in] speed Velocità in percentuale (%)
12* @return Codice Errore
13*/
14public int LaserSensorRecordandReplay(int delayMode, int delayTime, int delayDisExAxisNum,double delayDis, double sensitivePara, int trackMode, int triggerMode,double runTime, double speed)

11.86. Movimento a Punto Inizio Registrazione Saldatura

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

1/**
2 * @brief Movimento a Punto Inizio Registrazione Saldatura
3 * @param [in] moveType 0-PTP 1-LIN
4 * @param [in] ovl Velocità unità%
5 * @return Codice errore
6 */
7public int MoveToLaserRecordStart(int moveType, double ovl)

11.87. Movimento a Punto Fine Registrazione Saldatura

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

1/**
2 * @brief Movimento a Punto Fine Registrazione Saldatura
3 * @param [in] moveType 0-PTP 1-LIN
4 * @param [in] ovl Velocità unità%
5 * @return Codice errore
6 */
7public int MoveToLaserRecordEnd(int moveType, double ovl)

11.88. Movimento a Punto Ricerca Sensore Laser

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

 1/**
 2 * @brief Movimento a Punto Ricerca Sensore Laser
 3 * @param [in] moveFlag Tipo movimento: 0-PTP; 1-LIN
 4 * @param [in] ovl Fattore di scala velocità, 0-100
 5 * @param [in] dataFlag Selezione dati cache saldatura: 0-eseguire dati pianificati; 1-eseguire dati registrati
 6 * @param [in] plateType Tipo piastra: 0-piastra ondulata; 1-piastra a nido d'ape; 2-piastra recinzione; 3-fusto olio; 4-acciaio corazza ondulata
 7 * @param [in] trackOffectType Tipo offset sensore laser: 0-nessun offset; 1-offset sistema base; 2-offset sistema utensile; 3-offset dati originali sensore laser
 8 * @param [in] offset Quantità offset
 9 * @return Codice errore
10 */
11public int MoveToLaserSeamPos(int moveFlag, double ovl, int dataFlag, int plateType, int trackOffectType, DescPose offset)

11.89. Ottenere Informazioni Coordinate Punto Ricerca Sensore Laser

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

 1/**
 2 * @brief Ottenere Informazioni Coordinate Punto Ricerca Sensore Laser
 3 * @param [in] trackOffectType Tipo offset sensore laser: 0-nessun offset; 1-offset sistema base; 2-offset sistema utensile; 3-offset dati originali sensore laser
 4 * @param [in] offset Quantità offset
 5 * @param [out] jPos Posizione articolare[°]
 6 * @param [out] descPos Posizione cartesiana[mm]
 7 * @param [out] tool Sistema coordinate utensile
 8 * @param [out] user Sistema coordinate pezzo
 9 * @param [out] exaxis Posizione asse esteso[mm]
10 * @return Codice errore
11 */
12public int GetLaserSeamPos(int trackOffectType, DescPose offset, ref JointPos jPos, ref DescPose descPos, ref int tool, ref int user, ref ExaxisPos exaxis)

11.90. Esempio Codice Configurazione Parametri Sensore Periferica Laser e Debug

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

 1void testLaserConfig()
 2{
 3    int[] ctrl = new int[20];
 4    int state;
 5    int pressValue;
 6    int error;
 7    robot.LaserTrackingSensorConfig("192.168.58.20", 5020);
 8    robot.LaserTrackingSensorSamplePeriod(20);
 9    robot.LoadPosSensorDriver(101);
10    robot.LaserTrackingLaserOnOff(0, 0);
11    System.Threading.Thread.Sleep(3000);
12    robot.LaserTrackingLaserOnOff(1, 0);
13}

11.91. Esempio Codice Scansione Traiettoria Laser e Riproduzione Traiettoria

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

 1void testLaserRecordAndReplay()
 2{
 3    int[] ctrl = new int[20];
 4    int state;
 5    int pressValue;
 6    int error;
 7    robot.OpenLuaUpload("D://zUP/CtrlDev_laser_ruiniu-0117.lua");
 8    System.Threading.Thread.Sleep(2000);
 9    robot.SetCtrlOpenLUAName(0, "CtrlDev_laser_ruiniu-0117.lua");
10    robot.UnloadCtrlOpenLUA(0);
11    robot.LoadCtrlOpenLUA(0);
12    System.Threading.Thread.Sleep(8000);
13    for (int i=0;i<10;++i)
14    {
15        JointPos startjointPos = new JointPos(56.205, -117.951, 141.872, -118.149, -94.217, -122.176);
16        DescPose startdescPose = new DescPose(-97.552, -282.855, 26.675, 174.182, -1.338, -91.707);
17        ExaxisPos exaxisPos = new ExaxisPos(0, 0, 0, 0);
18        DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
19
20        robot.MoveL(startjointPos, startdescPose, 1, 0, 100, 100, 100, -1, exaxisPos, 0, 0, offdese, 0);
21        robot.LaserSensorRecord1(2, 10);
22
23        JointPos endjointPos = new JointPos(68.809, -87.100, 121.120, -127.233, -95.038, -109.555);
24        DescPose enddescPose = new DescPose(-103.555, -464.234, 13.076, 174.179, -1.344, -91.709);
25        robot.MoveL(endjointPos, enddescPose, 1, 0, 50, 100, 100, -1, exaxisPos, 0, 0, offdese, 0);
26
27        robot.LaserSensorRecord1(0, 10);
28        robot.MoveToLaserRecordStart(1, 30);
29        robot.LaserSensorReplay(10, 100);
30        robot.MoveLTR();
31        robot.LaserSensorRecord1(0, 10);
32        Console.WriteLine($"Numero completamenti : {i+1} ");
33    }
34
35}

11.92. Esempio Codice Ricerca Posizione Laser e Tracciamento Tempo Reale

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

 1public static void testLasertrack()
 2{
 3    int[] ctrl = new int[20];
 4    int state;
 5    int pressValue;
 6    int error;
 7    robot.OpenLuaUpload("D://zUP/CtrlDev_laser_ruiniu-0117.lua");
 8    System.Threading.Thread.Sleep(2000);
 9    robot.SetCtrlOpenLUAName(0, "CtrlDev_laser_ruiniu-0117.lua");
10    robot.UnloadCtrlOpenLUA(0);
11    robot.LoadCtrlOpenLUA(0);
12    System.Threading.Thread.Sleep(8000);
13    for (int i = 0; i < 10; ++i)
14    {
15        JointPos startjointPos = new JointPos(56.205, -117.951, 141.872, -118.149, -94.217, -122.176);
16        DescPose startdescPose = new DescPose(-97.552, -282.855, 26.675, 174.182, -1.338, -91.707);
17        ExaxisPos exaxisPos = new ExaxisPos(0, 0, 0, 0);
18        DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
19        DescTran directionPoint = new DescTran();
20
21        robot.MoveL(startjointPos, startdescPose, 1, 0, 100, 100, 100, -1, exaxisPos, 0, 0, offdese, 0);
22        robot.LaserTrackingSearchStart_xyz(3, 100, 300, 1000, 3);
23        robot.LaserTrackingSearchStop();
24        robot.MoveToLaserSeamPos(1, 30, 0, 0, 0, offdese);
25
26        robot.LaserTrackingTrackOnOff(1, 3);
27
28        JointPos endjointPos = new JointPos(68.809, -87.100, 121.120, -127.233, -95.038, -109.555);
29        DescPose enddescPose = new DescPose(-103.555, -464.234, 13.076, 174.179, -1.344, -91.709);
30        robot.MoveL(endjointPos, enddescPose, 1, 0, 20, 100, 100, -1, exaxisPos, 0, 0, offdese, 0);
31        robot.LaserTrackingTrackOnOff(0, 3);
32        Console.WriteLine($"Numero completamenti : {i + 1} ");
33    }
34}

11.93. Esempio Codice Tracciamento Laser con Asse Esteso e Robot Sincronizzati

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

 1public void TestLaserTrackAndExitAxis()
 2{
 3    ExaxisPos startexaxisPos = new ExaxisPos(0, 0, 0, 0);
 4    ExaxisPos seamexaxisPos = new ExaxisPos(-10, 0, 0, 0);
 5    ExaxisPos endexaxisPos = new ExaxisPos(-30, 0, 0, 0);
 6    DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
 7    JointPos startjointPos = new JointPos(58.337, -119.628, 146.037, -116.358, -92.224, -117.654);
 8    DescPose startdescPose = new DescPose(-53.375, -255.363, 0.919, 178.054, 1.077, -94.026);
 9    for (int i=0;i<10;++i)
10    {
11        robot.ExtAxisSyncMoveJ(startjointPos, startdescPose, 1, 0, 100, 100, 100, startexaxisPos, -1, 0, offdese);
12        Console.WriteLine("11111");
13        int ret = robot.LaserTrackingSearchStart_xyz(3, 100, 300, 1000, 2);
14        robot.LaserTrackingSearchStop();
15        Console.WriteLine("2222");
16        int tool = 0;
17        int user = 0;
18        JointPos seamjointPos = new JointPos();
19        DescPose seamdescPose = new DescPose();
20        robot.GetLaserSeamPos(0, offdese, ref seamjointPos, ref seamdescPose, ref tool, ref user, ref startexaxisPos);
21        Console.WriteLine($"{seamjointPos.jPos[0]}, {seamjointPos.jPos[1]}, {seamjointPos.jPos[2]}, " +
22                        $"{seamjointPos.jPos[3]}, {seamjointPos.jPos[4]}, {seamjointPos.jPos[5]}, " +
23                        $"{seamdescPose.tran.x}, {seamdescPose.tran.y}, {seamdescPose.tran.z}, " +
24                        $"{seamdescPose.rpy.rx}, {seamdescPose.rpy.ry}, {seamdescPose.rpy.rz}");
25        if (ret == 0)
26        {
27            robot.ExtAxisSyncMoveJ(seamjointPos, seamdescPose, 1, 0, 100, 100, 100, seamexaxisPos, -1, 0, offdese);
28            Console.WriteLine("3333");
29            robot.LaserTrackingTrackOnOff(1, 2);
30            JointPos endjointPos = new JointPos(70.580, -90.918, 126.593, -125.154, -92.162, -105.403);
31            DescPose enddescPose = new DescPose(-53.375, -419.020, 0.920, 178.054, 1.076, -94.026);
32            robot.ExtAxisSyncMoveL(endjointPos, enddescPose, 1, 0, 20, 100, 100, -1, endexaxisPos, 0, offdese);
33            robot.LaserTrackingTrackOnOff(0, 2);
34        }
35        Console.WriteLine($"Numero completamenti : {i + 1} ");
36    }
37}

11.94. Abilita/Disabilita Funzione di Trasmissione Trasparente dell’End-Effector

1/**
2* @brief Abilita la funzione di trasmissione trasparente generale dell'end-effector
3* @param [in] abilitazione, 0-disabilita, 1-abilita
4* @return Codice di errore
5*/
6public int SetAxleGenComEnable(int mode)

11.95. Trasmissione e Ricezione Dati Non Periodici della Funzione di Trasmissione Trasparente dell’End-Effector

1/**
2* @brief L'end-effector invia dati non periodici e attende risposta
3* @param [in] len_snd, lunghezza dei dati da inviare
4* @param [in] sndBuff[], dati da inviare
5* @param [in] len_rcv, lunghezza dei dati da ricevere
6* @param [out] rcvBuff[], dati di risposta
7* @return Codice di errore
8*/
9public int SndRcvAxleGenComCmdData(int len_snd, int[] sndBuff, int len_rcv, ref int[] rcvdata)

11.96. Esempio di Codice per Comunicazione Dati Non Periodici del DIO Health Care Moxibustion Head basato sulla Funzione di Trasmissione Trasparente dell’End-Effector

 1void testAxleGenCom()
 2{
 3    int[] led_on = new int[6] { 0xAB, 0xBA, 0x12, 0x01, 0x01, 0x79 };
 4    int[] led_off = new int[6] { 0xAB, 0xBA, 0x12, 0x01, 0x00, 0x78 };
 5    int[] version = new int[5]{ 0xAB, 0xBA, 0x11, 0x00, 0x76 };
 6    int[] state = new int[6] { 0xAB, 0xBA, 0x1B,0x01, 0xAA, 0x2B };
 7    int[] cycleState = new int[6] { 0xAB, 0xBA, 0x12, 0x01, 0x00, 0x78 };
 8
 9    int[] rcvdata = new int[16];
10    int ret = 0;
11    int cnt = 1;
12
13    JointPos p1Joint = new JointPos(88.708, -86.178, 140.989, -141.825, -89.162, -49.879);
14    DescPose p1Desc = new DescPose(188.007, -377.850, 260.207, 178.715, 2.823, -131.466);
15
16    JointPos p2Joint = new JointPos(112.131, -75.554, 126.989, -139.027, -88.044, -26.477);
17    DescPose p2Desc = new DescPose(368.003, -377.848, 260.211, 178.715, 2.823, -131.465);
18
19    ExaxisPos exaxisPos = new ExaxisPos(0, 0, 0, 0);
20    DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
21
22    //Abilita la funzione di trasmissione trasparente dell'end-effector
23    robot.SetAxleGenComEnable(1);
24    robot.SetAxleLuaEnable(1);
25
26    while(cnt<=10)
27    {
28        //Legge il numero di versione
29        ret = robot.SndRcvAxleGenComCmdData(5, version, 10, ref rcvdata);
30        Console.WriteLine($" hard version : {rcvdata[4]},hard code:{rcvdata[5]}, soft version:{rcvdata[6]} {rcvdata[7]}, soft code:{rcvdata[8]}");
31        if (ret != 0)
32        {
33            break;
34        }
35        Thread.Sleep(1000);
36        //Legge lo stato di presenza della testa di moxibustione
37        ret = robot.SndRcvAxleGenComCmdData(6, state, 6, ref rcvdata);
38        Console.WriteLine($" state : {rcvdata[4]}");
39        Thread.Sleep(1000);
40        //Accende il laser della testa di moxibustione
41        ret = robot.SndRcvAxleGenComCmdData(6, led_on, 6, ref rcvdata);
42        Console.WriteLine($"led on rcv data is: {rcvdata[0]},{rcvdata[1]}, {rcvdata[2]}, {rcvdata[3]}, {rcvdata[4]}, {rcvdata[5]}");
43        robot.MoveJ(p1Joint, p1Desc, 0, 0, 100, 100, 100, exaxisPos, -1, 0, offdese);
44        Thread.Sleep(4000);
45        //Spegne il laser della testa di moxibustione
46        ret = robot.SndRcvAxleGenComCmdData(6, led_off, 6, ref rcvdata);
47        Console.WriteLine($"led off rcv data is: {rcvdata[0]},{rcvdata[1]}, {rcvdata[2]}, {rcvdata[3]}, {rcvdata[4]}, {rcvdata[5]}");
48        robot.MoveJ(p2Joint, p2Desc, 0, 0, 100, 100, 100, exaxisPos, -1, 0, offdese);
49        Thread.Sleep(1000);
50        Console.WriteLine($"***********************complate No. {cnt}  SDK test*****************************");
51        cnt++;
52    }
53
54}

11.97. Scarica File Lua di Protocollo Aperto

1/**
2* @brief Scarica file Lua di protocollo aperto
3* @param [in] fileName Nome del file di protocollo aperto "CtrlDev_XXX.lua"
4* @param [in] savePath Percorso di salvataggio del file di protocollo aperto
5* @return Codice di errore
6*/
7public int OpenLuaDownload(string fileName, string savePath)

11.98. Elimina File Lua di Protocollo Aperto

1/**
2* @brief Elimina file Lua di protocollo aperto
3* @param [in] fileName Nome del file Lua di protocollo aperto da eliminare "CtrlDev_XXX.lua"
4* @return Codice di errore
5*/
6public int OpenLuaDelete(string fileName)

11.99. Elimina Tutti i File Lua di Protocollo Aperto

1/**
2* @brief Elimina tutti i file Lua di protocollo aperto
3* @return Codice di errore
4*/
5public int AllOpenLuaDelete()

11.100. Esempio di Codice SDK per Operazioni su File Lua di Protocollo Aperto

 1public int TestCtrlOpenLuaOperate()
 2{
 3    int rtn;
 4
 5    // Carica file Lua sul robot
 6    rtn = robot.OpenLuaUpload("D://zUP/openlua/CtrlDev_WELDING_A.lua");
 7    Console.WriteLine($"OpenLuaUpload rtn is {rtn}");
 8    rtn = robot.OpenLuaUpload("D://zUP/openlua/CtrlDev_SWDPOLISH.lua");
 9    Console.WriteLine($"OpenLuaUpload rtn is {rtn}");
10
11    // Scarica file Lua dal robot
12    rtn = robot.OpenLuaDownload("CtrlDev_WELDING_A.lua", "D://zDOWN/");
13    Console.WriteLine($"OpenLuaDownload rtn is {rtn}");
14    rtn = robot.OpenLuaDownload("CtrlDev_SWDPOLISH.lua", "D://zDOWN/");
15    Console.WriteLine($"OpenLuaDownload rtn is {rtn}");
16
17    // Imposta nome Lua di protocollo aperto di controllo
18    rtn = robot.SetCtrlOpenLUAName(0, "CtrlDev_WELDING_A.lua");
19    Console.WriteLine($"SetCtrlOpenLUAName rtn is {rtn}");
20    rtn = robot.SetCtrlOpenLUAName(1, "CtrlDev_SWDPOLISH.lua");
21    Console.WriteLine($"SetCtrlOpenLUAName rtn is {rtn}");
22
23    // Ottiene nome Lua di protocollo aperto di controllo
24    string[] name = new string[4];
25    rtn = robot.GetCtrlOpenLUAName(ref name);
26    Console.WriteLine($"ctrl open lua names : {name[0]}, {name[1]}, {name[2]}, {name[3]}");
27
28    // Carica e scarica Lua di protocollo aperto
29    rtn = robot.LoadCtrlOpenLUA(1);
30    Console.WriteLine($"LoadCtrlOpenLUA rtn is {rtn}");
31    robot.Sleep(2000);
32    rtn = robot.UnloadCtrlOpenLUA(1);
33    Console.WriteLine($"UnloadCtrlOpenLUA rtn is {rtn}");
34
35    // Elimina file Lua specifico e tutti i file Lua
36    rtn = robot.OpenLuaDelete("CtrlDev_WELDING_A.lua");
37    Console.WriteLine($"OpenLuaDelete rtn is {rtn}");
38    rtn = robot.AllOpenLuaDelete();
39    Console.WriteLine($"AllOpenLuaDelete rtn is {rtn}");
40
41    return 0;
42}