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 _darwin_odom_twist_alg_node_h_ 00026 #define _darwin_odom_twist_alg_node_h_ 00027 00028 #include <iri_base_algorithm/iri_base_algorithm.h> 00029 #include "darwin_odom_twist_alg.h" 00030 00031 #include <geometry_msgs/PoseWithCovariance.h> 00032 #include <geometry_msgs/TwistWithCovariance.h> 00033 #include <geometry_msgs/Transform.h> 00034 00035 #include <tf/transform_broadcaster.h> 00036 00037 // [publisher subscriber headers] 00038 #include <geometry_msgs/Twist.h> 00039 #include <nav_msgs/Odometry.h> 00040 00041 // [service client headers] 00042 00043 // [action server client headers] 00044 00049 class DarwinOdomTwistAlgNode : public algorithm_base::IriBaseAlgorithm<DarwinOdomTwistAlgorithm> 00050 { 00051 private: 00052 // [publisher attributes] 00053 ros::Publisher odom_publisher_; 00054 nav_msgs::Odometry Odometry_msg_; 00055 00056 // [subscriber attributes] 00057 ros::Subscriber input_twist_subscriber_; 00058 void input_twist_callback(const geometry_msgs::Twist::ConstPtr& msg); 00059 CMutex input_twist_mutex_; 00060 00061 // [service attributes] 00062 00063 // [client attributes] 00064 00065 // [action server attributes] 00066 00067 // [action client attributes] 00068 00069 bool is_first_msg_; 00070 ros::Time last_time_; 00071 double yaw_angle; 00072 00073 // odometry variables 00074 geometry_msgs::PoseWithCovariance pose_; 00075 geometry_msgs::TwistWithCovariance twist_; 00076 geometry_msgs::Transform transform_; 00077 00078 // parameter variables 00079 std::string tf_prefix_; 00080 std::string odom_id_; 00081 std::string base_link_id_; 00082 bool publish_tf_; 00083 00084 public: 00091 DarwinOdomTwistAlgNode(void); 00092 00099 ~DarwinOdomTwistAlgNode(void); 00100 00101 protected: 00102 tf::TransformBroadcaster odom_broadcaster_; 00103 00116 void mainNodeThread(void); 00117 00130 void node_config_update(Config &config, uint32_t level); 00131 00138 void addNodeDiagnostics(void); 00139 00140 // [diagnostic functions] 00141 00142 // [test functions] 00143 }; 00144 00145 #endif