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

Revision history [back]

click to hide/show revision 1
initial version

Hi everyone

I solve it. It looks like I need a give a some time to initialize SoundClient. After I implemented a delay before issuing a sound ,everything works.

The code look as follow:

#include "ros/ros.h"
#include <sound_play/sound_play.h>

int main(int argc, char **argv)  {

ros::init(argc,argv,"audio_common_tutorial");
ros::NodeHandle n;

sound_play::SoundClient sc;
ros::Duration(1, 0).sleep();
sc.playWaveFromPkg("sound_play", "sounds/BACKINGUP.ogg");
sc.playWave( "/home/ntuser/catkin_ws/src/audio_common_tutorial/doc/file.wav");

ros::spin();
return 0;
}

If anyone has some smart comment why it is so I am happy to hear it ;)

regards