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

Action server with more than one action...

asked 2011-04-19 19:19:51 -0600

felix gravatar image

I find the notion of action server "limited" to one goal rather restrictive... Is it possible to have a process with more than one action server?

For example, imagine that your have a process handling a particular "functionality" on your robot, and you want this process to handle different types of action goals (which need to execute in the same memory space). Could it be possible to define multiple action server in this process, or there will be some problems (such as reentrance, etc).

Of course, you could define a "meta" goal and use one of its arguments to define which underlying action/goal to execute.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
9

answered 2011-04-19 21:30:06 -0600

I find the notion of action server "limited" to one goal rather restrictive... Is it possible to have a process with more than one action server?

There is a difference between limitation to one goal and limitation to one action server.

  • There is no limit to how many action servers a node can have. It is perfectly possible to have one ROS node with multiple action servers; just pass them different topic names on creation.
  • Each SimpleActionServer is limited to one goal; whenever there is a new incoming goal, the currently pending goal is cancelled. This behaviour is a simplification of the actionlib API which catches most use cases.
  • If you want to have a more sophisticated handling of goals, you are free to do so using the actionlib API directly (without the SimpleActionServer). You could have multiple goals executing in parallel, queue goals, and generally do whatever you want.

Just a side remark: if you have separate functionalities which you would ordinarily implement as separate ROS nodes, but which have to run in the same process for technical reasons, you could consider implementing them as nodelets.

edit flag offensive delete link more

Comments

Thanks! this is very clear and useful.

nickcking gravatar image nickcking  ( 2017-02-14 02:40:04 -0600 )edit
0

answered 2011-04-20 04:53:07 -0600

vpradeep gravatar image

Could it be possible to define multiple action server in this process, or there will be some problems (such as reentrance, etc).

If you have two very different behaviors that you want to respond to, it is totally reasonable to have two action servers in a single process. Just remember that in order to prevent topic collisions, each action server must operate in its own namespace. And, assuming that you're using the ExecuteCallback to service goals, you're going to now have 2 different Execute callbacks: one for each action server.

If both action servers simultaneously receive goals, then yes, both execute callbacks with be run concurrently. Just as in any event driven asynchronous system, it is your responsibility to add locks to ensure that you don't run into concurrency issues.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2011-04-19 19:19:51 -0600

Seen: 6,724 times

Last updated: Apr 20 '11