8. Interrogazione Stato Robot

8.1. Ottenere Posizione Articolare Corrente (Angoli)

1/**
2* @brief  Ottiene la posizione articolare corrente (angoli)
3* @param  [in] flag 0-bloccante, 1-non bloccante
4* @param  [out] jPos Posizioni delle sei articolazioni, unità deg
5* @return  Codice errore
6*/
7errno_t  GetActualJointPosDegree(uint8_t flag, JointPos *jPos);

8.2. Ottenere Velocità di Feedback Articolare

1/**
2 * @brief  Ottiene velocità di feedback articolare - deg/s
3 * @param  [in] flag 0-bloccante, 1-non bloccante
4 * @param  [out] speed Velocità delle sei articolazioni
5 * @return  Codice errore
6 */
7errno_t  GetActualJointSpeedsDegree(uint8_t flag, float speed[6]);

8.3. Ottenere Accelerazione di Feedback Articolare

1/**
2 * @brief  Ottiene accelerazione di feedback articolare - deg/s^2
3 * @param  [in] flag 0-bloccante, 1-non bloccante
4 * @param  [out] acc Accelerazione delle sei articolazioni
5 * @return  Codice errore
6 */
7errno_t  GetActualJointAccDegree(uint8_t flag, float acc[6]);

8.4. Ottenere Velocità Risultante Istruzionale TCP

1/**
2 * @brief  Ottiene velocità risultante istruzionale TCP
3 * @param  [in] flag 0-bloccante, 1-non bloccante
4 * @param  [out] tcp_speed Velocità lineare
5 * @param  [out] ori_speed Velocità di orientamento
6 * @return  Codice errore
7 */
8errno_t  GetTargetTCPCompositeSpeed(uint8_t flag, float *tcp_speed, float *ori_speed);

8.5. Ottenere Velocità Risultante di Feedback TCP

1/**
2 * @brief  Ottiene velocità risultante di feedback TCP
3 * @param  [in] flag 0-bloccante, 1-non bloccante
4 * @param  [out] tcp_speed Velocità lineare
5 * @param  [out] ori_speed Velocità di orientamento
6 * @return  Codice errore
7 */
8errno_t  GetActualTCPCompositeSpeed(uint8_t flag, float *tcp_speed, float *ori_speed);

8.6. Ottenere Velocità Istruzionale TCP

1/**
2 * @brief  Ottiene velocità istruzionale TCP
3 * @param  [in] flag 0-bloccante, 1-non bloccante
4 * @param  [out] speed Velocità [x,y,z,rx,ry,rz]
5 * @return  Codice errore
6 */
7errno_t  GetTargetTCPSpeed(uint8_t flag, float speed[6]);

8.7. Ottenere Velocità di Feedback TCP

1/**
2 * @brief  Ottiene velocità di feedback TCP
3 * @param  [in] flag 0-bloccante, 1-non bloccante
4 * @param  [out] speed Velocità [x,y,z,rx,ry,rz]
5 * @return  Codice errore
6 */
7errno_t  GetActualTCPSpeed(uint8_t flag, float speed[6]);

8.8. Ottenere Posa Corrente Utensile

1/**
2* @brief  Ottiene la posa corrente dell'utensile
3* @param  [in] flag  0-bloccante, 1-non bloccante
4* @param  [out] desc_pos  Posa utensile
5* @return  Codice errore
6*/
7errno_t  GetActualTCPPose(uint8_t flag, DescPose *desc_pos);

8.9. Ottenere Numero Sistema di Coordinate Utensile Corrente

1/**
2* @brief  Ottiene il numero del sistema di coordinate utensile corrente
3* @param  [in] flag  0-bloccante, 1-non bloccante
4* @param  [out] id  Numero sistema di coordinate utensile
5* @return  Codice errore
6*/
7errno_t  GetActualTCPNum(uint8_t flag, int *id);

8.10. Ottenere Numero Sistema di Coordinate Pezzo Corrente

