@@ -256,7 +256,6 @@ void RTDEClient::queryURControlVersion()
256
256
257
257
void RTDEClient::resetOutputRecipe (const std::vector<std::string> new_recipe)
258
258
{
259
- prod_->teardownProducer ();
260
259
disconnect ();
261
260
262
261
output_recipe_.assign (new_recipe.begin (), new_recipe.end ());
@@ -332,10 +331,11 @@ void RTDEClient::setupOutputs(const uint16_t protocol_version)
332
331
if (!unavailable_variables.empty ())
333
332
{
334
333
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 "
339
339
" or the urcontrol version does not support "
340
340
" them." ;
341
341
@@ -346,6 +346,7 @@ void RTDEClient::setupOutputs(const uint16_t protocol_version)
346
346
347
347
// Some variables are not available so retry setting up the communication with a stripped-down output recipe
348
348
resetOutputRecipe (available_variables);
349
+ return ;
349
350
}
350
351
else
351
352
{
@@ -445,10 +446,16 @@ void RTDEClient::setupInputs()
445
446
void RTDEClient::disconnect ()
446
447
{
447
448
// 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)
449
454
{
450
- sendPause ();
451
455
pipeline_->stop ();
456
+ }
457
+ if (client_state_ > ClientState::UNINITIALIZED)
458
+ {
452
459
stream_.disconnect ();
453
460
}
454
461
client_state_ = ClientState::UNINITIALIZED;
0 commit comments