Unexpected debug print when publishing a message

asked 2023-02-27 05:42:49 -0500

d.fenucci gravatar image

updated 2023-02-28 04:21:08 -0500


when running a ROS node, I see this message printed (which I never had, as far as I can remember):

[DEBUG] [1676642682.790247167]: Trying to publish message of type [nocs_msgs/PowerManagementStatus/d06180ee877801d514cfd505d0b509be] on a publisher with type [nocs_msgs/PowerManagementStatus/d06180ee877801d514cfd505d0b509be]

It looks curious to me since the md5sum is the same for both messages, so I am wondering whether it indicates some error or not. I found that this get printed in the implementation of the publish method when the following condition is met:

(impl_->md5sum_ == "*" || 
 std::string(mt::md5sum<M>(*message)) == "*" || 
 impl_->md5sum_ == mt::md5sum<M>(*message))

but I don't understand what that means. Could someone help me understanding?


EDIT: in the following a sample code

#include <ros/ros.h>
#include <std_msgs/String.h>

int main(int argc, char **argv) {
  ros::init(argc, argv, "example");

  if (ros::console::set_logger_level("ros.example_pkg", ros::console::levels::Debug))

  ros::NodeHandle nh;
  ros::Publisher my_pub = nh.advertise<std_msgs::String>("my_topic", 30, true);

  // Wait to ensure everything is initialised

  std_msgs::String msg;
  msg.data = "Initial pub";

  return 0;

Using this launch file:

  <node pkg="example_pkg" type="example_pkg_pub" name="example" output="screen">

This is the output I get on the screen:

... logging to /home/davfen/.ros/log/3ee1ef44-b750-11ed-8e0b-2816ad516265/roslaunch-davfen-Precision-7510-1671.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://davfen-Precision-7510:42401/


 * /rosdistro: melodic
 * /rosversion: 1.14.13

    example (example_pkg/example_pkg_pub)

auto-starting new master
process[master]: started with pid [1700]

setting /run_id to 3ee1ef44-b750-11ed-8e0b-2816ad516265
process[rosout-1]: started with pid [1737]
started core service [/rosout]
process[example-2]: started with pid [1741]
[DEBUG] [1677579088.413755111]: Trying to publish message of type [std_msgs/String/992ce8a1687cec8c8bd883ec73ca41d1] on a publisher with type [std_msgs/String/992ce8a1687cec8c8bd883ec73ca41d1]
edit retag flag offensive close merge delete


Can you share this node code? Or prepare a MRE? Does this always happen or infrequently?

ljaniec gravatar image ljaniec  ( 2023-02-27 08:33:47 -0500 )edit

There is nothing special in my code - but I've edited the post with a MRE

d.fenucci gravatar image d.fenucci  ( 2023-02-28 04:12:09 -0500 )edit

Ok, I agree, this seems to be standard code - what about the frequency of this problem? Does it break your data pipeline (so 0 messages sent/received and no communication at all)?

ljaniec gravatar image ljaniec  ( 2023-02-28 04:40:36 -0500 )edit

It looks like everything is working fine, i.e. the topic is published correctly. I was just wondering what that print means, as I have never noticed it before - I have log files of similar nodes running with debug logger level where that print is not present. Could that be due to some changes in the cmake settings, such as CMAKE_BUILD_TYPE?

d.fenucci gravatar image d.fenucci  ( 2023-02-28 05:59:20 -0500 )edit