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.
0 Comments