Ask Your Question
2

[ros 2] How to create a non-node logger?

asked 2020-09-14 09:00:44 -0500

In the documentation it says:

Non-node loggers can also be created that use a specific name.

Is there an example or tutorial somewhere that shows how to do this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-09-15 23:04:48 -0500

Josh Whitley gravatar image

Hey, Jeff. I actually stumbled across the answer to this not too long ago. When you use logging macros in ROS2, the first argument is an rclcpp::Logger which you would normally get from calling get_logger() on an rclcpp::Node. However, the rclcpp namespace also provides a get_logger() function which can be used to generate an rclcpp::Logger without a node instance by just giving it a name. I believe the only difference between this type of rclcpp::Logger instance and the one you would get from a node is the logger maintaining a reference to the node and changing its name if the node name changes.

edit flag offensive delete link more

Comments

Perfect, thanks!

Jeffrey Kane Johnson gravatar image Jeffrey Kane Johnson  ( 2020-09-16 06:15:25 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2020-09-14 09:00:44 -0500

Seen: 30 times

Last updated: Sep 15