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

Actionlib Auto_Start Parameter

asked 2013-12-04 17:20:38 -0500

daalt gravatar image

I get the following warning when running my custom action server:

[WARN] [WallTime: 1386219718.920124] You've passed in true for auto_start to the python action server, you should always pass in false to avoid race conditions.

Two questions:

1) If actionlib only handles one goal at a time, how conceivably could race conditions occur?

2) Where and how exactly is the auto_start parameter passed?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-12-05 00:00:37 -0500

mirzashah gravatar image

updated 2018-07-03 20:16:14 -0500

130s gravatar image

1) Actionlib can handle as many goals as you like...I think you're thinking of SimpleActionServer/SimpleActionClient which is a simple and common use case of actionlib with single goals.

2) The point of autostart has less to do with race conditions relating to the goal and more so to do with the initialization of the ROS node.

In the ActionServer constructor, one of the parameters is "auto_start ". If you have this set to true, the actionserver immediately starts trying to publish (you can see this for yourself in the source code for actionlib https://github.com/ros/actionlib ) by calling an internal method called "start()". This can be bad. For example, if you have your ActionServers as global variables that are created before init() is called. This can happen in C++ if your ActionServer is a global value within a compilation unit and in Python if you import modules that create global ActionServer objects outside the scope of a class or function.

If you set auto_start to false, you can then spin up the ActionServer with the "start()" method at a later time. Setting it to true automatically calls this right away. Hence the warning...you should always start the ActionServers when you know you're ready to start taking goal requests.

edit flag offensive delete link more

Comments

1

In Python auto_start is True by default, which is counter intuitive to me now that I read this. Related PR.

130s gravatar image 130s  ( 2016-12-11 03:47:28 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2013-12-04 17:20:38 -0500

Seen: 1,650 times

Last updated: Jul 03 '18