sound play repeat and first subscribe error
I'm using the sound play package to pause/play/repeat/stop sounds.
http://wiki.ros.org/sound_play
Its being written in python and there's a couple issues I'm having using this package.
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 soundplay_node.py
Secondly, the .startWave doesn't work for me. It plays once and stops.
Here's the code I've written to get this going.
rospy.init_node('audio')
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 soundplay_node.py is subscribed
while(ready.get_num_connections() < 1):
sound_client.playWave("/absolute/path/to/wav/file")
rospy.sleep(1)
sound_client.startWave("/absolute/path/to/wav/file")
while not rospy.is_shutdown():
r.sleep()
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!
Did you first of all launch the soundplay_node with roslaunch sound_play soundplay_node.launch?
I ran it with "rosrun audio_signature ros_play_audio.py " which would be the same thing? I just tried with the launch file instead, and I got the same results/errors I did before.
Don't known if it's the same, I can't find the audio_signature package. Does the test test.py in the sound_play package work?