ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

SimpleActionClient callbacks

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

zeynep gravatar image

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

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 -0500

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

1

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 image zeynep  ( 2018-10-01 09:45:27 -0500 )edit

Question Tools

Stats

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

Seen: 513 times

Last updated: Oct 01 '18