Skip to content

Commit 66c7077

Browse files
committed
move to RCLCPP_INFO in logging
1 parent 3bc82d4 commit 66c7077

File tree

1 file changed

+50
-51
lines changed

1 file changed

+50
-51
lines changed

controller_manager/include/controller_manager/controller_spec.hpp

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
/*
16-
* Author: Wim Meeussen
16+
* Author: Wim Meeussen, Sai Kishor Kothakota
1717
*/
1818

1919
#ifndef CONTROLLER_MANAGER__CONTROLLER_SPEC_HPP_
@@ -82,12 +82,11 @@ struct ControllerPeerInfo
8282
// interfaces, add it as individual group
8383
predecessor_group.insert(p->name);
8484
mutually_exclusive_predecessor_groups.push_back(predecessor_group);
85-
RCLCPP_INFO_STREAM(
85+
RCLCPP_INFO(
8686
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());
9190
}
9291
});
9392

@@ -221,12 +220,11 @@ struct ControllerPeerInfo
221220
// interfaces, add it as individual group
222221
successor_group.insert(s->name);
223222
mutually_exclusive_successor_groups.push_back(successor_group);
224-
RCLCPP_INFO_STREAM(
223+
RCLCPP_INFO(
225224
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());
230228
}
231229
});
232230

@@ -315,10 +313,10 @@ struct ControllerPeerInfo
315313
mutually_exclusive_successor_groups.push_back(group);
316314
}
317315
}
318-
RCLCPP_INFO_STREAM(
316+
RCLCPP_INFO(
319317
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());
322320
}
323321
}
324322

@@ -336,9 +334,9 @@ struct ControllerPeerInfo
336334
{
337335
if (ros2_control::has_item(controllers_to_activate, predecessor->name))
338336
{
339-
RCLCPP_ERROR_STREAM(
337+
RCLCPP_INFO(
340338
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());
342340
ros2_control::add_item(predecessor_in_active_list, predecessor->name);
343341

344342
// Only insert those that has name of the current controller in their command interfaces
@@ -356,24 +354,24 @@ struct ControllerPeerInfo
356354
}
357355
});
358356

359-
RCLCPP_ERROR_STREAM(
357+
RCLCPP_INFO(
360358
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(
364362
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());
367365
if (
368366
!predecessor_in_active_list.empty() &&
369367
(predecessor_command_interfaces_set.size() != reference_interfaces.size()))
370368
{
371-
RCLCPP_ERROR_STREAM(
369+
RCLCPP_INFO(
372370
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());
377375
for (const auto & predecessor : predecessors)
378376
{
379377
if (!ros2_control::has_item(predecessor_in_active_list, predecessor->name))
@@ -407,23 +405,24 @@ struct ControllerPeerInfo
407405
// check if all the successors reference interfaces are in the current controller's command
408406
// interfaces If they are, add them to the list of controllers to activate
409407

410-
RCLCPP_ERROR_STREAM(
408+
RCLCPP_INFO(
411409
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());
414412
for (const auto & command_itf : command_interfaces_set)
415413
{
416-
RCLCPP_ERROR_STREAM(
414+
RCLCPP_INFO(
417415
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());
419418
}
420419

421420
for (const auto & reference_itf : successor->reference_interfaces)
422421
{
423-
RCLCPP_ERROR_STREAM(
422+
RCLCPP_INFO(
424423
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());
427426
}
428427

429428
bool all_successor_interfaces_match = false;
@@ -438,11 +437,11 @@ struct ControllerPeerInfo
438437
all_successor_interfaces_match = true;
439438
}
440439
});
441-
RCLCPP_ERROR_STREAM(
440+
RCLCPP_INFO(
442441
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");
446445
if (all_successor_interfaces_match)
447446
{
448447
ros2_control::add_item(controllers_to_activate, successor->name);
@@ -451,7 +450,7 @@ struct ControllerPeerInfo
451450
}
452451
else
453452
{
454-
RCLCPP_ERROR(
453+
RCLCPP_INFO(
455454
rclcpp::get_logger("controller_manager"),
456455
"Controller %s has a successor %s who has more reference interfaces that use different "
457456
"controllers. This is not supported now.",
@@ -467,9 +466,9 @@ struct ControllerPeerInfo
467466
{
468467
if (ros2_control::has_item(controllers_to_deactivate, predecessor->name))
469468
{
470-
RCLCPP_ERROR_STREAM(
469+
RCLCPP_INFO(
471470
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());
473472
continue;
474473
}
475474
ros2_control::add_item(controllers_to_deactivate, predecessor->name);
@@ -490,9 +489,9 @@ struct ControllerPeerInfo
490489
{
491490
if (ros2_control::has_item(controllers_to_deactivate, successor->name))
492491
{
493-
RCLCPP_ERROR_STREAM(
492+
RCLCPP_INFO(
494493
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());
496495
continue;
497496
}
498497
RCLCPP_INFO(
@@ -507,24 +506,24 @@ struct ControllerPeerInfo
507506
[&successor](const std::unordered_set<std::string> & group)
508507
{ return group.find(successor->name) != group.end() && group.size() == 1; }))
509508
{
510-
RCLCPP_INFO_STREAM(
509+
RCLCPP_INFO(
511510
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());
514513
continue;
515514
}
516515

517516
if (successor->command_interfaces.empty())
518517
{
519518
ros2_control::add_item(controllers_to_deactivate, successor->name);
520-
RCLCPP_INFO_STREAM(
519+
RCLCPP_INFO(
521520
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());
524523
}
525524
else
526525
{
527-
RCLCPP_ERROR(
526+
RCLCPP_INFO(
528527
rclcpp::get_logger("controller_manager"),
529528
"Controller %s has a successor %s who has command interfaces. This is not supported now.",
530529
name.c_str(), successor->name.c_str());

0 commit comments

Comments
 (0)