00001 // Copyright (C) 2010-2011 Institut de Robotica i Informatica Industrial, CSIC-UPC. 00002 // Author 00003 // All rights reserved. 00004 // 00005 // This file is part of iri-ros-pkg 00006 // iri-ros-pkg is free software: you can redistribute it and/or modify 00007 // it under the terms of the GNU Lesser General Public License as published by 00008 // the Free Software Foundation, either version 3 of the License, or 00009 // at your option) any later version. 00010 // 00011 // This program is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU Lesser General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public License 00017 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 // 00019 // IMPORTANT NOTE: This code has been generated through a script from the 00020 // iri_ros_scripts. Please do NOT delete any comments to guarantee the correctness 00021 // of the scripts. ROS topics can be easly add by using those scripts. Please 00022 // refer to the IRI wiki page for more information: 00023 // http://wikiri.upc.es/index.php/Robotics_Lab 00024 00025 #ifndef _wam_move_arm_alg_node_h_ 00026 #define _wam_move_arm_alg_node_h_ 00027 #include <boost/scoped_ptr.hpp> 00028 #include <boost/thread/recursive_mutex.hpp> 00029 #include <actionlib/server/simple_action_server.h> 00030 00031 #include <iri_base_algorithm/iri_base_algorithm.h> 00032 #include "wam_move_arm_alg.h" 00033 00034 // [publisher subscriber headers] 00035 00036 // [service client headers] 00037 00038 // [action server client headers] 00039 #include <iri_action_server/iri_action_server.h> 00040 #include <arm_navigation_msgs/MoveArmAction.h> 00041 #include <arm_navigation_msgs/ArmNavigationErrorCodes.h> 00042 #include <actionlib/client/simple_action_client.h> 00043 #include <actionlib/client/terminal_state.h> 00044 #include <arm_navigation_msgs/ArmNavigationErrorCodes.h> 00050 class WamMoveArmAlgNode : public algorithm_base::IriBaseAlgorithm<WamMoveArmAlgorithm> 00051 { 00052 private: 00053 // [publisher attributes] 00054 00055 // [subscriber attributes] 00056 00057 // [service attributes] 00058 00059 // [client attributes] 00060 00061 // [action server attributes] 00062 00063 bool has_move_arm_feedback; 00064 ros::Duration time_move_arm_feedback; 00065 std::string state_move_arm_feedback; 00066 00067 bool has_move_arm_result; 00068 arm_navigation_msgs::ArmNavigationErrorCodes error_code_move_arm; 00069 std::vector<arm_navigation_msgs::ContactInformation> contact_information_move_arm; 00070 std::string state_move_arm_goal; 00071 00072 00073 IriActionServer<arm_navigation_msgs::MoveArmAction> move_arm_aserver_; 00074 void move_armStartCallback(const arm_navigation_msgs::MoveArmGoalConstPtr& goal); 00075 void move_armStopCallback(void); 00076 bool move_armIsFinishedCallback(void); 00077 bool move_armHasSucceedCallback(void); 00078 void move_armGetResultCallback(arm_navigation_msgs::MoveArmResultPtr& result); 00079 void move_armGetFeedbackCallback(arm_navigation_msgs::MoveArmFeedbackPtr& feedback); 00080 00081 00082 // [action client attributes] 00083 actionlib::SimpleActionClient<arm_navigation_msgs::MoveArmAction> syn_move_arm_client_; 00084 arm_navigation_msgs::MoveArmGoal syn_move_arm_goal_; 00085 void syn_move_armMakeActionRequest(const arm_navigation_msgs::MoveArmGoal& goal); 00086 void syn_move_armDone(const actionlib::SimpleClientGoalState& state, const arm_navigation_msgs::MoveArmResultConstPtr& result); 00087 void syn_move_armActive(); 00088 void syn_move_armFeedback(const arm_navigation_msgs::MoveArmFeedbackConstPtr& feedback); 00089 00090 arm_navigation_msgs::MoveArmResult move_result; 00091 arm_navigation_msgs::MoveArmFeedback move_feedback; 00092 00093 public: 00100 WamMoveArmAlgNode(void); 00101 00108 ~WamMoveArmAlgNode(void); 00109 00110 protected: 00123 void mainNodeThread(void); 00124 00137 void node_config_update(Config &config, uint32_t level); 00138 00145 void addNodeDiagnostics(void); 00146 00147 // [diagnostic functions] 00148 00149 // [test functions] 00150 }; 00151 00152 #endif