How to fix a problem of sound_play for playing wave file in c++?

asked 2016-10-08 20:09:21 -0500

78226415 gravatar image

Hi everyone, I want to play a wave file by using sound_play in c++, the codes like: sound_play::SoundClient sc; sc.playWave("/root/Desktop/test.wav");

and it shows:

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

but i have run it before, like:

root@lgx-robot:~/hlf_ws# rosrun sound_play [INFO] [WallTime: 1475853878.411334] sound_play node is ready to play sound

If i try to play it with python as is: rosrun sound_play /root/Desktop/test.wav

it is ok and you could hear the sound of the wave file.

And if i run the command: rosrun sound_play "hello world" it shows:

root@lgx-robot:~/hlf_ws# rosrun sound_play "hello world" Saying: hello world Voice: voice_kal_diphone

and i could hear the sound. My environment is ubuntu14.04 LTS, ros indigo. what should i do? Should some one would help me? thanks

edit retag flag offensive close merge delete


From your description I can't tell why this is happening; it would be useful if you included the full source code for your program (or a simplified version of it that shows the problem). You may also want to inspect the ROS graph to make sure that your node is publishing on the correct topic.

ahendrix gravatar image ahendrix  ( 2016-11-10 00:03:40 -0500 )edit