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_odom_alg_node_h_ 00026 #define _kinton_odom_alg_node_h_ 00027 00028 #include <iri_base_algorithm/iri_base_algorithm.h> 00029 #include "kinton_odom_alg.h" 00030 00031 #include <Eigen/Dense> 00032 00033 #include <tf/transform_listener.h> 00034 00035 // [publisher subscriber headers] 00036 #include <sensor_msgs/Imu.h> 00037 #include <mav_msgs/Height.h> 00038 #include <geometry_msgs/PointStamped.h> 00039 00040 // [service client headers] 00041 00042 // [action server client headers] 00043 00048 class KintonOdomAlgNode : public algorithm_base::IriBaseAlgorithm<KintonOdomAlgorithm> 00049 { 00050 private: 00051 // [publisher attributes] 00052 ros::Publisher imu_publisher_; 00053 sensor_msgs::Imu Imu_msg_; 00054 00055 ros::Publisher height_publisher_; 00056 geometry_msgs::PointStamped Height_msg_; 00057 00058 // [subscriber attributes] 00059 ros::Subscriber imu_subscriber_; 00060 void imu_callback(const sensor_msgs::Imu::ConstPtr& msg); 00061 CMutex imu_mutex_; 00062 00063 ros::Subscriber height_subscriber_; 00064 void height_callback(const mav_msgs::Height::ConstPtr& msg); 00065 CMutex height_mutex_; 00066 00067 // [service attributes] 00068 00069 // [client attributes] 00070 00071 // [action server attributes] 00072 00073 // [action client attributes] 00074 00075 //Fixed transforms between frames 00076 Eigen::Matrix4d T_acc_, T_gyr_, T_comp_; 00077 00078 public: 00085 KintonOdomAlgNode(void); 00086 00093 ~KintonOdomAlgNode(void); 00094 00095 protected: 00096 00109 void mainNodeThread(void); 00110 00123 void node_config_update(Config &config, uint32_t level); 00124 00131 void addNodeDiagnostics(void); 00132 00133 // [diagnostic functions] 00134 00135 // [test functions] 00136 00142 Eigen::Matrix4d getTransform(const tf::StampedTransform& transform); 00143 00144 }; 00145 00146 #endif