1/**
2* @brief  Ottiene il numero del sistema di coordinate pezzo corrente
3* @param  [in] flag  0-bloccante, 1-non bloccante
4* @param  [out] id  Numero sistema di coordinate pezzo
5* @return  Codice errore
6*/
7errno_t  GetActualWObjNum(uint8_t flag, int *id);

8.11. Ottenere Posa Corrente Flangia Terminale

1/**
2* @brief  Ottiene la posa corrente della flangia terminale
3* @param  [in] flag  0-bloccante, 1-non bloccante
4* @param  [out] desc_pos  Posa flangia
5* @return  Codice errore
6*/
7errno_t  GetActualToolFlangePose(uint8_t flag, DescPose *desc_pos);

8.12. Ottenere Coppia Corrente Articolare

1/**
2* @brief Ottiene la coppia corrente articolare
3* @param  [in] flag 0-bloccante, 1-non bloccante
4* @param  [out] torques Coppia articolare
5* @return  Codice errore
6*/
7errno_t  GetJointTorques(uint8_t flag, float torques[6]);

8.13. Ottenere Ora di Sistema

1/**
2* @brief  Ottiene l'ora di sistema
3* @param  [out] t_ms Unità ms
4* @return  Codice errore
5*/
6errno_t  GetSystemClock(float *t_ms);

8.14. Interrogare Se il Movimento del Robot è Completato

1/**
2* @brief  Interroga se il movimento del robot è completato
3* @param  [out]  state  0-non completato, 1-completato
4* @return  Codice errore
5*/
6errno_t  GetRobotMotionDone(uint8_t *state);

8.15. Interrogare Lunghezza Buffer Coda Movimento Robot

1/**
2 * @brief  Interroga la lunghezza del buffer della coda di movimento del robot
3 * @param  [out]  len  Lunghezza buffer
4 * @return  Codice errore
5 */
6errno_t  GetMotionQueueLength(int *len);

8.16. Ottenere Stato Arresto di Emergenza Robot

1/**
2* @brief Ottiene lo stato di arresto di emergenza del robot
3* @param [out] state Stato arresto di emergenza, 0-nessun arresto di emergenza, 1-arresto di emergenza
4* @return Codice errore
5*/
6errno_t GetRobotEmergencyStopState(uint8_t *state);

8.17. Ottenere Stato Comunicazione tra SDK e Robot

1/**
2* @brief Ottiene lo stato di comunicazione tra SDK e robot
3* @param [out] state Stato comunicazione, 0-comunicazione normale, 1-comunicazione anomala
4*/
5errno_t GetSDKComState(int *state);

8.18. Ottenere Segnale Arresto di Sicurezza

1/**
2* @brief Ottiene il segnale di arresto di sicurezza
3* @param [out] si0_state Segnale arresto sicurezza SI0, 0-non attivo, 1-attivo
4* @param [out] si1_state Segnale arresto sicurezza SI1, 0-non attivo, 1-attivo
5*/
6errno_t GetSafetyStopState(uint8_t *si0_state, uint8_t *si1_state);

8.19. Ottenere Temperatura Azionamenti Articolari Robot (°C)

Nuovo nella versione C++SDK-v2.1.5.0.

1/**
2* @brief Ottiene la temperatura degli azionamenti articolari del robot (°C)
3* @return Codice errore
4*/
5errno_t GetJointDriverTemperature(double temperature[]);

8.20. Ottenere Coppia Azionamenti Articolari Robot (Nm)

Nuovo nella versione C++SDK-v2.1.5.0.

1/**
2* @brief Ottiene la coppia degli azionamenti articolari del robot (Nm)
3* @return Codice errore
4*/
5errno_t GetJointDriverTorque(double torque[]);

8.21. Ottenere Struttura Stato in Tempo Reale Robot

Nuovo nella versione C++SDK-v2.1.3.0.

1/**
2* @brief Ottiene la struttura dello stato in tempo reale del robot
3* @param [out] pkg Struttura stato in tempo reale robot
4* @return Codice errore
5*/
6errno_t GetRobotRealTimeState(ROBOT_STATE_PKG *pkg);

