Actionclient Wait best practise
Hello,
I'm using the SimpleActionClient for my commanding for example navigation goals, which works great at the moment. The next step is to cancel the current goal if I get some topic or user input. My question for that is what is the best practise for this approach?
I also have to wait till the goal is finished
Solution 1 :
if(actionClient.isServerConnected())
{
actionClient.sendGoalAndWait(goal); // possible with wake up time and check some variable
}
the action blocks until the goal is finished. It is possible to call in a seperate thread :
actionClient.cancelAllGoals() // thread safe?
Solution 2 :
if(actionClient.isServerConnected())
{
actionClient.sendGoal(goal,FinishedCB); // possible with wake up time and check some variable
conditionVariableNotification.wait(...) // conditionVariable can be notified by user topic or finished topic of Action
}
Solution 3: ???
What is your favourite approach to interrupt a goal?