ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Hello,

ROS_INFO() will display the message in the terminal, but ROS_INFO() will also send a message to /rosout. If you create a node that subscribe to /rosout and use ROS_INFO(), you will write an infinite loop because :

1 . Node receive message from /rosout

2 . Node print with ROS_INFO()

3 . ROS_INFO() Send a message to /rosout

4 . Go back to 1

For a simple example of how to do a subscriber, you can subscribe to /rosout and simply use std::cout for displaying the message (or your favorite logging system that doesn't use /rosout).

If you want to extract Warning, Error or Fatal level message, you can use a message filter, or just discarding message with logger level less than warning in the beginning of the callback function.