8.22. Esempio di Codice Interrogazione Stato Robot

 1int TestGetStatus(void)
 2{
 3  ROBOT_STATE_PKG pkg = {};
 4  FRRobot robot;
 5  robot.LoggerInit();
 6  robot.SetLoggerLevel(1);
 7  int rtn = robot.RPC("192.168.58.2");
 8  if (rtn != 0)
 9  {
10    return -1;
11  }
12  robot.SetReConnectParam(true, 30000, 500);
13  float yangle, zangle;
14  robot.GetRobotInstallAngle(&yangle, &zangle);
15  printf("yangle:%f,zangle:%f\n", yangle, zangle);
16  JointPos j_deg = {};
17  robot.GetActualJointPosDegree(0, &j_deg);
18  printf("joint pos deg:%f,%f,%f,%f,%f,%f\n", j_deg.jPos[0], j_deg.jPos[1], j_deg.jPos[2], j_deg.jPos[3], j_deg.jPos[4], j_deg.jPos[5]);
19  float jointSpeed[6] = { 0.0 };
20  robot.GetActualJointSpeedsDegree(0, jointSpeed);
21  printf("joint speeds deg:%f,%f,%f,%f,%f,%f\n", jointSpeed[0], jointSpeed[1], jointSpeed[2], jointSpeed[3], jointSpeed[4], jointSpeed[5]);
22  float jointAcc[6] = { 0.0 };
23  robot.GetActualJointAccDegree(0, jointAcc);
24  printf("joint acc deg:%f,%f,%f,%f,%f,%f\n", jointAcc[0], jointAcc[1], jointAcc[2], jointAcc[3], jointAcc[4], jointAcc[5]);
25  float tcp_speed = 0.0;
26  float ori_speed = 0.0;
27  robot.GetTargetTCPCompositeSpeed(0, &tcp_speed, &ori_speed);
28  printf("GetTargetTCPCompositeSpeed tcp %f; ori %f\n", tcp_speed, ori_speed);
29  robot.GetActualTCPCompositeSpeed(0, &tcp_speed, &ori_speed);
30  printf("GetActualTCPCompositeSpeed tcp %f; ori %f\n", tcp_speed, ori_speed);
31  float targetSpeed[6] = { 0.0 };
32  robot.GetTargetTCPSpeed(0, targetSpeed);
33  printf("GetTargetTCPSpeed %f,%f,%f,%f,%f,%f\n", targetSpeed[0], targetSpeed[1], targetSpeed[2], targetSpeed[3], targetSpeed[4], targetSpeed[5]);
34  float actualSpeed[6] = { 0.0 };
35  robot.GetActualTCPSpeed(0, actualSpeed);
36  printf("GetTargetTCPSpeed %f,%f,%f,%f,%f,%f\n", actualSpeed[0], actualSpeed[1], actualSpeed[2], actualSpeed[3], actualSpeed[4], actualSpeed[5]);
37  DescPose tcp = {};
38  robot.GetActualTCPPose(0, &tcp);
39  printf("tcp pose:%f,%f,%f,%f,%f,%f\n", tcp.tran.x, tcp.tran.y, tcp.tran.z, tcp.rpy.rx, tcp.rpy.ry, tcp.rpy.rz);
40  DescPose flange = {};
41  robot.GetActualToolFlangePose(0, &flange);
42  printf("flange pose:%f,%f,%f,%f,%f,%f\n", flange.tran.x, flange.tran.y, flange.tran.z, flange.rpy.rx, flange.rpy.ry, flange.rpy.rz);
43  int id = 0;
44  robot.GetActualTCPNum(0, &id);
45  printf("tcp num:%d\n", id);
46  robot.GetActualWObjNum(0, &id);
47  printf("wobj num:%d\n", id);
48  float jtorque[6] = { 0.0 };
49  robot.GetJointTorques(0, jtorque);
50  printf("torques:%f,%f,%f,%f,%f,%f\n", jtorque[0], jtorque[1], jtorque[2], jtorque[3], jtorque[4], jtorque[5]);
51  float t_ms = 0.0;
52  robot.GetSystemClock(&t_ms);
53  printf("system clock:%f\n", t_ms);
54  int config = 0;
55  robot.GetRobotCurJointsConfig(&config);
56  printf("joint config:%d\n", config);
57  uint8_t motionDone = 0;
58  robot.GetRobotMotionDone(&motionDone);
59  printf("GetRobotMotionDone :%d\n", motionDone);
60  int len = 0;
61  robot.GetMotionQueueLength(&len);
62  printf("GetMotionQueueLength :%d\n", len);
63  uint8_t emergState = 0;
64  robot.GetRobotEmergencyStopState(&emergState);
65  printf("GetRobotEmergencyStopState :%d\n", emergState);
66  int comstate = 0;
67  robot.GetSDKComState(&comstate);
68  printf("GetSDKComState :%d\n", comstate);
69  uint8_t si0_state, si1_state;
70  robot.GetSafetyStopState(&si0_state, &si1_state);
71  printf("GetSafetyStopState :%d %d\n", si0_state, si1_state);
72  double temp[6] = { 0.0 };
73  robot.GetJointDriverTemperature(temp);
74  printf("Temperature:%f,%f,%f,%f,%f,%f\n", temp[0], temp[1], temp[2], temp[3], temp[4], temp[5]);
75  double torque[6] = { 0.0 };
76  robot.GetJointDriverTorque(torque);
77  printf("torque:%f,%f,%f,%f,%f,%f\n", torque[0], torque[1], torque[2], torque[3], torque[4], torque[5]);
78  robot.GetRobotRealTimeState(&pkg);
79  robot.CloseRPC();
80  return 0;
81}

