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

How to use SoundRequestFeedback to tell if a sound is being played or not?

asked 2017-04-15 19:37:02 -0500

Azul gravatar image

updated 2017-04-16 16:26:23 -0500

I am trying to reference the .playing function in SoundRequestFeedback.h(link to file) to allow my system to finish speaking before executing the rest of the code but I can't seem to figure out how to properly do that.

In my header file I declared sound_play::SoundRequestFeedback_<ContainerAllocator> v and proceeded to try and do

ROS_INFO("%d", v.playing); // prints False<->0 
sound_play::SoundClient.say("This is a test message"); //Says "This is a test message"
while(v.playing){}
    //stays in a loop while the system is saying the message
ROS_INFO("%d", v.playing); // also prints False, but does so while the system is still saying the message.

so v.playing always returns 0 and I don't know why. Does anyone know why ?

edit retag flag offensive close merge delete

Comments

Could you link to the files that you are referring to?

NEngelhard gravatar image NEngelhard  ( 2017-04-16 05:29:37 -0500 )edit

Yes, I edited the question.

Azul gravatar image Azul  ( 2017-04-16 16:27:31 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-04-17 08:11:22 -0500

NEngelhard gravatar image

I don't think this is possible as the sound_play::Soundclient only publishes requests but does not listen for any feedback. I also don't understand your code. How is your feedback-object linked to the Soundclient? Does this piece of code even compile? (and btw: .playing is not a function)

You could run the soundplay_node in sound_play. This nodes offers an SoundRequest-ActionServer to which you can send your goal and wait for the result. In my experiements, the result-message came around 2 seconds after the sound really finished, but you could check that with your setup.

edit flag offensive delete link more

Comments

Hi, the piece of code compiled and it always returned 0. Could you provide the code example from your experiments ? I looked at the tutorials on ros.wiki but I'm not quite sure how to apply it to my case

Azul gravatar image Azul  ( 2017-04-18 16:50:57 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2017-04-15 19:37:02 -0500

Seen: 159 times

Last updated: Apr 17 '17