Publisher sleeping forever [closed]

asked 2013-05-09 08:05:15 -0500

Zayin gravatar image

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!

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2017-03-29 17:40:59.131834

Comments

3

A code snippet would be helpful

mirzashah gravatar image mirzashah  ( 2013-05-09 08:43:47 -0500 )edit

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

Zayin gravatar image Zayin  ( 2013-05-09 09:46:51 -0500 )edit

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.

mirzashah gravatar image mirzashah  ( 2013-05-09 10:11:51 -0500 )edit

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

Zayin gravatar image Zayin  ( 2013-05-09 10:23:42 -0500 )edit

@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.

tfoote gravatar image tfoote  ( 2013-05-13 15:42:30 -0500 )edit

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

Min gravatar image Min  ( 2014-09-30 22:30:23 -0500 )edit

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.

dseifert gravatar image dseifert  ( 2016-08-18 13:20:53 -0500 )edit