@@ -122,10 +122,11 @@ void BinaryFilter::initializeFilter(
122
122
if (!change_parameters_client->wait_for_service (
123
123
std::chrono::milliseconds (change_parameter_timeout_)))
124
124
{
125
- if (param.is_critical ){
126
- throw std::runtime_error (" BinaryFilter: Service " +
127
- std::string (change_parameters_client->get_service_name ()) +
128
- " not available!" );
125
+ if (param.is_critical ) {
126
+ throw std::runtime_error (
127
+ " BinaryFilter: Service " +
128
+ std::string (change_parameters_client->get_service_name ()) +
129
+ " not available!" );
129
130
}
130
131
RCLCPP_ERROR (
131
132
logger_, " BinaryFilter: service %s not available. Skipping ..." ,
@@ -356,10 +357,11 @@ void BinaryFilter::changeParameters(const bool state)
356
357
if (return_code == rclcpp::FutureReturnCode::SUCCESS) {
357
358
auto result = future_result.get ();
358
359
if (!result->results .at (0 ).successful ) {
359
- if (binary_parameter_info.is_critical ){
360
- throw std::runtime_error (" BinaryFilter: Could not change parameter " +
361
- std::string (binary_parameter_info.param_name ) + " from node " +
362
- std::string (binary_parameter_info.node_name ));
360
+ if (binary_parameter_info.is_critical ) {
361
+ throw std::runtime_error (
362
+ " BinaryFilter: Could not change parameter " +
363
+ std::string (binary_parameter_info.param_name ) + " from node " +
364
+ std::string (binary_parameter_info.node_name ));
363
365
}
364
366
RCLCPP_ERROR (
365
367
logger_, " BinaryFilter: Failed to change parameter %s" ,
@@ -370,9 +372,13 @@ void BinaryFilter::changeParameters(const bool state)
370
372
bool_param.value .bool_value ? " true" : " false" );
371
373
}
372
374
} else if (return_code == rclcpp::FutureReturnCode::INTERRUPTED) {
373
- throw std::runtime_error (" BinaryFilter: Interruped while spinning for parameter update!" );
375
+ if (binary_parameter_info.is_critical ) {
376
+ throw std::runtime_error (" BinaryFilter: Interruped while spinning for parameter update!" );
377
+ }
374
378
} else {
375
- throw std::runtime_error (" BinaryFilter: Spinning for parameter update went wrong !" );
379
+ if (binary_parameter_info.is_critical ) {
380
+ throw std::runtime_error (" BinaryFilter: Spinning for parameter update timeout!" );
381
+ }
376
382
}
377
383
}
378
384
}
0 commit comments