Multiple SimpleActionServer member variables
I am building a AI module for a robot. The module will provide two actions, so I've been learning about actionlib through the tutorials.
I implemented the first tutorial and got it working nicely in my application.
My current approach for one action is roughly as follows. The action server is started in the class constructor.
class RobotAI
{
public:
RobotAI(std::string name);
~RobotAI(void);
void executeInspectAreaCB(const robot_ai::InspectAreaGoalConstPtr &goal);
private:
ros::NodeHandle nh_;
// Action servers and messages that are used to published feedback/result
actionlib::SimpleActionServer<robot_ai::InspectAreaAction> inspect_as_;
std::string inspect_action_name_;
robot_ai::InspectAreaFeedback inspect_feedback_;
robot_ai::InspectAreaResult inspect_result_;
};
However, now that I'm implementing two actions and I would like to manage them within a single robot AI class, I was wondering what would be the best way of achieving this? Should I just add another SimpleActionServer
to my current class to handle the other action? Or should I make a class as implemented in the first tutorial for both actions and include them as member variables for my AI class?
I am using ROS Indigo on Ubuntu 14.04.