Robotics StackExchange | Archived questions

Publisher sleeping forever

Hi,

I'm just starting to learn ROS, and I'm following the Publisher/Subscriber tutorial.

For some reason, my publisher outputs the message only once: "[ INFO] [1368121934.629754145]: hello world 0." However, If I comment out loop_rate.sleep() from talker.cpp, then I get the expected publisher/subscriber behavior. Why is this happening?

I'm using Groovy and Ubuntu 13.04. I assume my problem could be caused by my version of Ubuntu, but this is the first issue I've encountered so far (I've used turtlesim, ros stage, rviz, etc).

Thanks!

Asked by Zayin on 2013-05-09 08:05:15 UTC

Comments

A code snippet would be helpful

Asked by mirzashah on 2013-05-09 08:43:47 UTC

I just copy pasted the tutorial: http://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29

Asked by Zayin on 2013-05-09 09:46:51 UTC

talker.cpp should indeed output "hello world" over and over again. there could be some issue with packaging on 13.04, but if this basic program does not work...that would mean a lot of stuff on top of it would be broken. I was also potentially thinking it might be a log level issue with rosconsole.

Asked by mirzashah on 2013-05-09 10:11:51 UTC

Thanks for your reply. I guess I might have to install an older Ubuntu version then.

Asked by Zayin on 2013-05-09 10:23:42 UTC

@Zayin I suggest that you look a little closer at the code snippet. And figure out how to reproduce the error. There are ways you could get this such as having the use_sim_time parameter set.

Asked by tfoote on 2013-05-13 15:42:30 UTC

I have meet the same problem. I also ran talk.cpp in the tutorial. What I get is that: 1. If I run roscore first, and then rosrun -- talker. I can continuous get hello output 2. If I ran it through roslaunch , I can only see "hello" once. It will sleep forever

Asked by Min on 2014-09-30 22:30:23 UTC

Maybe /use_sim_time is active but no bag is played? This would mean that time does not go forward and hence the sleep would never expire.

Asked by dseifert on 2016-08-18 13:20:53 UTC

Answers