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 _artag_pose_based_vs_alg_node_h_ 00026 #define _artag_pose_based_vs_alg_node_h_ 00027 00028 #include <iri_base_algorithm/iri_base_algorithm.h> 00029 #include "artag_pose_based_vs_alg.h" 00030 00031 // [publisher subscriber headers] 00032 #include <geometry_msgs/TwistWithCovariance.h> 00033 #include <ar_pose/ARMarkers.h> 00034 00035 // [service client headers] 00036 00037 // [action server client headers] 00038 00043 class ArtagPoseBasedVsAlgNode : public algorithm_base::IriBaseAlgorithm<ArtagPoseBasedVsAlgorithm> 00044 { 00045 private: 00046 // [publisher attributes] 00047 ros::Publisher cmd_vel_cov_publisher_; 00048 geometry_msgs::TwistWithCovariance TwistWC_msg_; 00049 ros::Publisher target_artag_publisher_; 00050 ar_pose::ARMarkers target_artag_msg_; 00051 00052 // [subscriber attributes] 00053 ros::Subscriber input_ARtag_subscriber_; 00054 void input_ARtag_callback(const ar_pose::ARMarkers::ConstPtr& msg); 00055 CMutex input_ARtag_mutex_; 00056 00057 Eigen::MatrixXd cam_vel_; //Camera velocities. 00058 00059 ros::Time time_,time_last_; //Time variables. 00060 double dt_; // Time diferential. 00061 00062 ArtagPoseBasedVsAlgorithm pose_based_vs_alg_; 00063 00064 Eigen::MatrixXd desired_pose_; // Desired camera position. 00065 Eigen::MatrixXd current_pose_; // Current camera position. 00066 Eigen::MatrixXd kp_, kd_, ki_; // PID parameters. 00067 double i_lim_; // Integration limits (+ and -). 00068 00069 bool init_; // To initialize time counters 00070 00071 double fixed_to_id_; //Anchored to this ID 00072 00073 geometry_msgs::Pose pose_; //tag pose 00074 00075 00076 // [service attributes] 00077 00078 // [client attributes] 00079 00080 // [action server attributes] 00081 00082 // [action client attributes] 00083 00084 public: 00091 ArtagPoseBasedVsAlgNode(void); 00092 00099 ~ArtagPoseBasedVsAlgNode(void); 00100 00101 protected: 00114 void mainNodeThread(void); 00115 00121 void get_marker_info(const ar_pose::ARMarkers::ConstPtr& msg); 00122 00135 void node_config_update(Config &config, uint32_t level); 00136 00143 void addNodeDiagnostics(void); 00144 00145 // [diagnostic functions] 00146 00147 // [test functions] 00148 }; 00149 00150 #endif