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 _tibi_dabo_head_driver_node_h_ 00026 #define _tibi_dabo_head_driver_node_h_ 00027 00028 #include <iri_base_driver/iri_base_driver_node.h> 00029 #include "tibi_dabo_head_driver.h" 00030 00031 // [publisher subscriber headers] 00032 #include <trajectory_msgs/JointTrajectoryPoint.h> 00033 #include <sensor_msgs/JointState.h> 00034 #include <std_msgs/String.h> 00035 00036 // [service client headers] 00037 00038 // [action server client headers] 00039 #include <iri_action_server/iri_action_server.h> 00040 #include <tibi_dabo_msgs/sequenceAction.h> 00041 #include <control_msgs/FollowJointTrajectoryAction.h> 00042 00043 // diagnostic headers 00044 #include "diagnostic_updater/diagnostic_updater.h" 00045 #include "diagnostic_updater/publisher.h" 00046 00064 class TibiDaboHeadDriverNode : public iri_base_driver::IriBaseNodeDriver<TibiDaboHeadDriver> 00065 { 00066 private: 00067 // [publisher attributes] 00068 ros::Publisher joint_feedback_publisher_; 00069 sensor_msgs::JointState JointState_msg_; 00070 00071 // [subscriber attributes] 00072 ros::Subscriber joint_position_subscriber_; 00073 void joint_position_callback(const trajectory_msgs::JointTrajectoryPoint::ConstPtr& msg); 00074 CMutex joint_position_mutex_; 00075 ros::Subscriber facial_expression_subscriber_; 00076 void facial_expression_callback(const std_msgs::String::ConstPtr& msg); 00077 CMutex facial_expression_mutex_; 00078 00079 // [service attributes] 00080 00081 // [client attributes] 00082 00083 // [action server attributes] 00084 // Action server fo the motion sequences 00085 IriActionServer<tibi_dabo_msgs::sequenceAction> motion_sequence_aserver_; 00086 void motion_sequence_startCallback(const tibi_dabo_msgs::sequenceGoalConstPtr& goal); 00087 void motion_sequence_stopCallback(void); 00088 bool motion_sequence_isFinishedCallback(void); 00089 bool motion_sequence_hasSucceedCallback(void); 00090 void motion_sequence_getResultCallback(tibi_dabo_msgs::sequenceResultPtr& result); 00091 void motion_sequence_getFeedbackCallback(tibi_dabo_msgs::sequenceFeedbackPtr& feedback); 00092 00093 // action server for the joint motion of the head 00094 IriActionServer<control_msgs::FollowJointTrajectoryAction> joint_motion_aserver_; 00095 void joint_motion_startCallback(const control_msgs::FollowJointTrajectoryGoalConstPtr& goal); 00096 void joint_motion_stopCallback(void); 00097 bool joint_motion_isFinishedCallback(void); 00098 bool joint_motion_hasSucceedCallback(void); 00099 void joint_motion_getResultCallback(control_msgs::FollowJointTrajectoryResultPtr& result); 00100 void joint_motion_getFeedbackCallback(control_msgs::FollowJointTrajectoryFeedbackPtr& feedback); 00101 00102 // [action client attributes] 00103 00111 void postNodeOpenHook(void); 00112 void preNodeCloseHook(void); 00113 00114 public: 00132 TibiDaboHeadDriverNode(ros::NodeHandle& nh); 00133 00140 ~TibiDaboHeadDriverNode(void); 00141 00142 protected: 00155 void mainNodeThread(void); 00156 00157 // [diagnostic functions] 00158 void check_motion_sequence_status(diagnostic_updater::DiagnosticStatusWrapper &stat); 00159 00170 void addNodeDiagnostics(void); 00171 00172 // [driver test functions] 00173 00183 void addNodeOpenedTests(void); 00184 00194 void addNodeStoppedTests(void); 00195 00205 void addNodeRunningTests(void); 00206 00214 void reconfigureNodeHook(int level); 00215 00216 }; 00217 00218 #endif