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_dmp_tracker_driver_node_h_ 00026 #define _wam_dmp_tracker_driver_node_h_ 00027 00028 #include <iri_base_driver/iri_base_driver_node.h> 00029 #include "wam_dmp_tracker_driver.h" 00030 00031 // [publisher subscriber headers] 00032 #include <geometry_msgs/PoseStamped.h> 00033 #include <trajectory_msgs/JointTrajectoryPoint.h> 00034 00035 // [service client headers] 00036 #include <iri_wam_common_msgs/wamInverseKinematics.h> 00037 00038 // [action server client headers] 00039 #include <actionlib/client/simple_action_client.h> 00040 #include <actionlib/client/terminal_state.h> 00041 #include <iri_wam_common_msgs/DMPTrackerAction.h> 00042 00060 class WamDmpTrackerDriverNode : public iri_base_driver::IriBaseNodeDriver<WamDmpTrackerDriver> 00061 { 00062 private: 00063 // [publisher attributes] 00064 ros::Publisher DMPTrackerNewGoal_publisher_; 00065 trajectory_msgs::JointTrajectoryPoint JointTrajectoryPoint_msg_; 00066 00067 // [subscriber attributes] 00068 ros::Subscriber pose_surface_subscriber_; 00069 void pose_surface_callback(const geometry_msgs::PoseStamped::ConstPtr& msg); 00070 CMutex pose_surface_mutex_; 00071 00072 // [service attributes] 00073 00074 // [client attributes] 00075 ros::ServiceClient wamik_client_; 00076 iri_wam_common_msgs::wamInverseKinematics wamik_srv_; 00077 00078 // [action server attributes] 00079 00080 // [action client attributes] 00081 actionlib::SimpleActionClient<iri_wam_common_msgs::DMPTrackerAction> DMPTracker_client_; 00082 iri_wam_common_msgs::DMPTrackerGoal DMPTracker_goal_; 00083 void DMPTrackerMakeActionRequest(); 00084 void DMPTrackerDone(const actionlib::SimpleClientGoalState& state, const iri_wam_common_msgs::DMPTrackerResultConstPtr& result); 00085 void DMPTrackerActive(); 00086 void DMPTrackerFeedback(const iri_wam_common_msgs::DMPTrackerFeedbackConstPtr& feedback); 00087 00088 00096 void postNodeOpenHook(void); 00097 00098 public: 00116 WamDmpTrackerDriverNode(ros::NodeHandle& nh); 00117 00124 ~WamDmpTrackerDriverNode(void); 00125 00126 protected: 00139 void mainNodeThread(void); 00140 00141 // [diagnostic functions] 00142 00153 void addNodeDiagnostics(void); 00154 00155 // [driver test functions] 00156 00166 void addNodeOpenedTests(void); 00167 00177 void addNodeStoppedTests(void); 00178 00188 void addNodeRunningTests(void); 00189 00197 void reconfigureNodeHook(int level); 00198 00199 }; 00200 00201 #endif