ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Figured out the answer on my own... I need to call the function rclcpp::get_logger() rather than the get_logger() method of rclcpp::Node.

For a test I added the following lines to the on_init() method:

rclcpp::Logger loger = rclcpp::get_logger("test_logger");
RCLCPP_INFO(logger, "Logging test");

Which resulted in the output:

[ros2_control_node-1] [INFO] [1685153874.083490048] [test_logger]: Logging test

And that's what I needed. Hopefully this will help someone else who doesn't read the code quite closely enough.