7. Roboter-Sicherheitseinstellungen
7.1. Kollisionsstufe einstellen
1/**
2* @brief Stellt die Kollisionsstufe ein.
3* @param [in] mode 0-Stufe, 1-Prozentsatz.
4* @param [in] level Kollisionsschwellwerte, bei mode 0 Bereich [], bei mode 1 Bereich [0~1].
5* @param [in] config 0-Konfigurationsdatei nicht aktualisieren, 1-Konfigurationsdatei aktualisieren.
6* @return Fehlercode.
7*/
8errno_t SetAnticollision(int mode, float level[6], int config);
7.2. Strategie nach Kollision einstellen
Geändert in Version C++SDK-v2.1.5.0.
1/**
2 * @brief Stellt die Strategie nach einer Kollision ein.
3 * @param [in] strategy 0-Fehler und Pause; 1-Fortsetzen; 2-Fehler und Stopp; 3-Schwerkraftmoment-Modus; 4-Schwingungsmodus; 5-Rückprallmodus.
4 * @param [in] safeTime Sichere Stoppzeit [1000 - 2000] ms.
5 * @param [in] safeDistance Sicherer Stoppabstand [1-150] mm.
6 * @param [in] safetyMargin Sicherheitsfaktoren für J1-J6 [1-10].
7 * @return Fehlercode.
8 */
9errno_t SetCollisionStrategy(int strategy, int safeTime, int safeDistance, int safetyMargin[]);
7.3. Benutzerdefinierte Kollisionserkennungsschwelle starten
Neu in Version C++SDK-v2.2.0-3.8.0.
1/**
2 * @brief Startet die Funktion für benutzerdefinierte Kollisionserkennungsschwellen. Legt Schwellen für Gelenk und TCP fest.
3 * @param [in] flag 1-nur Gelenkerkennung aktivieren; 2-nur TCP-Erkennung aktivieren; 3-Gelenk- und TCP-Erkennung gleichzeitig aktivieren.
4 * @param [in] jointDetectionThreshould Gelenk-Kollisionserkennungsschwellen für J1-J6.
5 * @param [in] tcpDetectionThreshould TCP-Kollisionserkennungsschwellen für XYZABC.
6 * @param [in] block 0-nicht blockierend; 1-blockierend.
7 * @return Fehlercode.
8 */
9errno_t CustomCollisionDetectionStart(int flag, double jointDetectionThreshould[6], double tcpDetectionThreshould[6], int block);
7.4. Benutzerdefinierte Kollisionserkennungsschwelle beenden
Neu in Version C++SDK-v2.2.0-3.8.0.
1/**
2 * @brief Beendet die Funktion für benutzerdefinierte Kollisionserkennungsschwellen.
3 * @return Fehlercode.
4 */
5errno_t CustomCollisionDetectionEnd();
7.5. Codebeispiel für Roboter-Kollisionsstufeneinstellungen
1int TestCollision(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 int mode = 0;
14 int config = 1;
15 float level1[6] = { 1.0,2.0,3.0,4.0,5.0,6.0 };
16 float level2[6] = { 50.0,20.0,30.0,40.0,50.0,60.0 };
17 rtn = robot.SetAnticollision(mode, level1, config);
18 printf("SetAnticollision mode 0 rtn is %d\n", rtn);
19 mode = 1;
20 rtn = robot.SetAnticollision(mode, level2, config);
21 printf("SetAnticollision mode 1 rtn is %d\n", rtn);
22 JointPos p1Joint(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
23 JointPos p2Joint(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
24 DescPose p1Desc(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
25 DescPose p2Desc(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
26 ExaxisPos exaxisPos(0.0, 0.0, 0.0, 0.0);
27 DescPose offdese(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
28 robot.MoveL(&p2Joint, &p2Desc, 0, 0, 100, 100, 100, 2, &exaxisPos, 0, 0, &offdese);
29 robot.ResetAllError();
30 int safety[6] = { 5,5,5,5,5,5 };
31 rtn = robot.SetCollisionStrategy(3, 1000, 150, 250, safety);
32 printf("SetCollisionStrategy rtn is %d\n", rtn);
33 double jointDetectionThreshould[6] = { 0.1, 0.1, 0.1, 0.1, 0.1, 0.1 };
34 double tcpDetectionThreshould[6] = { 60,60,60,60,60,60 };
35 rtn = robot.CustomCollisionDetectionStart(3, jointDetectionThreshould, tcpDetectionThreshould, 0);
36 cout << "CustomCollisionDetectionStart rtn is " << rtn << endl;
37 robot.MoveL(&p1Joint, &p1Desc, 0, 0, 100, 100, 100, -1, &exaxisPos, 0, 0, &offdese);
38 robot.MoveL(&p2Joint, &p2Desc, 0, 0, 100, 100, 100, -1, &exaxisPos, 0, 0, &offdese);
39 rtn = robot.CustomCollisionDetectionEnd();
40 cout << "CustomCollisionDetectionEnd rtn is " << rtn << endl;
41 robot.CloseRPC();
42 return 0;
43 }
7.6. Positive Endlage einstellen
1/**
2* @brief Stellt die positive Endlage (Software-Endschalter) ein.
3* @param [in] limit Positionen der sechs Gelenke, Einheit deg.
4* @return Fehlercode.
5*/
6errno_t SetLimitPositive(float limit[6]);
7.7. Negative Endlage einstellen
1/**
2* @brief Stellt die negative Endlage (Software-Endschalter) ein.
3* @param [in] limit Positionen der sechs Gelenke, Einheit deg.
4* @return Fehlercode.
5*/
6errno_t SetLimitNegative(float limit[6]);
7.8. Gelenk-Software-Endschalter-Winkel abrufen
1/**
2* @brief Gibt die Winkel der Gelenk-Software-Endschalter zurück.
3* @param [in] flag 0-blockierend, 1-nicht blockierend.
4* @param [out] negative Negative Endlagenwinkel, Einheit deg.
5* @param [out] positive Positive Endlagenwinkel, Einheit deg.
6* @return Fehlercode.
7*/
8errno_t GetJointSoftLimitDeg(uint8_t flag, float negative[6], float positive[6]);
7.9. Codebeispiel für Roboter-Endlageneinstellungen
1int TestLimit(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 plimit[6] = { 170.0,80.0,150.0,80.0,170.0,160.0 };
14 robot.SetLimitPositive(plimit);
15 float nlimit[6] = { -170.0,-260.0,-150.0,-260.0,-170.0,-160.0 };
16 robot.SetLimitNegative(nlimit);
17 float neg_deg[6] = { 0.0 }, pos_deg[6] = { 0.0 };
18 robot.GetJointSoftLimitDeg(0, neg_deg, pos_deg);
19 printf("neg limit deg:%f,%f,%f,%f,%f,%f\n", neg_deg[0], neg_deg[1], neg_deg[2], neg_deg[3], neg_deg[4], neg_deg[5]);
20 printf("pos limit deg:%f,%f,%f,%f,%f,%f\n", pos_deg[0], pos_deg[1], pos_deg[2], pos_deg[3], pos_deg[4], pos_deg[5]);
21 robot.CloseRPC();
22 return 0;
23}
7.10. Roboter-Kollisionserkennungsmethode einstellen
1/**
2* @brief Stellt die Methode zur Kollisionserkennung des Roboters ein.
3* @param [in] method Kollisionserkennungsmethode: 0-Strommodus; 1-Doppel-Encoder; 2-Strom und Doppel-Encoder gleichzeitig aktivieren.
4* @param [in] thresholdMode Art des Kollisionsstufen-Schwellwerts; 0-Fester Schwellwert für Kollisionsstufe; 1-Benutzerdefinierter Kollisionserkennungsschwellwert.
5* @return Fehlercode.
6*/
7errno_t SetCollisionDetectionMethod(int method, int thresholdMode = 0);
7.11. Statische Kollisionserkennung ein-/ausschalten
Neu in Version C++SDK-v2.1.5.0.
1/**
2 * @brief Schaltet die statische Kollisionserkennung ein oder aus.
3 * @param [in] status 0-aus; 1-ein.
4 * @return Fehlercode.
5 */
6errno_t SetStaticCollisionOnOff(int status);
7.12. Codebeispiel für Roboter-Kollisionserkennungsmethode
Neu in Version C++SDK-v2.1.5.0.
1int TestCollisionMethod(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 rtn = robot.SetCollisionDetectionMethod(0, 0);
14 printf("SetCollisionDetectionMethod rtn is %d\n", rtn);
15 rtn = robot.SetStaticCollisionOnOff(1);
16 printf("SetStaticCollisionOnOff On rtn is %d\n", rtn);
17 rtn = robot.Sleep(5000);
18 rtn = robot.SetStaticCollisionOnOff(0);
19 printf("SetStaticCollisionOnOff Off rtn is %d\n", rtn);
20 robot.CloseRPC();
21 return 0;
22}
7.13. Gelenk-Drehmoment-/Leistungserkennung
Neu in Version C++SDK-v2.1.5.0.
1/**
2 * @brief Gelenk-Drehmoment-/Leistungserkennung.
3 * @param [in] status 0-aus; 1-ein.
4 * @param [in] power Maximale Leistungseinstellung (W).
5 * @return Fehlercode.
6 */
7errno_t SetPowerLimit(int status, double power);
7.14. Codebeispiel für Gelenk-Drehmoment-/Leistungserkennung
1int TestPowerLimit(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 robot.DragTeachSwitch(1);
14 robot.SetPowerLimit(1, 200);
15 float torques[] = { 0, 0, 0, 0, 0, 0 };
16 robot.GetJointTorques(1, torques);
17 int count = 100;
18 robot.ServoJTStart();
19 int error = 0;
20 while (count > 0)
21 {
22 error = robot.ServoJT(torques, 0.001);
23 count = count - 1;
24 robot.Sleep(1);
25 }
26 error = robot.ServoJTEnd();
27 robot.DragTeachSwitch(0);
28 robot.CloseRPC();
29 return 0;
30}
7.15. Sicherheitsgeschwindigkeitsparameter einstellen
1/**
2* @brief Sicherheitsgeschwindigkeitsparameter einstellen
3* @param [in] enable 0-aus; 1-im manuellen Modus aktiviert; 2-in allen Modi aktiviert
4* @param [in] maxTCPVel Maximale TCP-Geschwindigkeitsbegrenzung; [0-1000] mm/s
5* @param [in] strategy Strategie nach Überschreitung; 0-Stopp mit Alarm; 1-automatische Geschwindigkeitsbegrenzung; 2-Stopp mit Alarm und Deaktivierung
6* @return Fehlercode
7*/
8errno_t SetVelReducePara(int enable, double maxTCPVel, int strategy);
7.16. SDK-Codebeispiel zum Einstellen der Sicherheitsgeschwindigkeitsparameter
1int TestSetVelReducePara()
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(0, -90, 90, 0, 0, 0);
14 JointPos j2(90, -90, 90, 0, 0, 0);
15 ExaxisPos epos(0, 0, 0, 0);
16 DescPose offset_pos(0, 0, 0, 0, 0, 0);
17 robot.SetSpeed(80);
18 rtn = robot.SetVelReducePara(2, 30, 1);
19 printf("SetVelReducePara param error rtn is %d\n", rtn);
20 rtn = robot.SetVelReducePara(0, 30, 1);
21 printf("SetVelReducePara disable reduce vel rtn is %d\n", rtn);
22 robot.MoveJ(&j1, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
23 robot.MoveJ(&j2, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
24 rtn = robot.SetVelReducePara(1, 30, 1);
25 printf("SetVelReducePara reduce vel rtn is %d\n", rtn);
26 robot.MoveJ(&j1, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
27 robot.MoveJ(&j2, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
28 rtn = robot.SetVelReducePara(2, 30, 2);
29 printf("SetVelReducePara disable robot rtn is %d\n", rtn);
30 robot.MoveJ(&j1, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
31 robot.MoveJ(&j2, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
32 robot.Sleep(2000);
33 robot.ResetAllError();
34 robot.RobotEnable(1);
35 robot.Sleep(1000);
36 rtn = robot.SetVelReducePara(2, 30, 0);
37 printf("SetVelReducePara report error rtn is %d\n", rtn);
38 robot.MoveJ(&j1, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
39 robot.MoveJ(&j2, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
40 robot.CloseRPC();
41 robot.Sleep(1000);
42 return 0;
43}