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 _kinton_arm_rosdriver_node_h_ 00026 #define _kinton_arm_rosdriver_node_h_ 00027 00028 #include <iri_base_driver/iri_base_driver_node.h> 00029 #include "kinton_arm.h" 00030 00031 #include <iostream> 00032 #include <vector> 00033 00034 // [publisher subscriber headers] 00035 #include <sensor_msgs/JointState.h> 00036 00037 // [service client headers] 00038 00039 // [action server client headers] 00040 00058 class KintonArmDriverNode : public iri_base_driver::IriBaseNodeDriver<KintonArmDriver> 00059 { 00060 private: 00061 // [publisher attributes] 00062 ros::Publisher arm_joint_feedback_publisher_; 00063 sensor_msgs::JointState JointState_msg_; 00064 00065 // [subscriber attributes] 00066 ros::Subscriber arm_joint_pos_subscriber_; 00067 void arm_joint_pos_callback(const sensor_msgs::JointState::ConstPtr& msg); 00068 CMutex arm_joint_pos_mutex_; 00069 00070 vector<int> new_pos_,old_pos_; 00071 00072 // [service attributes] 00073 00074 // [client attributes] 00075 00076 // [action server attributes] 00077 00078 // [action client attributes] 00079 00080 int servo_1_pos_,servo_2_pos_,servo_3_pos_,servo_4_pos_,servo_5_pos_; 00081 00089 void postNodeOpenHook(void); 00090 00091 public: 00109 KintonArmDriverNode(ros::NodeHandle& nh); 00110 00117 ~KintonArmDriverNode(void); 00118 00119 protected: 00120 00133 void mainNodeThread(void); 00134 00135 // [diagnostic functions] 00136 00147 void addNodeDiagnostics(void); 00148 00149 // [driver test functions] 00150 00160 void addNodeOpenedTests(void); 00161 00171 void addNodeStoppedTests(void); 00172 00182 void addNodeRunningTests(void); 00183 00191 void reconfigureNodeHook(int level); 00192 00193 }; 00194 00195 #endif