ROS 设置日志格式

  1. 配置文件
    <launch>
      <env name="ROSCONSOLE_CONFIG_FILE"
      value="$(find mypackage)/custom_rosconsole.conf"/>
      <node pkg="mypackage" type="mynode" name="mynode" output="screen"/>
    </launch>
  2. 设置日志格式
    export ROSCONSOLE_FORMAT='[${severity}] [${time}]: ${message}'

    The full list of possible options follows.

    Token

    Sample Output

     

    severity

    ERROR

     

    message

    hello world 0

     

    time

    1284058208.824620563

     

    (if no sim time is available it only shows the wall time)

     

    1284058208.824620563, 1234567890.123456789

     

    (if sim time is available it shows the wall time first and the sim time second)

     

    walltime

    1284058208.824620563

     

    (this feature was always available in Python, in C++ it is only available since ros_console version 1.12.6)

     

    thread

    0xcd63d0

     

    logger

    ros.roscpp_tutorials

     

    file

    /wg/bvu/jfaust/ros/stacks/ros_tutorials/roscpp_tutorials/talker/talker.cpp

     

    line

    92

     

    function

    main

     

    node

    /talker

参考:http://wiki.ros.org/rosconsole