Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

actionlib with own spinning

Hi everyone,

when trying to get around this issue(the defined done_cb does not always get called even though a result message is being sent) I had the idea that I could use the usual ros::spin() instead of spinning up a separate thread for the action. So I am basically initializing the actionclient like this:

typedef actionlib::SimpleActionClient<flyToAction> Client;
Client* ac_;
static Client ac(action_name, false);
ac_ = &ac;

Which does work (almost) fine with the flag set to true (= spin up an own thread for messaging) - the issue that I have with that is described in the link above.

For reference, I am sending new goals as:

ac_->sendGoal(  actionGoal,
                boost::bind(&nodeToCoordinateConverter::doneCB, this, _1, _2),
                boost::bind(&nodeToCoordinateConverter::feedbackCB, this, _1));
while (!arrived)

I.e. with a done_cb and a feedback_cb. In the done_cb I set the global variable arrived to true, so the loop should exit then. I expected that the ros::spinOnce() would also handle the callbacks from the action in this case, but it doesn't. Am I missing some implicit definition of another CallbackQueue that I need to define a spinner for? After reading the documentation that says the user must call spin() himself I thought the repeated calling of spinOnce() should be sufficient?

Cheers Joachim