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

rqt_console shows the same message twice? [closed]

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

serhat gravatar image

updated 2022-08-17 13:35:10 -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 reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by serhat
close date 2022-08-17 13:35:58.964680

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

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-08-17 02:15:10 -0500

Solitry gravatar image

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;

edit flag offensive delete link more

Question Tools

3 followers

Stats

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

Seen: 138 times

Last updated: Aug 17 '22