logging.md
Last updated
Last updated
Copyright (c) Brandeis University
ROS
logs?Two different things called logs, data logs and normal (rosout
) logs
Data logs are collected with rosbag
and are used to replay or simulate all messages which were sent.
This is about the other kind of logs, which are primarily used for sending warnings, errors and debugging.
Solves the problem of distributed information. Many nodes have information to share, which requires a robust logging infrastructure
Get printed to stdout
or stderr
(screen of terminal window running node)
Get sent to rosout
which acts as unified log record
Get written a file on the computer running roscore
. The logs are stored at ~/.ros/logs/
. The subdirectory latest
can be used, or the command $ roscd log
will point to the current log directory.
std_msgs/Log
type:
No publisher needs to be made to log in rospy
. Instead, use the following functions:
what goes where?
A well formatted GUI exists to show all log messages and can be accessed with $ rqt_console
:
Programming Robots with ROS ch 21, Quigley, Gerkey, Smart
It subscribes to the /rosout topic. Every node brought up on the roscore can be seen in the /rosout. Therefore,
the Message Node, as a traffic cop, could communicate with any node through /rosout.
To pass the message from a node to the Message Node, the code just needs one line of code, i.e. rospy.log(). The API can be found in the Log Implementation section above.
User who wants to use Message Node only needs to put its name and what operations he needs to do inside the
callback function. In the example, if user wants to subscribe to the /talker_demo_node, he can just find it by
msg.name == "/talker_demo_node"
. Then, he can do some operation in it.