@@ -256,7 +256,6 @@ void RTDEClient::queryURControlVersion()
256256
257257void RTDEClient::resetOutputRecipe (const std::vector<std::string> new_recipe)
258258{
259- prod_->teardownProducer ();
260259 disconnect ();
261260
262261 output_recipe_.assign (new_recipe.begin (), new_recipe.end ());
@@ -332,10 +331,11 @@ void RTDEClient::setupOutputs(const uint16_t protocol_version)
332331 if (!unavailable_variables.empty ())
333332 {
334333 std::stringstream error_message;
335- error_message << " The following variables are not recognized by the robot: " ;
336- std::for_each (unavailable_variables.begin (), unavailable_variables.end (),
337- [&error_message](const std::string& variable_name) { error_message << variable_name << " " ; });
338- error_message << " . Either your output recipe contains errors "
334+ error_message << " The following variables are not recognized by the robot:" ;
335+ std::for_each (
336+ unavailable_variables.begin (), unavailable_variables.end (),
337+ [&error_message](const std::string& variable_name) { error_message << " \n - '" << variable_name << " '" ; });
338+ error_message << " \n Either your output recipe contains errors "
339339 " or the urcontrol version does not support "
340340 " them." ;
341341
@@ -346,6 +346,7 @@ void RTDEClient::setupOutputs(const uint16_t protocol_version)
346346
347347 // Some variables are not available so retry setting up the communication with a stripped-down output recipe
348348 resetOutputRecipe (available_variables);
349+ return ;
349350 }
350351 else
351352 {
@@ -445,10 +446,16 @@ void RTDEClient::setupInputs()
445446void RTDEClient::disconnect ()
446447{
447448 // If communication is started it should be paused before disconnecting
448- if (client_state_ > ClientState::UNINITIALIZED)
449+ if (client_state_ == ClientState::RUNNING)
450+ {
451+ pause ();
452+ }
453+ if (client_state_ >= ClientState::INITIALIZING)
449454 {
450- sendPause ();
451455 pipeline_->stop ();
456+ }
457+ if (client_state_ > ClientState::UNINITIALIZED)
458+ {
452459 stream_.disconnect ();
453460 }
454461 client_state_ = ClientState::UNINITIALIZED;
0 commit comments