Skip to content

Commit ffe91dd

Browse files
committed
improvements from ros-industrial#136
1 parent 4864181 commit ffe91dd

17 files changed

+2504
-2741
lines changed

include/abb_librws/rws_client.h

Lines changed: 140 additions & 358 deletions
Large diffs are not rendered by default.

include/abb_librws/rws_interface.h

Lines changed: 428 additions & 439 deletions
Large diffs are not rendered by default.

include/abb_librws/rws_poco_client.h

Lines changed: 225 additions & 366 deletions
Large diffs are not rendered by default.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#pragma once
2+
3+
#include <string>
4+
5+
#include <Poco/Net/HTTPRequest.h>
6+
#include <Poco/Net/HTTPResponse.h>
7+
8+
9+
namespace abb :: rws
10+
{
11+
/**
12+
* \brief A struct for containing the result of a communication.
13+
*/
14+
struct POCOResult
15+
{
16+
/**
17+
* \brief A constructor.
18+
*
19+
* \param http_status HTTP response status
20+
* \param header_info HTTP response header info
21+
* \param content HTTP response content
22+
*/
23+
POCOResult(Poco::Net::HTTPResponse::HTTPStatus http_status,
24+
Poco::Net::NameValueCollection const& header_info, std::string const& content);
25+
26+
27+
28+
/**
29+
* \brief Status of the HTTP response.
30+
*/
31+
Poco::Net::HTTPResponse::HTTPStatus httpStatus() const noexcept
32+
{
33+
return httpStatus_;
34+
}
35+
36+
37+
/**
38+
* \brief HTTP response header info.
39+
*/
40+
auto const& headerInfo() const noexcept
41+
{
42+
return headerInfo_;
43+
}
44+
45+
46+
/**
47+
* \brief Content of the HTTP response.
48+
*/
49+
std::string const& content() const noexcept
50+
{
51+
return content_;
52+
}
53+
54+
55+
private:
56+
Poco::Net::HTTPResponse::HTTPStatus httpStatus_;
57+
std::vector<std::pair<std::string, std::string>> headerInfo_;
58+
std::string content_;
59+
};
60+
}

include/abb_librws/rws_rapid.h

Lines changed: 121 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#include <vector>
4242
#include <sstream>
4343

44-
#include "Poco/SharedPtr.h"
44+
#include <Poco/SharedPtr.h>
4545

4646
namespace abb
4747
{
@@ -93,17 +93,33 @@ template <typename T>
9393
struct RAPIDAtomicTemplate : public RAPIDSymbolDataAbstract
9494
{
9595
public:
96+
/**
97+
* \brief Type of contained value.
98+
*/
99+
using value_type = T;
100+
101+
96102
/**
97103
* \brief A method for parsing a RAPID symbol data value string.
98104
*
99105
* \param value_string containing the string to parse.
100106
*/
101-
void parseString(const std::string& value_string)
107+
void parseString(const std::string& value_string) override
102108
{
103109
std::stringstream ss(value_string);
104110
ss >> value;
105111
}
106112

113+
114+
/**
115+
* \brief Conversion to a standard data type.
116+
*/
117+
operator T const&() const
118+
{
119+
return value;
120+
}
121+
122+
107123
/**
108124
* \brief Container for the data's value.
109125
*/
@@ -141,21 +157,21 @@ struct RAPIDAtomic<RAPID_BOOL> : public RAPIDAtomicTemplate<bool>
141157
*
142158
* \return std::string containing the data type name.
143159
*/
144-
std::string getType() const;
160+
std::string getType() const override;
145161

146162
/**
147163
* \brief A method for parsing a RAPID symbol data value string.
148164
*
149165
* \param value_string containing the string to parse.
150166
*/
151-
void parseString(const std::string& value_string);
167+
void parseString(const std::string& value_string) override;
152168

153169
/**
154170
* \brief A method for constructing a RAPID symbol data value string.
155171
*
156172
* \return std::string containing the constructed string.
157173
*/
158-
std::string constructString() const;
174+
std::string constructString() const override;
159175
};
160176

161177
/**
@@ -176,14 +192,14 @@ struct RAPIDAtomic<RAPID_NUM> : public RAPIDAtomicTemplate<float>
176192
*
177193
* \return std::string containing the data type name.
178194
*/
179-
std::string getType() const;
195+
std::string getType() const override;
180196

181197
/**
182198
* \brief A method for constructing a RAPID symbol data value string.
183199
*
184200
* \return std::string containing the constructed string.
185201
*/
186-
std::string constructString() const;
202+
std::string constructString() const override;
187203
};
188204

189205
/**
@@ -204,14 +220,14 @@ struct RAPIDAtomic<RAPID_DNUM> : public RAPIDAtomicTemplate<double>
204220
*
205221
* \return std::string containing the data type name.
206222
*/
207-
std::string getType() const;
223+
std::string getType() const override;
208224

209225
/**
210226
* \brief A method for constructing a RAPID symbol data value string.
211227
*
212228
* \return std::string containing the constructed string.
213229
*/
214-
std::string constructString() const;
230+
std::string constructString() const override;
215231
};
216232

