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_arm_navigation_alg_node_h_ 00026 #define _wam_arm_navigation_alg_node_h_ 00027 00028 #include <iri_base_algorithm/iri_base_algorithm.h> 00029 #include "wam_arm_navigation_alg.h" 00030 00031 // [publisher subscriber headers] 00032 #include <iri_wam_arm_navigation/PoseSimple.h> 00033 00034 // [service client headers] 00035 00036 // [action server client headers] 00037 #include <actionlib/client/simple_action_client.h> 00038 #include <actionlib/client/terminal_state.h> 00039 00040 #include <iri_action_server/iri_action_server.h> 00041 #include <iri_wam_arm_navigation/SimplePoseAction.h> 00042 00047 class WamArmNavigationAlgNode : public algorithm_base::IriBaseAlgorithm<WamArmNavigationAlgorithm> 00048 { 00049 private: 00050 // [publisher attributes] 00051 00052 // [subscriber attributes] 00053 ros::Subscriber simple_pose_topic_subscriber_; 00054 void simple_pose_topic_callback(const iri_wam_arm_navigation::PoseSimple::ConstPtr& msg); 00055 00056 bool aborted; 00057 CMutex simple_pose_topic_mutex_; 00058 00059 // [service attributes] 00060 00061 // [client attributes] 00062 00063 // [action server attributes] 00064 IriActionServer<iri_wam_arm_navigation::SimplePoseAction> simple_pose_move_aserver_; 00065 void simple_pose_moveStartCallback(const iri_wam_arm_navigation::SimplePoseGoalConstPtr& goal); 00066 void simple_pose_moveStopCallback(void); 00067 bool simple_pose_moveIsFinishedCallback(void); 00068 bool simple_pose_moveHasSucceedCallback(void); 00069 void simple_pose_moveGetResultCallback(iri_wam_arm_navigation::SimplePoseResultPtr& result); 00070 void simple_pose_moveGetFeedbackCallback(iri_wam_arm_navigation::SimplePoseFeedbackPtr& feedback); 00071 00072 // [action client attributes] 00073 actionlib::SimpleActionClient<arm_navigation_msgs::MoveArmAction> move_iri_wam_client_; 00074 arm_navigation_msgs::MoveArmGoal move_iri_wam_goal_; 00075 void move_iri_wamMakeActionRequest(const arm_navigation_msgs::MoveArmGoal& msg); 00076 void move_iri_wamDone(const actionlib::SimpleClientGoalState& state, const arm_navigation_msgs::MoveArmResultConstPtr& result); 00077 void move_iri_wamActive(); 00078 void move_iri_wamFeedback(const arm_navigation_msgs::MoveArmFeedbackConstPtr& feedback); 00079 00080 arm_navigation_msgs::ArmNavigationErrorCodes code_result; 00081 00082 std::string state_msg,state__; 00083 bool END; 00084 public: 00091 WamArmNavigationAlgNode(void); 00092 00099 ~WamArmNavigationAlgNode(void); 00100 00101 void makeMoveMsg(arm_navigation_msgs::MoveArmGoal& goal); 00102 00103 protected: 00116 void mainNodeThread(void); 00117 00130 void node_config_update(Config &config, uint32_t level); 00131 00138 void addNodeDiagnostics(void); 00139 00140 // [diagnostic functions] 00141 00142 // [test functions] 00143 }; 00144 00145 #endif