Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Espeak] say(const std::string& text): is/can it be blocking? #21

Closed
jgvictores opened this issue Apr 19, 2018 · 7 comments
Closed

[Espeak] say(const std::string& text): is/can it be blocking? #21

jgvictores opened this issue Apr 19, 2018 · 7 comments
Assignees
Labels

Comments

@jgvictores
Copy link
Member

[Espeak] say(const std::string& text): is/can it be blocking?

Is it streaming as before or can it now be used as an RPC service?

If so, hard-coded waits such as the following can be refactored: https://github.com/roboticslab-uc3m/follow-me/blob/b462dad42fc243732744ccb276249a341ce9c2d3/programs/followMeDialogueManager/StateMachine.cpp#L131

@rsantos88
Copy link
Contributor

[Espeak] say(const std::string& text): is/can it be blocking?

No, it's not blocking but it's good to have a bit delay before muting

@jgvictores
Copy link
Member Author

The server is implemented as RPC, so something could be done here, and I believe it should.

I think we have two options here:

  1. Make it blocking. Advantage: No change in API. Disadvantage: We loose flexibility.
  2. Create new function like checkSayDone. Advantage: We maintain and even gain flexibility. Disadvantage: Change in API, and small sync issues similar to those in controlboard.

I like the last option a bit more, but I'm open to opinions.

@PeterBowman
Copy link
Member

PeterBowman commented Apr 25, 2018

I'd advise against the first option. In the future, if not done yet, you might want to implement a stopTalking (or shutUp 😀) method, which I believe would come up against serious difficulties when going the blocking way, at least as I found out while working on a similar problem at kinematics-dynamics (roboticslab-uc3m/kinematics-dynamics#106). Going back to the kin-dyn repo, we introduced not so long ago a wait method which might be of use here (prototype) and would count as a 2b option. That would require the least work downstream, just replace existing hardcoded waits with this new interface method.

@PeterBowman
Copy link
Member

No, it's not blocking but it's good to have a bit delay before muting

Sorry, but this statement is false, the say command does block (here)...

@PeterBowman
Copy link
Member

And it makes no sense to block since we provide pause/resume/stop commands. So I guess it should be unblocked, and a new wait command be added?

@jgvictores
Copy link
Member Author

So I guess it should be unblocked

For sure.

and a new wait command be added?

Seems like the quick and fast solution.

Note that the checkSayDone alternative proposed above was in analogy with IPositionControl::checkMotionDone.

No strong opinions in a wait vs checkSayDone, but perhaps food for thought. ^^

@PeterBowman
Copy link
Member

PeterBowman commented Nov 10, 2021

Another point: checkSayDone would allow multiple-client scenarios thanks to not blocking RPC comms on the server side.

Edit: YARP does not actually block port callbacks, thus allowing two clients to get their request handled independently at once, but Espeak will not process a queued say command until the previous one was completed (regardless of the espeak_Synchronize call).

@PeterBowman PeterBowman self-assigned this Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants