Ask Your Question
0

SimpleActionClient callbacks

asked 2018-10-01 06:49:49 -0600

zeynep gravatar image

updated 2018-10-01 06:52:47 -0600

gvdhoorn gravatar image

Hello, I m sending goals to move_base action server using SimpleActionClient. I have TaskControl class methods for action client callback functions. I m confused about callbacks of actions.. My question is; if these callbacks are running as a seperate thread from main or is it the same thread with main and blocking my code while running callbacks..

actionlib::SimpleActionClient<move_base_msgs::MoveBaseAction> nav_ac("move_base", true);
nav_ac.sendGoal(
          nav_goal,
          boost::bind(
              &TaskControl::doneCB<move_base_msgs::MoveBaseResultConstPtr>,
              this, _1, _2),
          boost::bind(&TaskControl::activeCB, this),
          boost::bind(&TaskControl::navFeedbackCB, this, _1));

Thanx Best Regards

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-10-01 07:41:37 -0600

This really depends on the type of spinner you use to process ROS messages.

The page here has a good summary, the simple ros::spin() is single threaded so they will block the rest of your code, but there are several multi-threaded versions to. You'll have to make sure your callbacks are thread safe for the use of these to be reliable though.

edit flag offensive delete link more

Comments

i just set spin_thread parameter of SimpleActionClient to true.. it is written in SimpleActionClient class template reference that If true, spins up a thread to service this action's subscriptions. So as I understand, its single threaded because of ros::spin.. am I right?

zeynep gravatar imagezeynep ( 2018-10-01 09:45:27 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2018-10-01 06:49:49 -0600

Seen: 146 times

Last updated: Oct 01 '18