13
13
// limitations under the License.
14
14
15
15
/*
16
- * Author: Wim Meeussen
16
+ * Author: Wim Meeussen, Sai Kishor Kothakota
17
17
*/
18
18
19
19
#ifndef CONTROLLER_MANAGER__CONTROLLER_SPEC_HPP_
@@ -82,12 +82,11 @@ struct ControllerPeerInfo
82
82
// interfaces, add it as individual group
83
83
predecessor_group.insert (p->name );
84
84
mutually_exclusive_predecessor_groups.push_back (predecessor_group);
85
- RCLCPP_INFO_STREAM (
85
+ RCLCPP_INFO (
86
86
rclcpp::get_logger (" controller_manager" ),
87
- " Adding predecessor: "
88
- << p->name
89
- << " as individual group, as all its command "
90
- " interfaces are in the current controller's reference interfaces." );
87
+ " Adding predecessor: '%s' as individual group, as all its command interfaces are in "
88
+ " the current controller's reference interfaces." ,
89
+ p->name .c_str ());
91
90
}
92
91
});
93
92
@@ -221,12 +220,11 @@ struct ControllerPeerInfo
221
220
// interfaces, add it as individual group
222
221
successor_group.insert (s->name );
223
222
mutually_exclusive_successor_groups.push_back (successor_group);
224
- RCLCPP_INFO_STREAM (
223
+ RCLCPP_INFO (
225
224
rclcpp::get_logger (" controller_manager" ),
226
- " Adding successor: "
227
- << s->name
228
- << " as individual group, as all its command "
229
- " interfaces are in the current controller's reference interfaces." );
225
+ " Adding successor: '%s' as individual group, as all its command interfaces are in the "
226
+ " current controller's reference interfaces." ,
227
+ s->name .c_str ());
230
228
}
231
229
});
232
230
@@ -315,10 +313,10 @@ struct ControllerPeerInfo
315
313
mutually_exclusive_successor_groups.push_back (group);
316
314
}
317
315
}
318
- RCLCPP_INFO_STREAM (
316
+ RCLCPP_INFO (
319
317
rclcpp::get_logger (" controller_manager" ),
320
- " Mutually exclusive successor groups for controller: "
321
- << name << " are: " << mutually_exclusive_successor_groups.size ());
318
+ " Mutually exclusive successor groups for controller: '%s' are: %zu " , name. c_str (),
319
+ mutually_exclusive_successor_groups.size ());
322
320
}
323
321
}
324
322
@@ -336,9 +334,9 @@ struct ControllerPeerInfo
336
334
{
337
335
if (ros2_control::has_item (controllers_to_activate, predecessor->name ))
338
336
{
339
- RCLCPP_ERROR_STREAM (
337
+ RCLCPP_INFO (
340
338
rclcpp::get_logger (" controller_manager" ),
341
- " The predecessor: " << predecessor-> name << " is already in the active list." );
339
+ " The predecessor: '%s' is already in the active list." , predecessor-> name . c_str () );
342
340
ros2_control::add_item (predecessor_in_active_list, predecessor->name );
343
341
344
342
// Only insert those that has name of the current controller in their command interfaces
@@ -356,24 +354,24 @@ struct ControllerPeerInfo
356
354
}
357
355
});
358
356
359
- RCLCPP_ERROR_STREAM (
357
+ RCLCPP_INFO (
360
358
rclcpp::get_logger (" controller_manager" ),
361
- " The predecessor command interfaces of the predecessor:"
362
- << name << " are: " << predecessor_command_interfaces_set.size ());
363
- RCLCPP_ERROR_STREAM (
359
+ " The predecessor command interfaces of the predecessor: '%s' are: %zu " , name. c_str (),
360
+ predecessor_command_interfaces_set.size ());
361
+ RCLCPP_INFO (
364
362
rclcpp::get_logger (" controller_manager" ),
365
- " The reference interfaces of the controller:" << name
366
- << " are: " << reference_interfaces.size ());
363
+ " The reference interfaces of the controller: '%s' are: %zu " , name. c_str (),
364
+ reference_interfaces.size ());
367
365
if (
368
366
!predecessor_in_active_list.empty () &&
369
367
(predecessor_command_interfaces_set.size () != reference_interfaces.size ()))
370
368
{
371
- RCLCPP_ERROR_STREAM (
369
+ RCLCPP_INFO (
372
370
rclcpp::get_logger (" controller_manager" ),
373
- " The predecessor command interfaces of the predecessor:"
374
- << name << " are not equal to the reference interfaces of the controller:" << name
375
- << " : " << predecessor_command_interfaces_set.size ()
376
- << " != " << reference_interfaces.size ());
371
+ " The predecessor command interfaces of the predecessor: '%s' are not equal to the "
372
+ " reference interfaces of the controller: '%s' : %zu != %zu " ,
373
+ name. c_str (), name. c_str (), predecessor_command_interfaces_set.size (),
374
+ reference_interfaces.size ());
377
375
for (const auto & predecessor : predecessors)
378
376
{
379
377
if (!ros2_control::has_item (predecessor_in_active_list, predecessor->name ))
@@ -407,23 +405,24 @@ struct ControllerPeerInfo
407
405
// check if all the successors reference interfaces are in the current controller's command
408
406
// interfaces If they are, add them to the list of controllers to activate
409
407
410
- RCLCPP_ERROR_STREAM (
408
+ RCLCPP_INFO (
411
409
rclcpp::get_logger (" controller_manager" ),
412
- " The command interfaces of the predecessor:" << name
413
- << " are: " << command_interfaces_set.size ());
410
+ " The command interfaces of the predecessor: '%s' are: %zu " , name. c_str (),
411
+ command_interfaces_set.size ());
414
412
for (const auto & command_itf : command_interfaces_set)
415
413
{
416
- RCLCPP_ERROR_STREAM (
414
+ RCLCPP_INFO (
417
415
rclcpp::get_logger (" controller_manager" ),
418
- " The command interfaces of the predecessor:" << name << " are: " << command_itf);
416
+ " The command interfaces of the predecessor: '%s' are: %s" , name.c_str (),
417
+ command_itf.c_str ());
419
418
}
420
419
421
420
for (const auto & reference_itf : successor->reference_interfaces )
422
421
{
423
- RCLCPP_ERROR_STREAM (
422
+ RCLCPP_INFO (
424
423
rclcpp::get_logger (" controller_manager" ),
425
- " The reference interfaces of the successor:" << successor->name
426
- << " are: " << reference_itf);
424
+ " The reference interfaces of the successor: '%s' are: %s " , successor->name . c_str (),
425
+ reference_itf. c_str () );
427
426
}
428
427
429
428
bool all_successor_interfaces_match = false ;
@@ -438,11 +437,11 @@ struct ControllerPeerInfo
438
437
all_successor_interfaces_match = true ;
439
438
}
440
439
});
441
- RCLCPP_ERROR_STREAM (
440
+ RCLCPP_INFO (
442
441
rclcpp::get_logger (" controller_manager" ),
443
- " The reference interfaces of the successor: "
444
- << successor-> name << " are within the command interfaces of the predecessor: " << name
445
- << " : " << std::boolalpha << all_successor_interfaces_match );
442
+ " The reference interfaces of the successor: '%s' are within the command interfaces of the "
443
+ " predecessor: '%s' : %s " ,
444
+ successor-> name . c_str (), name. c_str (), all_successor_interfaces_match ? " true " : " false " );
446
445
if (all_successor_interfaces_match)
447
446
{
448
447
ros2_control::add_item (controllers_to_activate, successor->name );
@@ -451,7 +450,7 @@ struct ControllerPeerInfo
451
450
}
452
451
else
453
452
{
454
- RCLCPP_ERROR (
453
+ RCLCPP_INFO (
455
454
rclcpp::get_logger (" controller_manager" ),
456
455
" Controller %s has a successor %s who has more reference interfaces that use different "
457
456
" controllers. This is not supported now." ,
@@ -467,9 +466,9 @@ struct ControllerPeerInfo
467
466
{
468
467
if (ros2_control::has_item (controllers_to_deactivate, predecessor->name ))
469
468
{
470
- RCLCPP_ERROR_STREAM (
469
+ RCLCPP_INFO (
471
470
rclcpp::get_logger (" controller_manager" ),
472
- " The predecessor: " << predecessor-> name << " is already in the deactivation list." );
471
+ " The predecessor: '%s' is already in the deactivation list." , predecessor-> name . c_str () );
473
472
continue ;
474
473
}
475
474
ros2_control::add_item (controllers_to_deactivate, predecessor->name );
@@ -490,9 +489,9 @@ struct ControllerPeerInfo
490
489
{
491
490
if (ros2_control::has_item (controllers_to_deactivate, successor->name ))
492
491
{
493
- RCLCPP_ERROR_STREAM (
492
+ RCLCPP_INFO (
494
493
rclcpp::get_logger (" controller_manager" ),
495
- " The successor: " << successor-> name << " is already in the deactivation list." );
494
+ " The successor: '%s' is already in the deactivation list." , successor-> name . c_str () );
496
495
continue ;
497
496
}
498
497
RCLCPP_INFO (
@@ -507,24 +506,24 @@ struct ControllerPeerInfo
507
506
[&successor](const std::unordered_set<std::string> & group)
508
507
{ return group.find (successor->name ) != group.end () && group.size () == 1 ; }))
509
508
{
510
- RCLCPP_INFO_STREAM (
509
+ RCLCPP_INFO (
511
510
rclcpp::get_logger (" controller_manager" ),
512
- " The successor: " << successor-> name
513
- << " is in a mutually exclusive group, skipping further deactivation. " );
511
+ " The successor: '%s' is in a mutually exclusive group, skipping further deactivation. " ,
512
+ successor-> name . c_str () );
514
513
continue ;
515
514
}
516
515
517
516
if (successor->command_interfaces .empty ())
518
517
{
519
518
ros2_control::add_item (controllers_to_deactivate, successor->name );
520
- RCLCPP_INFO_STREAM (
519
+ RCLCPP_INFO (
521
520
rclcpp::get_logger (" controller_manager" ),
522
- " Adding successor: " << successor-> name
523
- << " to the deactivation list, as it has no command interfaces. " );
521
+ " Adding successor: '%s' to the deactivation list, as it has no command interfaces. " ,
522
+ successor-> name . c_str () );
524
523
}
525
524
else
526
525
{
527
- RCLCPP_ERROR (
526
+ RCLCPP_INFO (
528
527
rclcpp::get_logger (" controller_manager" ),
529
528
" Controller %s has a successor %s who has command interfaces. This is not supported now." ,
530
529
name.c_str (), successor->name .c_str ());
0 commit comments