Actionclient Wait best practise

asked 2016-04-14 04:10:46 -0500

Hunk gravatar image


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 :

    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 :

    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?

edit retag flag offensive close merge delete