4444
4545namespace moveit {
4646namespace task_constructor {
47+ namespace stages {
4748
4849/* *
4950* @brief Interface allowing stages to use a simple action client
@@ -54,22 +55,29 @@ namespace task_constructor {
5455template <class ActionSpec >
5556class ActionBase
5657{
57- private :
58+ protected :
5859 ACTION_DEFINITION (ActionSpec);
5960
6061public:
6162 /* *
6263 * @brief Constructor
63- * @param name - action name
64+ * @param action_name - action namespace
6465 * @param server_timeout - connection to server time out (0 is considered infinite timeout)
6566 * @param goal_timeout - goal to completed time out (0 is considered infinite timeout)
6667 * @param spin_thread - spins a thread to service this action's subscriptions
6768 * @details Initialize the action client and time out parameters
6869 */
69- ActionBase (const std::string &name ,
70+ ActionBase (const std::string &action_name ,
7071 double server_timeout = 0.0 ,
7172 double goal_timeout = 0.0 ,
72- bool spin_thread = true );
73+ bool spin_thread = true )
74+ : action_name_(action_name), server_timeout_(server_timeout), goal_timeout_(goal_timeout) {
75+
76+ clientPtr_.reset (new actionlib::SimpleActionClient<ActionSpec>(action_name, spin_thread));
77+ }
78+
79+ // ActionBase(const std::string &action_name) : action_name_(action_name) {};
80+ // ActionBase() {}
7381
7482 /* @brief Destructor */
7583 virtual ~ActionBase () = default ;
@@ -89,14 +97,16 @@ class ActionBase
8997 * @param result - pointer to result message
9098 */
9199 virtual void doneCallback (const actionlib::SimpleClientGoalState& state,
92- const ActionResultConstPtr &result) = 0;
100+ const ResultConstPtr &result) = 0;
93101
94102protected:
95- std::unique_ptr<actionlib::SimpleActionClient<ActionSpec>> clientPtr_; // action client
96- ActionGoal goal_; // goal message
97- double server_timeout_, goal_timeout_; // connection and goal completed time out
103+ std::string action_name_;
104+ std::unique_ptr<actionlib::SimpleActionClient<ActionSpec>> clientPtr_; // action client
105+ ActionGoal goal_; // goal message
106+ double server_timeout_, goal_timeout_; // connection and goal completed time out
98107};
99108
100109
101- } // namespace task_constructor
102- } // namespace moveit
110+ } // namespace stages
111+ } // namespace task_constructor
112+ } // namespace moveit
0 commit comments