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

How do pause code while waiting on feedback from sound_play?

asked 2017-04-14 00:35:53 -0500

Azul gravatar image

I have a little voice-recognition project going for myself where the system communicates through a listening node and a speaking node. The problem is that I can't figure out how to "pause" my code and wait for my speaking node to call on .say() in sound_play and finish speaking before my code can continue. Because as it is right it calls the .say() method and says what it's supposed to but the code just keeps on running ( listening ) while it's still saying it and I don't want that.

Any ideas?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-04-14 04:29:00 -0500

NEngelhard gravatar image

I've never used it, but from looking at the source, you can tell it to block:

Each say/play/start/repeat method can take in an optional
blocking=True|False argument that will over-ride the class-wide
behavior. See for an example of this behavior.

edit flag offensive delete link more


Hi, my code is written in C/C++ and I'm not really sure how I could use this blocking function. Passing blocking=true to sound_play::SoundClient.say() doesn't seem to do the trick, it gives me a compile error that basically says I shouldn't pass that argument.

Azul gravatar image Azul  ( 2017-04-15 18:32:51 -0500 )edit

Question Tools

1 follower


Asked: 2017-04-14 00:35:53 -0500

Seen: 178 times

Last updated: Apr 14 '17