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

Roscpp warning in ros::Publisher::publish

asked 2013-01-31 23:55:15 -0600

Victor_ocv2 gravatar image

updated 2013-02-01 04:45:10 -0600

Hello, I am worried about the following warning that is given when compiling roscpp programs which contains a publisher:

/opt/ros/groovy/include/ros/publisher.h: In member function ‘void ros::Publisher::publish(const M&) const [with M = geometry_msgs::PoseStamped]’:
/opt/ros/groovy/include/ros/publisher.h:112: warning: comparison with string literal results in unspecified behaviour

The publisher:

ros::Publisher goalPub = this->n.advertise<geometry_msgs::PoseStamped>("move_base_simple/goal", 1);
geometry_msgs::PoseStamped msg;
msg.header.frame_id = "/map";
msg.header.stamp = ros::Time::now();

But the warning is given for all the publishers:

ros::Publisher cmdPub = this->n.advertise<geometry_msgs::Twist>("cmd_vel", 1);

My machine is ubuntu 12.10 with the latest version of ros-groovy and gcc 4.4.7.

Is this warning dangeours? is it being adresses? is it considered a 'bug'? if so, where can I open a ticket for it?

edit retag flag offensive close merge delete



Would you please add the code invoking publish(), by editing your question?

joq gravatar image joq  ( 2013-02-01 04:35:05 -0600 )edit

It might be that the compile gets more verbose about warnings with later versions, but are you sure you are using 4.4.7? On Oneiric I already have 4.6.1.

dornhege gravatar image dornhege  ( 2013-02-01 05:36:56 -0600 )edit

Yes, I had to downgrade to able to compile something... (CUDA maybe?)

Victor_ocv2 gravatar image Victor_ocv2  ( 2013-02-01 05:45:50 -0600 )edit

2 Answers

Sort by » oldest newest most voted

answered 2013-02-02 07:03:26 -0600

I think you hit a bug in roscpp introduced 10 days ago. The const char * result of mt::md5sum<M>(message) is compared with the string literal "*" in publisher.h:112. The warning also appears in newer versions of gcc (like 4.6.3 in a standard Ubuntu precise installation).

Created a ticket:

edit flag offensive delete link more


Thank you!

Victor_ocv2 gravatar image Victor_ocv2  ( 2013-02-02 08:26:39 -0600 )edit

answered 2013-02-14 23:16:09 -0600

I also have the same problem with the package that I'm developing called poseibot_hardware_interface. In my case, my machine is Ubuntu 12.10 with groovy and gcc 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1).

edit flag offensive delete link more



I saw that the bug was fixed but I would like to know how can I include this in my machine?. I tried with sudo apt-get install --reinstall ros-groovy-roscpp but doesn't change.

Carlos Mastalli gravatar image Carlos Mastalli  ( 2013-02-14 23:40:35 -0600 )edit

This bug has been fixed in the roscpp source repo, but no release has been made since then. So you either have to wait until 1.9.42 is released or install ROS from source using the groovy-devel branch of ros_comm.

Johannes Meyer gravatar image Johannes Meyer  ( 2013-02-15 01:32:30 -0600 )edit

Question Tools


Asked: 2013-01-31 23:55:15 -0600

Seen: 1,059 times

Last updated: Feb 14 '13