Skip to content

Commit f6189bb

Browse files
author
Felix Exner
committed
Added docstrings and const qualifiers
1 parent bc365ff commit f6189bb

File tree

8 files changed

+45
-13
lines changed

8 files changed

+45
-13
lines changed

include/ur_client_library/comm/pipeline.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,13 @@ class IProducer
172172
public:
173173
/*!
174174
* \brief Set-up functionality of the producers.
175+
*
176+
* \param max_num_tries Maximum number of connection attempts before counting the connection as
177+
* failed. Unlimited number of attempts when set to 0.
178+
* \param reconnection_time time in between connection attempts to the server
175179
*/
176-
virtual void setupProducer(size_t max_num_tries = 0, std::chrono::milliseconds reconnection_time = std::chrono::seconds(10))
180+
virtual void setupProducer(const size_t max_num_tries = 0,
181+
const std::chrono::milliseconds reconnection_time = std::chrono::seconds(10))
177182
{
178183
}
179184
/*!
@@ -287,7 +292,15 @@ class Pipeline
287292
stop();
288293
}
289294

290-
void init(size_t max_num_tries = 0, std::chrono::milliseconds reconnection_time = std::chrono::seconds(10))
295+
/*!
296+
* \brief Initialize the pipeline. Internally calls setup of producer and consumer.
297+
*
298+
* \param max_num_tries Maximum number of connection attempts before counting the connection as
299+
* failed. Unlimited number of attempts when set to 0.
300+
* \param reconnection_time time in between connection attempts to the server
301+
*/
302+
void init(const size_t max_num_tries = 0,
303+
const std::chrono::milliseconds reconnection_time = std::chrono::seconds(10))
291304
{
292305
producer_.setupProducer(max_num_tries, reconnection_time);
293306
if (consumer_ != nullptr)

include/ur_client_library/comm/producer.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,13 @@ class URProducer : public IProducer<T>
5959

6060
/*!
6161
* \brief Triggers the stream to connect to the robot.
62+
*
63+
* \param max_num_tries Maximum number of connection attempts before counting the connection as
64+
* failed. Unlimited number of attempts when set to 0.
65+
* \param reconnection_time time in between connection attempts to the server
6266
*/
63-
void setupProducer(size_t max_num_tries = 0, std::chrono::milliseconds reconnection_time = std::chrono::seconds(10)) override
67+
void setupProducer(const size_t max_num_tries = 0,
68+
const std::chrono::milliseconds reconnection_time = std::chrono::seconds(10)) override
6469
{
6570
stream_.setReconnectionTime(reconnection_time);
6671
timeval tv;

include/ur_client_library/comm/stream.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,12 @@ class URStream : public TCPSocket
5656
/*!
5757
* \brief Connects to the configured socket.
5858
*
59+
* \param max_num_tries Maximum number of connection attempts before counting the connection as
60+
* failed. Unlimited number of attempts when set to 0.
61+
*
5962
* \returns True on success, false if connection could not be established
6063
*/
61-
bool connect(size_t max_num_tries = 0)
64+
bool connect(const size_t max_num_tries = 0)
6265
{
6366
return TCPSocket::setup(host_, port_, max_num_tries);
6467
}

include/ur_client_library/comm/tcp_socket.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class TCPSocket
5959
}
6060
virtual void setOptions(int socket_fd);
6161

62-
bool setup(std::string& host, int port, size_t max_num_tries = 0);
62+
bool setup(const std::string& host, const int port, const size_t max_num_tries = 0);
6363

6464
std::unique_ptr<timeval> recv_timeout_;
6565

@@ -146,7 +146,7 @@ class TCPSocket
146146
*
147147
* \param reconnection_time time in between connection attempts to the server
148148
*/
149-
void setReconnectionTime(std::chrono::milliseconds reconnection_time)
149+
void setReconnectionTime(const std::chrono::milliseconds reconnection_time)
150150
{
151151
reconnection_time_ = reconnection_time;
152152
}

include/ur_client_library/rtde/rtde_client.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,14 @@ class RTDEClient
123123
* \brief Sets up RTDE communication with the robot. The handshake includes negotiation of the
124124
* used protocol version and setting of input and output recipes.
125125
*
126+
* \param max_num_tries Maximum number of connection attempts before counting the connection as
127+
* failed. Unlimited number of attempts when set to 0.
128+
* \param reconnection_time time in between connection attempts to the server
129+
*
126130
* \returns Success of the handshake
127131
*/
128-
bool init(size_t max_num_tries = 0, std::chrono::milliseconds reconnection_time = std::chrono::seconds(10));
132+
bool init(const size_t max_num_tries = 0,
133+
const std::chrono::milliseconds reconnection_time = std::chrono::seconds(10));
129134
/*!
130135
* \brief Triggers the robot to start sending RTDE data packages in the negotiated format.
131136
*
@@ -228,7 +233,8 @@ class RTDEClient
228233
// the robot is booted.
229234
std::vector<std::string> ensureTimestampIsPresent(const std::vector<std::string>& output_recipe) const;
230235

231-
void setupCommunication(size_t max_num_tries = 0, std::chrono::milliseconds reconnection_time = std::chrono::seconds(10));
236+
void setupCommunication(const size_t max_num_tries = 0,
237+
const std::chrono::milliseconds reconnection_time = std::chrono::seconds(10));
232238
bool negotiateProtocolVersion(const uint16_t protocol_version);
233239
void queryURControlVersion();
234240
void setupOutputs(const uint16_t protocol_version);

include/ur_client_library/ur/dashboard_client.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,15 @@ class DashboardClient : public comm::TCPSocket
6060
/*!
6161
* \brief Opens a connection to the dashboard server on the host as specified in the constructor.
6262
*
63+
* \param max_num_tries Maximum number of connection attempts before counting the connection as
64+
* failed. Unlimited number of attempts when set to 0.
65+
* \param reconnection_time time in between connection attempts to the server
66+
*
6367
* \returns True on successful connection, false otherwise.
6468
*/
65-
bool connect(size_t max_num_tries = 0, std::chrono::milliseconds reconnection_time = std::chrono::seconds(10));
66-
69+
bool connect(const size_t max_num_tries = 0,
70+
const std::chrono::milliseconds reconnection_time = std::chrono::seconds(10));
71+
6772
/*!
6873
* \brief Makes sure no connection to the dashboard server is held inside the object.
6974
*/

src/rtde/rtde_client.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ RTDEClient::~RTDEClient()
6969
disconnect();
7070
}
7171

