@@ -146,9 +146,9 @@ bool RTDEClient::setupCommunication(const size_t max_num_tries, const std::chron
146146 }
147147 pipeline_->run ();
148148
149- std::pair< bool , uint16_t > protocol_version = setProtocolVersion ();
149+ uint16_t protocol_version = negotiateProtocolVersion ();
150150 // Protocol version must be above zero
151- if (protocol_version. first == false )
151+ if (protocol_version == 0 )
152152 {
153153 return false ;
154154 }
@@ -161,7 +161,7 @@ bool RTDEClient::setupCommunication(const size_t max_num_tries, const std::chron
161161 setTargetFrequency ();
162162 }
163163
164- is_rtde_comm_setup = is_rtde_comm_setup && setupOutputs (protocol_version. second );
164+ is_rtde_comm_setup = is_rtde_comm_setup && setupOutputs (protocol_version);
165165
166166 is_rtde_comm_setup = is_rtde_comm_setup && isRobotBooted ();
167167
@@ -172,7 +172,7 @@ bool RTDEClient::setupCommunication(const size_t max_num_tries, const std::chron
172172 return is_rtde_comm_setup;
173173}
174174
175- std::pair< bool , uint16_t > RTDEClient::setProtocolVersion ()
175+ uint16_t RTDEClient::negotiateProtocolVersion ()
176176{
177177 uint16_t protocol_version = MAX_RTDE_PROTOCOL_VERSION;
178178 while (protocol_version > 0 )
@@ -187,7 +187,7 @@ std::pair<bool, uint16_t> RTDEClient::setProtocolVersion()
187187 if (!stream_.write (buffer, size, written))
188188 {
189189 URCL_LOG_ERROR (" Sending protocol version query to robot failed" );
190- return { false , 0 } ;
190+ return 0 ;
191191 }
192192
193193 while (num_retries < MAX_REQUEST_RETRIES)
@@ -196,7 +196,7 @@ std::pair<bool, uint16_t> RTDEClient::setProtocolVersion()
196196 if (!pipeline_->getLatestProduct (package, std::chrono::milliseconds (1000 )))
197197 {
198198 URCL_LOG_ERROR (" failed to get package from RTDE interface" );
199- return { false , 0 } ;
199+ return 0 ;
200200 }
201201 if (rtde_interface::RequestProtocolVersion* tmp_version =
202202 dynamic_cast <rtde_interface::RequestProtocolVersion*>(package.get ()))
@@ -205,7 +205,7 @@ std::pair<bool, uint16_t> RTDEClient::setProtocolVersion()
205205 {
206206 URCL_LOG_INFO (" Negotiated RTDE protocol version to %hu." , protocol_version);
207207 parser_.setProtocolVersion (protocol_version);
208- return { true , protocol_version } ;
208+ return protocol_version;
209209 }
210210 break ;
211211 }
@@ -224,7 +224,7 @@ std::pair<bool, uint16_t> RTDEClient::setProtocolVersion()
224224 }
225225 URCL_LOG_ERROR (" Protocol version for RTDE communication could not be established. Robot didn't accept any of "
226226 " the suggested versions." );
227- return { false , 0 } ;
227+ return 0 ;
228228}
229229
230230bool RTDEClient::queryURControlVersion ()
0 commit comments