A wrapper for multiple instances of a given action, one for each arm in the system. More...
#include <service_action_wrappers.h>
Public Member Functions | |
actionlib::SimpleActionClient < ActionDataType > & | client (std::string arm_name, ros::Duration timeout=ros::Duration(5.0)) |
Returns a action client for the requested arm. | |
MultiArmActionWrapper (std::string prefix, std::string suffix, bool param, bool resolve_names) | |
Sets the node handle, prefix and suffix. | |
~MultiArmActionWrapper () | |
Private Types | |
typedef std::map< std::string, actionlib::SimpleActionClient < ActionDataType > * > | map_type |
Private Attributes | |
map_type | clients_ |
The list of clients already created, mapped to action names. | |
ros::NodeHandle | nh_ |
The node handle used to create actions. | |
bool | param_ |
Parameter to be passed on to the action client. | |
std::string | prefix_ |
Prefix attached to arm name to get action name. | |
bool | resolve_names_ |
Whether the resulting name should first be resolved using the node handle. | |
std::string | suffix_ |
Suffix attached to arm name to get action name. |
A wrapper for multiple instances of a given action, one for each arm in the system.
This function performs mapping from an arm_name to a action for that arm.
It obtains the name of the action by adding a prefix and/or suffix to the name of the arm.
For each arm, it also performs "wait on first use". When the action for a given arm name is first requested, it will wait for the action, then create the client and return it. It will also remember the client, so that on subsequent calls the client is returned directly without additional waiting.
Definition at line 228 of file service_action_wrappers.h.
typedef std::map<std::string, actionlib::SimpleActionClient<ActionDataType>* > object_manipulator::MultiArmActionWrapper< ActionDataType >::map_type [private] |
It seems the SimpleActionClient is non-copyable, so I could not store them directly in the map.
Definition at line 244 of file service_action_wrappers.h.
object_manipulator::MultiArmActionWrapper< ActionDataType >::MultiArmActionWrapper | ( | std::string | prefix, |
std::string | suffix, | ||
bool | param, | ||
bool | resolve_names | ||
) | [inline] |
Sets the node handle, prefix and suffix.
Definition at line 255 of file service_action_wrappers.h.
object_manipulator::MultiArmActionWrapper< ActionDataType >::~MultiArmActionWrapper | ( | ) | [inline] |
Definition at line 259 of file service_action_wrappers.h.
actionlib::SimpleActionClient<ActionDataType>& object_manipulator::MultiArmActionWrapper< ActionDataType >::client | ( | std::string | arm_name, |
ros::Duration | timeout = ros::Duration(5.0) |
||
) | [inline] |
Returns a action client for the requested arm.
Action name is obtained as prefix + arm_name + suffix. On first request for a given arm, a action client will be initialized, and the action will be waited for. On subsequent calls for the same arm, the action is returned directly.
Definition at line 272 of file service_action_wrappers.h.
map_type object_manipulator::MultiArmActionWrapper< ActionDataType >::clients_ [private] |
The list of clients already created, mapped to action names.
Definition at line 247 of file service_action_wrappers.h.
ros::NodeHandle object_manipulator::MultiArmActionWrapper< ActionDataType >::nh_ [private] |
The node handle used to create actions.
Definition at line 232 of file service_action_wrappers.h.
bool object_manipulator::MultiArmActionWrapper< ActionDataType >::param_ [private] |
Parameter to be passed on to the action client.
Definition at line 241 of file service_action_wrappers.h.
std::string object_manipulator::MultiArmActionWrapper< ActionDataType >::prefix_ [private] |
Prefix attached to arm name to get action name.
Definition at line 235 of file service_action_wrappers.h.
bool object_manipulator::MultiArmActionWrapper< ActionDataType >::resolve_names_ [private] |
Whether the resulting name should first be resolved using the node handle.
Use this if you are remapping service names.
Definition at line 251 of file service_action_wrappers.h.
std::string object_manipulator::MultiArmActionWrapper< ActionDataType >::suffix_ [private] |
Suffix attached to arm name to get action name.
Definition at line 238 of file service_action_wrappers.h.