Skip to content

Commit b9f8484

Browse files
Addressed PR comments
1 parent c7c70b5 commit b9f8484

File tree

6 files changed

+31
-31
lines changed

6 files changed

+31
-31
lines changed

include/ur_client_library/rtde/rtde_client.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ class RTDEClient
103103
* \param notifier The notifier to use in the pipeline
104104
* \param output_recipe_file Path to the file containing the output recipe
105105
* \param input_recipe_file Path to the file containing the input recipe
106+
* \param target_frequency Frequency to run at. Defaults to 0.0 which means maximum frequency.
106107
* \param ignore_unavailable_outputs Configure the behaviour when a variable of the output recipe is not available
107108
* from the robot: output is silently ignored if true, a UrException is raised otherwise.
108-
* \param target_frequency Frequency to run at. Defaults to 0.0 which means maximum frequency.
109109
*/
110110
RTDEClient(std::string robot_ip, comm::INotifier& notifier, const std::string& output_recipe_file,
111-
const std::string& input_recipe_file, bool ignore_unavailable_outputs = false,
112-
double target_frequency = 0.0);
111+
const std::string& input_recipe_file, double target_frequency = 0.0,
112+
bool ignore_unavailable_outputs = false);
113113

114114
/*!
115115
* \brief Creates a new RTDEClient object, including a used URStream and Pipeline to handle the
@@ -119,13 +119,13 @@ class RTDEClient
119119
* \param notifier The notifier to use in the pipeline
120120
* \param output_recipe Vector containing the output recipe
121121
* \param input_recipe Vector containing the input recipe
122+
* \param target_frequency Frequency to run at. Defaults to 0.0 which means maximum frequency.
122123
* \param ignore_unavailable_outputs Configure the behaviour when a variable of the output recipe is not available
123124
* from the robot: output is silently ignored if true, a UrException is raised otherwise.
124-
* \param target_frequency Frequency to run at. Defaults to 0.0 which means maximum frequency.
125125
*/
126126
RTDEClient(std::string robot_ip, comm::INotifier& notifier, const std::vector<std::string>& output_recipe,
127-
const std::vector<std::string>& input_recipe, bool ignore_unavailable_outputs = false,
128-
double target_frequency = 0.0);
127+
const std::vector<std::string>& input_recipe, double target_frequency = 0.0,
128+
bool ignore_unavailable_outputs = false);
129129
~RTDEClient();
130130
/*!
131131
* \brief Sets up RTDE communication with the robot. The handshake includes negotiation of the

include/ur_client_library/ur/ur_driver.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -605,13 +605,13 @@ class UrDriver
605605
*
606606
* \param output_recipe Vector containing the output recipe
607607
* \param input_recipe Vector containing the input recipe
608-
* \param ignore_unavailable_outputs Configure the behaviour when a variable of the output recipe is not available
609-
* from the robot: output is silently ignored if true, a UrException is raised otherwise.
610608
* \param target_frequency
611609
* Frequency to run the RTDE client at. Defaults to 0.0 which means maximum frequency.
610+
* \param ignore_unavailable_outputs Configure the behaviour when a variable of the output recipe is not available
611+
* from the robot: output is silently ignored if true, a UrException is raised otherwise.
612612
*/
613613
void resetRTDEClient(const std::vector<std::string>& output_recipe, const std::vector<std::string>& input_recipe,
614-
bool ignore_unavailable_outputs = false, double target_frequency = 0.0);
614+
double target_frequency = 0.0, bool ignore_unavailable_outputs = false);
615615

616616
/**
617617
* \brief Reset the RTDE client. As during initialization the driver will start RTDE communication
@@ -623,12 +623,12 @@ class UrDriver
623623
*
624624
* \param output_recipe_filename Filename where the output recipe is stored in.
625625
* \param input_recipe_filename Filename where the input recipe is stored in.
626+
* \param target_frequency Frequency to run the RTDE client at. Defaults to 0.0 which means maximum frequency.
626627
* \param ignore_unavailable_outputs Configure the behaviour when a variable of the output recipe is not available
627628
* from the robot: output is silently ignored if true, a UrException is raised otherwise.
628-
* \param target_frequency Frequency to run the RTDE client at. Defaults to 0.0 which means maximum frequency.
629629
*/
630630
void resetRTDEClient(const std::string& output_recipe_filename, const std::string& input_recipe_filename,
631-
bool ignore_unavailable_outputs = false, double target_frequency = 0.0);
631+
double target_frequency = 0.0, bool ignore_unavailable_outputs = false);
632632

