actionlib
actionlib copied to clipboard
wait for server asynchronously
Right now there are two ways to wait for a connection to be established between an actionlib client and an actionlib server:
-
client.waitForServer()
/client.waitForActionServerToStart()
- Periodically poll
client.isServerConnected()
until it returns true
Option 1 is easiest but needs a separate thread to process the event queue. Option 2 can work for single threaded applications but is rather ugly and cumbersome (need a timer to get a periodic callback).
It would be nice if there was another asynchronous alternative: register a callback to be called when the server connects.
For sanities sake it would be best if the callback is also invoked if the server is already connected or if the callback can only be registered in the constructor (when the server can't be connected yet anyway). Otherwise applications might miss the event and never notice the connection.