8.23. Calcolo Cinematica Inversa

1/**
2* @brief  Calcolo cinematica inversa (Inverse Kinematics)
3* @param  [in] type 0-posa assoluta (sistema di coordinate base), 1-posa incrementale (sistema di coordinate base), 2-posa incrementale (sistema di coordinate utensile)
4* @param  [in] desc_pos Posa cartesiana
5* @param  [in] config Configurazione spazio articolare, [-1]-calcolo riferito alla posizione articolare corrente, [0~7]-soluzione basata su specifica configurazione spazio articolare
6* @param  [out] joint_pos Posizione articolare
7* @return  Codice errore
8*/
9errno_t  GetInverseKin(int type, DescPose *desc_pos, int config, JointPos *joint_pos);

8.24. Calcolo Cinematica Inversa (Posizione di Riferimento)

1/**
2* @brief  Calcolo cinematica inversa, risolve riferendosi a una specifica posizione articolare
3* @param  [in] type 0-posa assoluta (sistema di coordinate base), 1-posa incrementale (sistema di coordinate base), 2-posa incrementale (sistema di coordinate utensile)
4* @param  [in] desc_pos Posa cartesiana
5* @param  [in] joint_pos_ref Posizione articolare di riferimento
6* @param  [out] joint_pos Posizione articolare
7* @return  Codice errore
8*/
9errno_t  GetInverseKinRef(int type, DescPose *desc_pos, JointPos *joint_pos_ref, JointPos *joint_pos);

8.25. Soluzione di Cinematica Inversa, Spazio Cartesiano Inclusa Posizione dell’Asse Esteso

 1/**
 2* @brief Soluzione di cinematica inversa, spazio cartesiano inclusa posizione dell'asse esteso
 3* @param [in] type 0-posa assoluta (sistema coordinate base), 1-posa incrementale (sistema coordinate base), 2-posa incrementale (sistema coordinate utensile)
 4* @param [in] desc_pos Posa cartesiana
 5* @param [in] exaxis Posizione asse esteso
 6* @param [in] tool Numero utensile
 7* @param [in] workPiece Numero pezzo
 8* @param [out] joint_pos Posizione giunti
 9* @return Codice di errore
10*/
11errno_t GetInverseKinExaxis(int type, DescPose desc_pos, ExaxisPos exaxis, int tool, int workPiece, JointPos& joint_pos);

