File tree Expand file tree Collapse file tree 7 files changed +76
-7
lines changed Expand file tree Collapse file tree 7 files changed +76
-7
lines changed Original file line number Diff line number Diff line change @@ -23,4 +23,17 @@ namespace abb :: rws :: rw
2323 };
2424
2525 std::ostream& operator <<(std::ostream& os, RestartMode mode);
26- }
26+
27+ struct SafetyViolationInfo
28+ {
29+ // Robot is unsynchronized
30+ bool unsynchronized = false ;
31+ // Robot tool is outside allowed area
32+ bool toolPosViolation = false ;
33+ // Robot arm is outside allowed area
34+ bool armViolation = false ;
35+ // One of the robot axes is outside allowed area
36+ bool axisRangeViolation = false ;
37+ };
38+
39+ }
Original file line number Diff line number Diff line change @@ -84,4 +84,4 @@ namespace abb :: rws :: rw
8484 * \throw \a std::invalid_argument if \a str is not from the set of valid strings.
8585 */
8686 OperationMode makeOperationMode (std::string const & str);
87- }
87+ }
Original file line number Diff line number Diff line change @@ -26,4 +26,15 @@ namespace abb :: rws :: v1_0 :: rw :: ctrl
2626 */
2727 void restartController (RWSClient& client, RestartMode const & restartMode = RestartMode::restart);
2828
29- }
29+ /* *
30+ * \brief A function for retrieving the robot controller's info about any safety violation event that potentially is active.
31+ *
32+ * \param client RWS client
33+ *
34+ * \return RWSResult containing the result.
35+ *
36+ * \throw \a RWSError if something goes wrong.
37+ */
38+ SafetyViolationInfo getSafetyViolationInfo (RWSClient& client);
39+
40+ }
Original file line number Diff line number Diff line change @@ -26,4 +26,15 @@ namespace abb :: rws :: v2_0 :: rw :: ctrl
2626 * \throw \a RWSError if something goes wrong.
2727 */
2828 void restartController (RWSClient& client, Mastership const & mastership, RestartMode const & restartMode = RestartMode::restart);
29- }
29+
30+ /* *
31+ * \brief A function for retrieving the robot controller's info about any safety violation event that potentially is active.
32+ *
33+ * \param client RWS client
34+ *
35+ * \return RWSResult containing the result.
36+ *
37+ * \throw \a RWSError if something goes wrong.
38+ */
39+ SafetyViolationInfo getSafetyViolationInfo (RWSClient& client);
40+ }
Original file line number Diff line number Diff line change @@ -99,4 +99,4 @@ namespace abb :: rws :: v2_0 :: rw :: panel
9999 * \throw \a RWSError if something goes wrong.
100100 */
101101 void setSpeedRatio (RWSClient& client, unsigned int ratio);
102- }
102+ }
Original file line number Diff line number Diff line change @@ -12,4 +12,20 @@ namespace abb :: rws :: v1_0 :: rw :: ctrl
1212
1313 client.httpPost (uri.str (), content.str (), {Poco::Net::HTTPResponse::HTTP_OK});
1414 }
15- }
15+
16+ SafetyViolationInfo getSafetyViolationInfo (RWSClient& client)
17+ {
18+ std::stringstream uri;
19+ uri << Services::CTRL << " /safety/violation" ;
20+
21+ RWSResult rws_result = parseXml (client.httpGet (uri.str ()).content ());
22+
23+ SafetyViolationInfo result;
24+ result.unsynchronized = std::stoi (xmlFindTextContent (rws_result, XMLAttribute (Identifiers::CLASS, " unsynchronized" ))) != 0 ;
25+ result.toolPosViolation = std::stoi (xmlFindTextContent (rws_result, XMLAttribute (Identifiers::CLASS, " tool-pos-violation-status" )))!= 0 ;
26+ result.armViolation = std::stoi (xmlFindTextContent (rws_result, XMLAttribute (Identifiers::CLASS, " upper-arm-violation-status" ))) != 0 ;
27+ result.axisRangeViolation = std::stoi (xmlFindTextContent (rws_result, XMLAttribute (Identifiers::CLASS, " axis-range-violation-status" ))) != 0 ;
28+
29+ return result;
30+ }
31+ }
Original file line number Diff line number Diff line change @@ -14,4 +14,22 @@ namespace abb :: rws :: v2_0 :: rw :: ctrl
1414
1515 client.httpPost (uri.str (), content.str (), content_type);
1616 }
17- }
17+
18+
19+ SafetyViolationInfo getSafetyViolationInfo (RWSClient& client)
20+ {
21+ std::stringstream uri;
22+ uri << Services::CTRL << " /safety/violation" ;
23+
24+ RWSResult rws_result = parseXml (client.httpGet (uri.str ()).content ());
25+
26+ SafetyViolationInfo result;
27+ result.unsynchronized = std::stoi (xmlFindTextContent (rws_result, XMLAttribute (Identifiers::CLASS, " unsynchronized" ))) != 0 ;
28+ result.toolPosViolation = std::stoi (xmlFindTextContent (rws_result, XMLAttribute (Identifiers::CLASS, " tool-pos-violation-status" ))) != 0 ;
29+ result.armViolation = std::stoi (xmlFindTextContent (rws_result, XMLAttribute (Identifiers::CLASS, " upper-arm-violation-status" ))) != 0 ;
30+ result.axisRangeViolation = std::stoi (xmlFindTextContent (rws_result, XMLAttribute (Identifiers::CLASS, " axis-range-violation-status" ))) != 0 ;
31+
32+ return result;
33+ }
34+
35+ }
You can’t perform that action at this time.
0 commit comments