0
$\begingroup$

Rosanswers logo

Hi all, I have a problem about the rqt_console specifically in the bag files. When I open a bag file typing rosbag play test.bag, rqt_console starts showing the all messages streaming in the bag file. Btw, I want to see the DEBUG messages in the bag file. In order to do that, I changed the logger level of the talker_node before the time I started rosbag record -a. With this conditions, when I open the bag file, rqt_console shows the same message twice. And it's a bit annoying while debugging. I give the related code(talker_node) and rqt_console screen below for you to observe better. I see this problem only watching bag files. How can I solve this problem? Or where I make wrong? ROS1 Kinetic Ubuntu 16.04 Related Code:

   int count = 0;
   while (ros::ok()) // Keep spinning loop until user presses Ctrl+C
   {
      //create a new String ROS message.
      //Message definition in this link http://docs.ros.org/api/std_msgs/html/msg/String.html
      std_msgs::String msg;

      //create a string for the data
      std::stringstream ss;
      ss << "Hello World " << count;
      //assign the string data to ROS message data field
      msg.data = ss.str();

      //print the content of the message in the terminal
      ROS_INFO("[Talker - INFO] I published %s\n", msg.data.c_str());
      ROS_DEBUG("[Talker - DEBUG] I published %s\n", msg.data.c_str());

      //Publish the message
      chatter_publisher.publish(msg);
      count++;
      loop_rate.sleep(); 
   }

Picture of the problem: image description


Originally posted by serhat on ROS Answers with karma: 72 on 2021-04-27

Post score: 1


Original comments

Comment by Heho on 2021-11-08:
Hi @serhat , have you ever solve this problem?

Comment by serhat on 2021-11-10:
Hi @Heho, I think the problem is related to rosmaster/roscore. When we make log files, all messages get recorded during the time we logs. And all messages get recorded by the system itself as well(I meant /rosout)When we play the log file after the log process, we see the exactly same message twice since this message comes from (its own node, like expected) and additionally comes from (/rosout). Therefore rqt_console tries to show both of them. Please don't take this as an answer because it is just my idea about the issue and probably not true :)

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The roscore will start the node /rosout (can see in the $ROS_ETC_DIR/roscore.xml). This node will forward all the messages in topic /rosout to the topic /rosout_agg.

And the rqt_console will subscribe the /rosout_agg and show all the messages.

And the command rosbag record -a will record both /rosout and /rosout_agg in the bag. When you play it, the node /rosout will forward the topic /rosout to topic /rosout_agg again. Then you will have duplicated messages in the /rosout_agg, of course, in the rqt_console.

To solve this,

  1. you can exclude the topic rosout_agg when you record the bag;

  2. you can create a new roscore.xml without the node /rosout, and update the $ROS_ETC_DIR to use this new config when you play the bag;


Originally posted by Solitry with karma: 36 on 2022-08-17

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.