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 _compass_odom_alg_node_h_ 00026 #define _compass_odom_alg_node_h_ 00027 00028 #include <iri_base_algorithm/iri_base_algorithm.h> 00029 #include "compass_odom_alg.h" 00030 #include <tf/transform_datatypes.h> 00031 #include <tf/transform_broadcaster.h> 00032 00033 // [publisher subscriber headers] 00034 #include <nav_msgs/Odometry.h> 00035 #include <iri_common_drivers_msgs/compass3axis.h> 00036 #include <sensor_msgs/Imu.h> 00037 00038 #include "eventserver.h" 00039 #include "eventexceptions.h" 00040 00041 // [service client headers] 00042 00043 // [action server client headers] 00044 00049 class CompassOdomAlgNode : public algorithm_base::IriBaseAlgorithm<CompassOdomAlgorithm> 00050 { 00051 private: 00052 // [publisher attributes] 00053 ros::Publisher compass_odom_publisher_; 00054 nav_msgs::Odometry Odometry_msg_; 00055 geometry_msgs::TransformStamped Transform_msg_; 00056 ros::Publisher compass_imu_publisher_; 00057 sensor_msgs::Imu Imu_msg_; 00058 bool publish_imu_; 00059 00060 // [subscriber attributes] 00061 ros::Subscriber compass_subscriber_; 00062 void compass_callback(const iri_common_drivers_msgs::compass3axis & msg); 00063 CMutex compass_mutex_; 00064 00065 // event attributes 00066 CEventServer *ES; 00067 std::string TCM3_IN; 00068 std::list<std::string> SUBS_LIST; 00069 bool compass_arrived_; 00070 std::string parent_id_; 00071 bool publish_tf_; 00072 00073 // [service attributes] 00074 00075 // [client attributes] 00076 00077 // [action server attributes] 00078 00079 // [action client attributes] 00080 00081 public: 00088 CompassOdomAlgNode(void); 00089 00096 ~CompassOdomAlgNode(void); 00097 00098 protected: 00099 00106 tf::TransformBroadcaster compass_odom_broadcaster_; 00107 00120 void mainNodeThread(void); 00121 00134 void node_config_update(Config &config, uint32_t level); 00135 00142 void addNodeDiagnostics(void); 00143 00144 // [diagnostic functions] 00145 00146 // [test functions] 00147 }; 00148 00149 #endif