72-
bool RTDEClient::init(size_t max_num_tries, std::chrono::milliseconds reconnection_time)
72+
bool RTDEClient::init(const size_t max_num_tries, const std::chrono::milliseconds reconnection_time)
7373
{
7474
if (client_state_ > ClientState::UNINITIALIZED)
7575
{
@@ -92,7 +92,7 @@ bool RTDEClient::init(size_t max_num_tries, std::chrono::milliseconds reconnecti
9292
throw UrException(ss.str());
9393
}
9494

95-
void RTDEClient::setupCommunication(size_t max_num_tries, std::chrono::milliseconds reconnection_time)
95+
void RTDEClient::setupCommunication(const size_t max_num_tries, const std::chrono::milliseconds reconnection_time)
9696
{
9797
client_state_ = ClientState::INITIALIZING;
9898
// A running pipeline is needed inside setup

src/ur/dashboard_client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void DashboardClient::rtrim(std::string& str, const std::string& chars)
4747
str.erase(str.find_last_not_of(chars) + 1);
4848
}
4949

50-
bool DashboardClient::connect(size_t max_num_tries, std::chrono::milliseconds reconnection_time)
50+
bool DashboardClient::connect(const size_t max_num_tries, const std::chrono::milliseconds reconnection_time)
5151
{
5252
if (getState() == comm::SocketState::Connected)
5353
{

0 commit comments

Comments
 (0)