[ROS Q&A] 063 - Setting the node log level in run time (C++)
The Construct Robotics Institute 14:12
1,084 views · 4 likes Watch on YouTube ↗
In this video we show how to use C++ to dynamically change the logger level of a node. See the original question: https://answers.ros.org/question/276242/set-log-level-for-each-node-in-ros-cpp
Q: Set log level for each node in ROS CPP
A: You basically have to use the rosconsole class of roscpp (ros.h) to change the logger level. After importing console.h you need to do the following code call:
ros::console::set_logger_level(ROSCONSOLE_DEFAULT_NAME, ros::console::levels::Debug)
As you can see, the last argument indicates the level of debug you want to have for that node. After that call, you must notify, that the logger level has changed. For that, do the following:
ros::console::notifyLoggerLevelsChanged()
That is all! That simple.
Q: Set log level for each node in ROS CPP
A: You basically have to use the rosconsole class of roscpp (ros.h) to change the logger level. After importing console.h you need to do the following code call:
ros::console::set_logger_level(ROSCONSOLE_DEFAULT_NAME, ros::console::levels::Debug)
As you can see, the last argument indicates the level of debug you want to have for that node. After that call, you must notify, that the logger level has changed. For that, do the following:
ros::console::notifyLoggerLevelsChanged()
That is all! That simple.
Category (YouTube): Science & Technology
Playback is via YouTube's official embedded player. Data from YouTube; Exumo is not affiliated with YouTube.