8.26. Esempio di Codice per Soluzione di Cinematica Inversa Inclusa Posizione dell’Asse Esteso

 1int TestInverseKinExaxis()
 2{
 3    ROBOT_STATE_PKG pkg = {};
 4    FRRobot robot;
 5    robot.LoggerInit();
 6    robot.SetLoggerLevel(1);
 7    int rtn = robot.RPC("192.168.58.2");
 8    if (rtn != 0)
 9    {
10        return 0;
11    }
12    robot.SetReConnectParam(true, 30000, 500);
13    DescPose desc(99.957, -0.002, 29.994, -176.569, -6.757, -167.462);
14    ExaxisPos exaxis(100.0, 0.0, 0.0, 0.0);
15    JointPos jointPos = {};
16    DescPose offsetPos = {};
17    robot.GetRobotRealTimeState(&pkg);
18    int toolnum = pkg.tool;
19    int workPcsNum = pkg.user;
20    robot.GetInverseKinExaxis(0, desc, exaxis, toolnum, workPcsNum, jointPos);
21    printf("GetInverseKinExaxis joint is %f, %f, %f, %f, %f, %f\n", jointPos.jPos[0], jointPos.jPos[1], jointPos.jPos[2], jointPos.jPos[3], jointPos.jPos[4], jointPos.jPos[5]);
22    robot.ExtAxisMove(exaxis, 100, -1);
23    robot.MoveJ(&jointPos, &desc, toolnum, workPcsNum, 100.0, 100.0, 100.0, &exaxis, -1, 0, &offsetPos);
24    robot.CloseRPC();
25    robot.Sleep(9999999);
26    return 0;
27}

8.27. Verificare Se Esiste Soluzione per Cinematica Inversa

1/**
2* @brief  Calcolo cinematica inversa, verifica se esiste soluzione riferendosi a una specifica posizione articolare
3* @param  [in] type 0-posa assoluta (sistema di coordinate base), 1-posa incrementale (sistema di coordinate base), 2-posa incrementale (sistema di coordinate utensile)
4* @param  [in] desc_pos Posa cartesiana
5* @param  [in] joint_pos_ref Posizione articolare di riferimento
6* @param  [out] result 0-nessuna soluzione, 1-esiste soluzione
7* @return  Codice errore
8*/
9errno_t  GetInverseKinHasSolution(int type, DescPose *desc_pos, JointPos *joint_pos_ref, uint8_t *result);

8.28. Calcolo Cinematica Diretta

1/**
2* @brief  Calcolo cinematica diretta (Forward Kinematics)
3* @param  [in] joint_pos Posizione articolare
4* @param  [out] desc_pos Posa cartesiana
5* @return  Codice errore
6*/
7errno_t  GetForwardKin(JointPos *joint_pos, DescPose *desc_pos);

