rqt_console shows the same message twice?

asked 2021-04-27 03:44:40 -0500

serhat gravatar image

updated 2021-04-27 03:48:35 -0500

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

edit retag flag offensive close merge delete

Comments

Hi @serhat , have you ever solve this problem?

Heho gravatar image Heho  ( 2021-11-08 05:05:58 -0500 )edit

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 :)

serhat gravatar image serhat  ( 2021-11-10 01:22:00 -0500 )edit