633633
private:
634634
static std::string readScriptFile(const std::string& filename);

src/rtde/rtde_client.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace urcl
3535
namespace rtde_interface
3636
{
3737
RTDEClient::RTDEClient(std::string robot_ip, comm::INotifier& notifier, const std::string& output_recipe_file,
38-
const std::string& input_recipe_file, bool ignore_unavailable_outputs, double target_frequency)
38+
const std::string& input_recipe_file, double target_frequency, bool ignore_unavailable_outputs)
3939
: stream_(robot_ip, UR_RTDE_PORT)
4040
, output_recipe_(ensureTimestampIsPresent(readRecipe(output_recipe_file)))
4141
, ignore_unavailable_outputs_(ignore_unavailable_outputs)
@@ -52,8 +52,8 @@ RTDEClient::RTDEClient(std::string robot_ip, comm::INotifier& notifier, const st
5252
}
5353

5454
RTDEClient::RTDEClient(std::string robot_ip, comm::INotifier& notifier, const std::vector<std::string>& output_recipe,
55-
const std::vector<std::string>& input_recipe, bool ignore_unavailable_outputs,
56-
double target_frequency)
55+
const std::vector<std::string>& input_recipe, double target_frequency,
56+
bool ignore_unavailable_outputs)
5757
: stream_(robot_ip, UR_RTDE_PORT)
5858
, output_recipe_(ensureTimestampIsPresent(output_recipe))
5959
, ignore_unavailable_outputs_(ignore_unavailable_outputs)
@@ -88,8 +88,8 @@ bool RTDEClient::init(const size_t max_num_tries, const std::chrono::millisecond
8888
if (client_state_ == ClientState::INITIALIZED)
8989
return true;
9090

91-
URCL_LOG_ERROR("Failed to initialize RTDE client, retrying in 1 seconds");
92-
std::this_thread::sleep_for(std::chrono::seconds(1));
91+
URCL_LOG_ERROR("Failed to initialize RTDE client, retrying in 10 seconds");
92+
std::this_thread::sleep_for(std::chrono::seconds(10));
9393
attempts++;
9494
}
9595
std::stringstream ss;
@@ -275,7 +275,7 @@ void RTDEClient::setupOutputs(const uint16_t protocol_version)
275275

276276
while (num_retries < MAX_REQUEST_RETRIES)
277277
{
278-
URCL_LOG_INFO("Sending output recipe");
278+
URCL_LOG_DEBUG("Sending output recipe");
279279
if (protocol_version == 2)
280280
{
281281
size = ControlPackageSetupOutputsRequest::generateSerializedRequest(buffer, target_frequency_, output_recipe_);

src/ur/ur_driver.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -691,19 +691,19 @@ void UrDriver::setKeepaliveCount(const uint32_t count)
691691
}
692692

693693
void UrDriver::resetRTDEClient(const std::vector<std::string>& output_recipe,
694-
const std::vector<std::string>& input_recipe, bool ignore_unavailable_outputs,
695-
double target_frequency)
694+
const std::vector<std::string>& input_recipe, double target_frequency,
695+
bool ignore_unavailable_outputs)
696696
{
697-
rtde_client_.reset(
698-
new rtde_interface::RTDEClient(robot_ip_, notifier_, output_recipe, input_recipe, target_frequency));
697+
rtde_client_.reset(new rtde_interface::RTDEClient(robot_ip_, notifier_, output_recipe, input_recipe, target_frequency,
698+
ignore_unavailable_outputs));
699699
initRTDE();
700700
}
701701

