ahornung/nao_robot — pull request #2 by miguelsdc (2013-07-25 18:04:14+00:00)
Title: Nao Controller Preemption

There are two key changes for the actions offered by this module:
* Actions are set as preempted, aborted and succeeded as required (before they were set to succeeded all the time)
* Cancel goal does actually stop the action in progress.

The interface remains virtually the same, except for the fact that cancel_goal() will _stop_ the ongoing action. Hopefully no one depended on this --unexpected-- behaviour and so code should continue to work as expected.

There's also a minor change: the module now has a "poll_rate" parameter which controls how often does the action thread check whether the action has been preempted or the node has been shutdown. By default it's set to 200ms which should be appropriate for most situations.

The main trick to allow for preemption of actions is to "post" them (ie. execute them for another thread), and wait for them to finish (whilst checking the task hasn't been preempted).