ros日志输出

文章目录

    • ros日志输出路径
    • ros日志显示输出的级别
    • ros中改变日志显示输出的级别设置

ros日志输出路径

ros节点日志文件输出到~/.ros/log文件夹。可以通过修改环境变量(ROS_HOME 或者 ROS_LOG_DIR )来修改路径。但与具体工程无关。如果使用roslaunch启动程序,可以通过roslaunch-logs命令指定日志的输出路径。

ros日志显示输出的级别

DEBUG:输出程序正常运行需要的信息

Information that you never need to see if the system is working properly. Examples:
    "Received a message on topic X from caller Y"
    "Sent 20 bytes on socket 9". 

INFO:输出大量用户需要的信息

Small amounts of information that may be useful to a user. Examples:
    "Node initialized"
    "Advertised on topic X with message type Y"
    "New subscriber to topic X: Y" 

WARN:输出警告,或许影响程序的应用,但系统仍处于可控的预期状态

Information that the user may find alarming, and may affect the output of the application, but is part of the expected working of the system. Examples:

    "Could not load configuration file from . Using defaults." 

ERROR:输出严重错误(但错误可恢复)

Something serious (but recoverable) has gone wrong. Examples:
    "Haven't received an update on topic X for 10 seconds. Stopping robot until X continues broadcasting."
    "Received unexpected NaN value in transform X. Skipping..." 

FATAL:输出不可恢复的崩溃式错误

Something unrecoverable has happened. Examples:
    "Motors have caught fire!" 

ros中改变日志显示输出的级别设置

可以使用以下方法,具体可以查阅ros::console::set_logger_level函数

#include 
if( ros::console::set_logger_level(ROSCONSOLE_DEFAULT_NAME, ros::console::levels::Debug) ) {
   ros::console::notifyLoggerLevelsChanged();
}

你可能感兴趣的:(ROS,ros,日志)