702702
void UrDriver::resetRTDEClient(const std::string& output_recipe_filename, const std::string& input_recipe_filename,
703-
bool ignore_unavailable_outputs, double target_frequency)
703+
double target_frequency, bool ignore_unavailable_outputs)
704704
{
705705
rtde_client_.reset(new rtde_interface::RTDEClient(robot_ip_, notifier_, output_recipe_filename, input_recipe_filename,
706-
ignore_unavailable_outputs, target_frequency));
706+
target_frequency, ignore_unavailable_outputs));
707707
initRTDE();
708708
}
709709

tests/test_rtde_client.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ TEST_F(RTDEClientTest, invalid_target_frequency)
143143
{
144144
// Setting target frequency below 0 or above 500, should throw an exception
145145
client_.reset(
146-
new rtde_interface::RTDEClient(ROBOT_IP, notifier_, output_recipe_file_, input_recipe_file_, false, -1.0));
146+
new rtde_interface::RTDEClient(ROBOT_IP, notifier_, output_recipe_file_, input_recipe_file_, -1.0, false));
147147

148148
EXPECT_THROW(client_->init(), UrException);
149149

150150
client_.reset(
151-
new rtde_interface::RTDEClient(ROBOT_IP, notifier_, output_recipe_file_, input_recipe_file_, false, 1000));
151+
new rtde_interface::RTDEClient(ROBOT_IP, notifier_, output_recipe_file_, input_recipe_file_, 1000, false));
152152

153153
EXPECT_THROW(client_->init(), UrException);
154154
}
@@ -167,7 +167,7 @@ TEST_F(RTDEClientTest, unconfigured_target_frequency)
167167

168168
TEST_F(RTDEClientTest, set_target_frequency)
169169
{
170-
client_.reset(new rtde_interface::RTDEClient(ROBOT_IP, notifier_, output_recipe_file_, input_recipe_file_, false, 1));
170+
client_.reset(new rtde_interface::RTDEClient(ROBOT_IP, notifier_, output_recipe_file_, input_recipe_file_, 1, false));
171171
client_->init();
172172

173173
// Maximum frequency should still be equal to the robot's maximum frequency
@@ -376,8 +376,8 @@ TEST_F(RTDEClientTest, check_all_rtde_output_variables_exist)
376376
client_->init();
377377

378378
// Ignore unknown output variables to account for variables not available in old urcontrol versions.
379-
client_.reset(
380-
new rtde_interface::RTDEClient(ROBOT_IP, notifier_, exhaustive_output_recipe_file_, input_recipe_file_, true));
379+
client_.reset(new rtde_interface::RTDEClient(ROBOT_IP, notifier_, exhaustive_output_recipe_file_, input_recipe_file_,
380+
0.0, true));
381381

382382
EXPECT_NO_THROW(client_->init());
383383
client_->start();
@@ -405,8 +405,8 @@ TEST_F(RTDEClientTest, check_unknown_rtde_output_variable)
405405
std::vector<std::string> incorrect_output_recipe = client_->getOutputRecipe();
406406
incorrect_output_recipe.push_back("unknown_rtde_variable");
407407

408-
client_.reset(
409-
new rtde_interface::RTDEClient(ROBOT_IP, notifier_, incorrect_output_recipe, resources_input_recipe_, false));
408+
client_.reset(new rtde_interface::RTDEClient(ROBOT_IP, notifier_, incorrect_output_recipe, resources_input_recipe_,
409+
0.0, false));
410410

411411
EXPECT_THROW(client_->init(), UrException);
412412
}

tests/test_ur_driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ TEST_F(UrDriverTest, send_robot_program_retry_on_failure)
375375
TEST_F(UrDriverTest, reset_rtde_client)
376376
{
377377
double target_frequency = 50;
378-
g_ur_driver_->resetRTDEClient(OUTPUT_RECIPE, INPUT_RECIPE, false, target_frequency);
378+
g_ur_driver_->resetRTDEClient(OUTPUT_RECIPE, INPUT_RECIPE, target_frequency);
379379
ASSERT_EQ(g_ur_driver_->getControlFrequency(), target_frequency);
380380
}
381381

0 commit comments

Comments
 (0)