217233
/**
@@ -232,21 +248,21 @@ struct RAPIDAtomic<RAPID_STRING> : public RAPIDAtomicTemplate<std::string>
232248
*
233249
* \return std::string containing the data type name.
234250
*/
235-
std::string getType() const;
251+
std::string getType() const override;
236252

237253
/**
238254
* \brief A method for parsing a RAPID symbol data value string.
239255
*
240256
* \param value_string containing the string to parse.
241257
*/
242-
void parseString(const std::string& value_string);
258+
void parseString(const std::string& value_string) override;
243259

244260
/**
245261
* \brief A method for constructing a RAPID symbol data value string.
246262
*
247263
* \return std::string containing the constructed string.
248264
*/
249-
std::string constructString() const;
265+
std::string constructString() const override;
250266
};
251267

252268
/**
@@ -287,21 +303,21 @@ struct RAPIDRecord : public RAPIDSymbolDataAbstract
287303
*
288304
* \return std::string containing the constructed string.
289305
*/
290-
std::string constructString() const;
306+
std::string constructString() const override;
291307

292308
/**
293309
* \brief A method for parsing a RAPID symbol data value string.
294310
*
295311
* \param value_string containing the string to parse.
296312
*/
297-
void parseString(const std::string& value_string);
313+
void parseString(const std::string& value_string) override;
298314

299315
/**
300316
* \brief A method for getting the type of the RAPID record.
301317
*
302318
* \return std::string containing the type.
303319
*/
304-
std::string getType() const;
320+
std::string getType() const override;
305321

306322
/**
307323
* \brief Operator for copying the RAPID record to another RAPID record.
@@ -963,6 +979,96 @@ struct SpeedData : public RAPIDRecord
963979
RAPIDNum v_reax;
964980
};
965981

982+
983+
/**
984+
* \brief A struct, for representing a RAPID zonedata record.
985+
*/
986+
struct ZoneData : public RAPIDRecord
987+
{
988+
public:
989+
/**
990+
* \brief A default constructor.
991+
*/
992+
ZoneData()
993+
:
994+
RAPIDRecord("zonedata")
995+
{
996+
components_.push_back(&finep);
997+
components_.push_back(&pzone_tcp);
998+
components_.push_back(&pzone_ori);
999+
components_.push_back(&pzone_eax);
1000+
components_.push_back(&zone_ori);
1001+
components_.push_back(&zone_leax);
1002+
components_.push_back(&zone_reax);
1003+
}
1004+
1005+
/**
1006+
* \brief Copy constructor.
1007+
*
1008+
* \param other containing the values to copy.
1009+
*/
1010+
ZoneData(const ZoneData& other)
1011+
: RAPIDRecord(other.record_type_name_)
1012+
, finep {other.finep}
1013+
, pzone_tcp {other.pzone_tcp}
1014+
, pzone_ori {other.pzone_ori}
1015+
, pzone_eax {other.pzone_eax}
1016+
, zone_ori {other.zone_ori}
1017+
, zone_leax {other.zone_leax}
1018+
, zone_reax {other.zone_reax}
1019+
{
1020+
components_.clear();
1021+
components_.push_back(&finep);
1022+
components_.push_back(&pzone_tcp);
1023+
components_.push_back(&pzone_ori);
1024+
components_.push_back(&pzone_eax);
1025+
components_.push_back(&zone_ori);
1026+
components_.push_back(&zone_leax);
1027+
components_.push_back(&zone_reax);
1028+
}
1029+
1030+
/**
1031+
* \brief Defines whether the movement is to terminate as a stop point (fine point) or as a fly-by point.
1032+
*/
1033+
RAPIDBool finep;
1034+
1035+
/**
1036+
* \brief The size (the radius) of the TCP zone in mm.
1037+
*/
1038+
RAPIDNum pzone_tcp;
1039+
1040+
/**
1041+
* \brief The zone size (the radius) for the tool reorientation.
1042+
*
1043+
* The size is defined as the distance of the TCP from the programmed point in mm.
1044+
*/
1045+
RAPIDNum pzone_ori;
1046+
1047+
/**
1048+
* \brief The zone size (the radius) for external axes.
1049+
*
1050+
* The size is defined as the distance of the TCP from the programmed point in mm.
1051+
*/
1052+
RAPIDNum pzone_eax;
1053+
1054+
/**
1055+
* \brief The zone size for the tool reorientation in degrees.
1056+
*
1057+
* If the robot is holding the work object, this means an angle of rotation for the work object.
1058+
*/
1059+
RAPIDNum zone_ori;
1060+
1061+
/**
1062+
* \brief The zone size for linear external axes in mm.
1063+
*/
1064+
RAPIDNum zone_leax;
1065+
1066+
/**
1067+
* \brief The zone size for rotating external axes in degrees.
1068+
*/
1069+
RAPIDNum zone_reax;
1070+
};
1071+
9661072
} // end namespace rws
9671073
} // end namespace abb
9681074

0 commit comments

Comments
 (0)