8.29. Esempio di Codice Calcolo Cinematica Diretta e Inversa Robot

 1int TestInverseKin(void)
 2{
 3  ROBOT_STATE_PKG pkg = {};
 4  FRRobot robot;
 5  robot.LoggerInit();
 6  robot.SetLoggerLevel(1);
 7  int rtn = robot.RPC("192.168.58.2");
 8  if (rtn != 0)
 9  {
10    return -1;
11  }
12  robot.SetReConnectParam(true, 30000, 500);
13  JointPos j1(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
14  DescPose desc_pos1(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
15  JointPos inverseRtn = {};
16  robot.GetInverseKin(0, &desc_pos1, -1, &inverseRtn);
17  printf("dcs1 GetInverseKin rtn is %f %f %f %f %f %f \n", inverseRtn.jPos[0], inverseRtn.jPos[1], inverseRtn.jPos[2], inverseRtn.jPos[3], inverseRtn.jPos[4], inverseRtn.jPos[5]);
18  robot.GetInverseKinRef(0, &desc_pos1, &j1, &inverseRtn);
19  printf("dcs1 GetInverseKinRef rtn is %f %f %f %f %f %f \n", inverseRtn.jPos[0], inverseRtn.jPos[1], inverseRtn.jPos[2], inverseRtn.jPos[3], inverseRtn.jPos[4], inverseRtn.jPos[5]);
20  uint8_t hasResut = 0;
21  robot.GetInverseKinHasSolution(0, &desc_pos1, &j1, &hasResut);
22  printf("dcs1 GetInverseKinRef result %d\n", hasResut);
23  DescPose forwordResult = {};
24  robot.GetForwardKin(&j1, &forwordResult);
25  printf("jpos1 forwordResult rtn is %f %f %f %f %f %f \n", forwordResult.tran.x, forwordResult.tran.y, forwordResult.tran.z, forwordResult.rpy.rx, forwordResult.rpy.ry, forwordResult.rpy.rz);
26  robot.CloseRPC();
27  return 0;
28}

8.30. Interrogare Dati Punti Gestione Insegnamento Robot

1/**
2 * @brief  Interroga i dati dei punti della gestione insegnamento del robot
3 * @param  [in]  name  Nome punto
4 * @param  [out]  data  Dati punto
5 * @return  Codice errore
6 */
7errno_t  GetRobotTeachingPoint(char name[64], float data[20]);

8.31. Ottenere Valori di Compensazione Parametri DH Robot

Nuovo nella versione C++SDK-v2.1.1.0.

1/**
2* @brief Ottiene i valori di compensazione dei parametri DH del robot
3* @param [out] dhCompensation Valori di compensazione parametri DH robot (mm) [cmpstD1,cmpstA2,cmpstA3,cmpstD4,cmpstD5,cmpstD6]
4* @return Codice errore
5*/
6errno_t GetDHCompensation(double dhCompensation[6]);

8.32. Ottenere Codice SN Controllore

Nuovo nella versione C++SDK-v2.2.1-3.8.1.

1/**
2* @brief Ottiene il codice SN del controllore
3* @param [out] SNCode Codice SN controllore
4* @return Codice errore
5*/
6errno_t GetRobotSN(std::string& SNCode);

8.33. Esempio di Codice Interrogazione Dati Punti Gestione Insegnamento

 1int TestGetTeachPoint(void)
 2{
 3  ROBOT_STATE_PKG pkg = {};
 4  FRRobot robot;
 5  robot.LoggerInit();
 6  robot.SetLoggerLevel(1);
 7  int rtn = robot.RPC("192.168.58.2");
 8  if (rtn != 0)
 9  {
10    return -1;
11  }
12  robot.SetReConnectParam(true, 30000, 500);
13  char name[64] = "P1";
14  float data[20] = { 0 };
15  rtn = robot.GetRobotTeachingPoint(name, data);
16  printf(" %d name is: %s \n", rtn, name);
17  for (int i = 0; i < 20; i++)
18  {
19    printf("data is: %f \n", data[i]);
20  }
21  int que_len = 0;
22  rtn = robot.GetMotionQueueLength(&que_len);
23  printf("GetMotionQueueLength rtn is: %d, queue length is: %d \n", rtn, que_len);
24  double dh[6] = { 0 };
25  int retval = 0;
26  retval = robot.GetDHCompensation(dh);
27  cout << "retval is: " << retval << endl;
28  cout << "dh is: " << dh[0] << " " << dh[1] << " " << dh[2] << " " << dh[3] << " " << dh[4] << " " << dh[5] << endl;
29  string SN = "";
30  robot.GetRobotSN(SN);
31  cout << "robot SN is " << SN << endl;
32  robot.CloseRPC();
33  return 0;
34}

8.34. Ottenere Sistema di Coordinate Utensile in Base al Numero

Nuovo nella versione C++SDK-v3.8.6.

1/**
2* @brief Ottiene il sistema di coordinate utensile in base al numero
3* @param [in] id Numero sistema di coordinate utensile
4* @param [out] coord Valori del sistema di coordinate
5* @return Codice errore
6*/
7errno_t GetToolCoordWithID(int id, DescPose& coord);

8.35. Ottenere Sistema di Coordinate Pezzo in Base al Numero

Nuovo nella versione C++SDK-v3.8.6.

1/**
2* @brief Ottiene il sistema di coordinate pezzo in base al numero
3* @param [in] id Numero sistema di coordinate pezzo
4* @param [out] coord Valori del sistema di coordinate
5* @return Codice errore
6*/
7errno_t GetWObjCoordWithID(int id, DescPose& coord);

8.36. Ottenere Sistema di Coordinate Utensile Esterno in Base al Numero

Nuovo nella versione C++SDK-v3.8.6.

1/**
2* @brief Ottiene il sistema di coordinate utensile esterno in base al numero
3* @param [in] id Numero sistema di coordinate utensile esterno
4* @param [out] coord Valori del sistema di coordinate
5* @return Codice errore
6*/
7errno_t GetExToolCoordWithID(int id, DescPose& coord);

8.37. Ottenere Sistema di Coordinate Assi Estesi in Base al Numero

Nuovo nella versione C++SDK-v3.8.6.

1/**
2* @brief Ottiene il sistema di coordinate assi estesi in base al numero
3* @param [in] id Numero sistema di coordinate utensile esterno (Nota: parametro probabilmente da verificare, il nome suggerisce per assi estesi)
4* @param [out] coord Valori del sistema di coordinate
5* @return Codice errore
6*/
7errno_t GetExAxisCoordWithID(int id, DescPose& coord);

8.38. Ottenere Massa e Centro di Gravità del Carico in Base al Numero

Nuovo nella versione C++SDK-v3.8.6.

1/**
2* @brief Ottiene massa e centro di gravità del carico in base al numero
3* @param [in] id Numero carico
4* @param [out] weight Massa del carico
5* @param [out] cog Centro di gravità del carico
6* @return Codice errore
7*/
8errno_t GetTargetPayloadWithID(int id, double& weight, DescTran& cog);

8.39. Ottenere Sistema di Coordinate Utensile Corrente

Nuovo nella versione C++SDK-v3.8.6.

1/**
2* @brief Ottiene il sistema di coordinate utensile corrente
3* @param [out] coord Valori del sistema di coordinate
4* @return Codice errore
5*/
6errno_t GetCurToolCoord(DescPose& coord);

8.40. Ottenere Sistema di Coordinate Pezzo Corrente

Nuovo nella versione C++SDK-v3.8.6.

1/**
2* @brief Ottiene il sistema di coordinate pezzo corrente
3* @param [out] coord Valori del sistema di coordinate
4* @return Codice errore
5*/
6errno_t GetCurWObjCoord(DescPose& coord);

8.41. Ottenere Sistema di Coordinate Utensile Esterno Corrente

Nuovo nella versione C++SDK-v3.8.6.

1/**
2* @brief Ottiene il sistema di coordinate utensile esterno corrente
3* @param [out] coord Valori del sistema di coordinate
4* @return Codice errore
5*/
6errno_t GetCurExToolCoord(DescPose& coord);

8.42. Ottenere Sistema di Coordinate Assi Estesi Corrente

Nuovo nella versione C++SDK-v3.8.6.

1/**
2* @brief Ottiene il sistema di coordinate assi estesi corrente
3* @param [out] coord Valori del sistema di coordinate
4* @return Codice errore
5*/
6errno_t GetCurExAxisCoord(DescPose& coord);

8.43. Esempio di Codice Ottenimento Sistemi di Coordinate e Carico Robot

Nuovo nella versione C++SDK-v3.8.6.

 1int TestCoord()
 2{
 3  ROBOT_STATE_PKG pkg = {};
 4  FRRobot robot;
 5  robot.LoggerInit();
 6  robot.SetLoggerLevel(1);
 7  int rtn = robot.RPC("192.168.58.2");
 8  if (rtn != 0)
 9  {
10    return 0;
11  }
12  robot.SetReConnectParam(true, 30000, 500);
13  int id = 1;
14  DescPose toolCoord = {};
15  DescPose extoolCoord = {};
16  DescPose wobjCoord = {};
17  DescPose exAxisCoord = {};
18  robot.GetToolCoordWithID(id, toolCoord);
19  printf("GetToolCoordWithID %d, %f %f %f %f %f %f\n", id,
20    toolCoord.tran.x, toolCoord.tran.y, toolCoord.tran.z,
21    toolCoord.rpy.rx, toolCoord.rpy.ry, toolCoord.rpy.rz);
22  robot.GetWObjCoordWithID(id, wobjCoord);
23  printf("GetWObjCoordWithID %d, %f %f %f %f %f %f\n", id,
24    wobjCoord.tran.x, wobjCoord.tran.y, wobjCoord.tran.z,
25    wobjCoord.rpy.rx, wobjCoord.rpy.ry, wobjCoord.rpy.rz);
26
27  robot.GetExToolCoordWithID(id, extoolCoord);
28  printf("GetExToolCoordWithID %d, %f %f %f %f %f %f\n", id,
29    extoolCoord.tran.x, extoolCoord.tran.y, extoolCoord.tran.z,
30    extoolCoord.rpy.rx, extoolCoord.rpy.ry, extoolCoord.rpy.rz);
31
32  robot.GetExAxisCoordWithID(id, exAxisCoord);
33  printf("GetExAxisCoordWithID %d, %f %f %f %f %f %f\n", id,
34    exAxisCoord.tran.x, exAxisCoord.tran.y, exAxisCoord.tran.z,
35    exAxisCoord.rpy.rx, exAxisCoord.rpy.ry, exAxisCoord.rpy.rz);
36  double weight = 0.0;
37  DescTran cog = {};
38  robot.GetTargetPayloadWithID(id, weight, cog);
39  printf("GetTargetPayloadWithID %d, %f %f %f %f\n", id, weight,
40    cog.x, cog.y, cog.z);
41  robot.GetCurToolCoord(toolCoord);
42  printf("GetCurToolCoord %f %f %f %f %f %f\n",
43    toolCoord.tran.x, toolCoord.tran.y, toolCoord.tran.z,
44    toolCoord.rpy.rx, toolCoord.rpy.ry, toolCoord.rpy.rz);
45  robot.GetCurWObjCoord(wobjCoord);
46  printf("GetCurWObjCoord %f %f %f %f %f %f\n",
47    wobjCoord.tran.x, wobjCoord.tran.y, wobjCoord.tran.z,
48    wobjCoord.rpy.rx, wobjCoord.rpy.ry, wobjCoord.rpy.rz);
49  robot.GetCurExToolCoord(extoolCoord);
50  printf("GetExToolCoordWithID %f %f %f %f %f %f\n",
51    extoolCoord.tran.x, extoolCoord.tran.y, extoolCoord.tran.z,
52    extoolCoord.rpy.rx, extoolCoord.rpy.ry, extoolCoord.rpy.rz);
53  robot.GetCurExAxisCoord(exAxisCoord);
54  printf("GetCurExAxisCoord %f %f %f %f %f %f\n",
55    exAxisCoord.tran.x, exAxisCoord.tran.y, exAxisCoord.tran.z,
56    exAxisCoord.rpy.rx, exAxisCoord.rpy.ry, exAxisCoord.rpy.rz);
57  float weightT = 0.0;
58  DescTran cogT = {};
59  robot.GetTargetPayload(0, &weightT);
60  robot.GetTargetPayloadCog(0, &cogT);
61  printf("GetTargetPayload %f %f %f %f\n", weightT,
62    cogT.x, cogT.y, cogT.z);
63  DescPose coordSet(0,1,2,3,4,5);
64  robot.SetToolCoord(1, &coordSet, 0, 0, 1, 0);
65  robot.SetWObjCoord(1, &coordSet, 0);
66  robot.SetLoadWeight(1, 1.3);
67  DescTran cog = {};
68  cog.x = 10;
69  cog.y = 20;
70  cog.z = 30;
71  robot.SetLoadCoord(1, &cog);
72  DescPose etcp(0, 0, 100, 0, 0, 0);
73  DescPose etool(0, 0, 50, 0, 0, 0);
74  rtn = robot.SetExToolCoord(1, &etcp, &etool);
75  printf("SetExToolCoord rtn is %d\n", rtn);
76  robot.ExtAxisActiveECoordSys(1, 1, coordSet, 1);
77  robot.CloseRPC();
78  return 0;
79}