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_kinect_arm_alg_node_h_ 00026 #define _tibi_dabo_kinect_arm_alg_node_h_ 00027 00028 #include <iri_base_algorithm/iri_base_algorithm.h> 00029 #include "tibi_dabo_kinect_arm_alg.h" 00030 00031 // [publisher subscriber headers] 00032 #include <tf/tfMessage.h> 00033 #include <tf/tf.h> 00034 #include <tf/transform_listener.h> 00035 00036 // [service client headers] 00037 #include <kinematics_msgs/GetPositionIK.h> 00038 00039 // [action server client headers] 00040 #include <actionlib/client/simple_action_client.h> 00041 #include <actionlib/client/terminal_state.h> 00042 #include <control_msgs/FollowJointTrajectoryAction.h> 00043 00048 class TibiDaboKinectArmAlgNode : public algorithm_base::IriBaseAlgorithm<TibiDaboKinectArmAlgorithm> 00049 { 00050 private: 00051 00052 //my stuff 00053 char hand_tf[30]; 00054 00055 //kinect variables 00056 tf::TransformListener listener; 00057 tf::StampedTransform echo_transform; 00058 tf::Vector3 v; 00059 00060 //Kinematics variables 00061 float x,y,z,theta1,theta2,theta3,theta4; 00062 00063 //dynamic reconfigure var 00064 std::string arm_id; 00065 bool debug; 00066 bool angle_mode_debug; 00067 double x_debug; 00068 double y_debug; 00069 double z_debug; 00070 double theta1_debug; 00071 double theta2_debug; 00072 double theta3_debug; 00073 double theta4_debug; 00074 00075 00076 // [publisher attributes] 00077 00078 // [subscriber attributes] 00079 ros::Subscriber tf_subscriber_; 00080 void tf_callback(const tf::tfMessage::ConstPtr& msg); 00081 CMutex tf_mutex_; 00082 00083 // [service attributes] 00084 00085 // [client attributes] 00086 ros::ServiceClient GetPositionIK_client_; 00087 kinematics_msgs::GetPositionIK GetPositionIK_srv_; 00088 00089 // [action server attributes] 00090 00091 // [action client attributes] 00092 actionlib::SimpleActionClient<control_msgs::FollowJointTrajectoryAction> FollowJointTrajectory_client_; 00093 control_msgs::FollowJointTrajectoryGoal FollowJointTrajectory_goal_; 00094 void FollowJointTrajectoryMakeActionRequest(); 00095 void FollowJointTrajectoryDone(const actionlib::SimpleClientGoalState& state, const control_msgs::FollowJointTrajectoryResultConstPtr& result); 00096 void FollowJointTrajectoryActive(); 00097 void FollowJointTrajectoryFeedback(const control_msgs::FollowJointTrajectoryFeedbackConstPtr& feedback); 00098 00099 bool joint_motion_done; 00100 00101 00102 public: 00109 TibiDaboKinectArmAlgNode(void); 00110 00117 ~TibiDaboKinectArmAlgNode(void); 00118 00119 protected: 00132 void mainNodeThread(void); 00133 00146 void node_config_update(Config &config, uint32_t level); 00147 00154 void addNodeDiagnostics(void); 00155 00156 // [diagnostic functions] 00157 00158 // [test functions] 00159 }; 00160 00161 #endif