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

sound play repeat and first subscribe error

asked 2014-06-03 22:26:53 -0500

pwong gravatar image

I'm using the sound play package to pause/play/repeat/stop sounds.

Its being written in python and there's a couple issues I'm having using this package.

  1. I need to first play a sound and receive an error, before it'll work. This is the error

    [ERROR] [WallTime: 1401851197.944862] Sound command issued, but no node is subscribed to the topic. Perhaps you forgot to run

  2. Secondly, the .startWave doesn't work for me. It plays once and stops.

Here's the code I've written to get this going.

ready = rospy.Subscriber("robotsound", SoundRequest, sound_ready)

r = rospy.Rate(1) 

#I've tried to do a sleep here, but it didn't fix the issue
sound_client = SoundClient()

#This checks for when is subscribed
while(ready.get_num_connections() < 1):

while not rospy.is_shutdown():

I ran into the same problems on c++ as well. The only difference is a warning is produced instead of an error. This leads me to believe I'm just not using it correctly... If anyone can offer help, I'd appreciate it!

edit retag flag offensive close merge delete


Did you first of all launch the soundplay_node with roslaunch sound_play soundplay_node.launch?

BennyRe gravatar image BennyRe  ( 2014-06-04 01:51:38 -0500 )edit

I ran it with "rosrun audio_signature " which would be the same thing? I just tried with the launch file instead, and I got the same results/errors I did before.

pwong gravatar image pwong  ( 2014-06-04 11:56:01 -0500 )edit

Don't known if it's the same, I can't find the audio_signature package. Does the test in the sound_play package work?

BennyRe gravatar image BennyRe  ( 2014-06-05 01:57:06 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-02-03 12:16:48 -0500

Idox gravatar image

updated 2021-02-03 12:23:59 -0500

Put rospy.sleep(1) after calling SoundClient()

You were right about the sleep but not about the location possibly.

With that there is no need for the while loop.

So Make sure you are sourced. Make sure roscore is up.


rosrun sound_play

then run your program.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-06-03 22:26:53 -0500

Seen: 2,850 times

Last updated: Feb 03 '21