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 _firewire_camera_driver_nodelet_h_ 00026 #define _firewire_camera_driver_nodelet_h_ 00027 00028 #include "nodelet/nodelet.h" 00029 00030 #include <iri_base_driver/iri_base_driver_node.h> 00031 #include "firewire_camera_driver.h" 00032 00033 // diagnostic headers 00034 #include "diagnostic_updater/diagnostic_updater.h" 00035 #include "diagnostic_updater/publisher.h" 00036 00037 // image transport 00038 #include "image_transport/image_transport.h" 00039 #include <camera_info_manager/camera_info_manager.h> 00040 00041 // [publisher subscriber headers] 00042 #include <sensor_msgs/Image.h> 00043 00044 // [service client headers] 00045 00046 // [action server client headers] 00047 00048 #include "eventserver.h" 00049 #include "threadserver.h" 00050 00068 class FirewireCameraDriverNode : public iri_base_driver::IriBaseNodeDriver<FirewireCameraDriver> 00069 { 00070 private: 00071 // [publisher attributes] 00072 camera_info_manager::CameraInfoManager camera_manager; 00073 boost::shared_ptr<image_transport::ImageTransport> it; 00074 sensor_msgs::ImagePtr Image_msg_;// this pointer is already a shared_ptr 00075 image_transport::CameraPublisher camera_image_publisher_; 00076 diagnostic_updater::HeaderlessTopicDiagnostic *diagnosed_camera_image; 00077 00078 // [subscriber attributes] 00079 00080 // [service attributes] 00081 00082 // [client attributes] 00083 00084 // [action server attributes] 00085 00086 // [action client attributes] 00087 00088 // node attributes 00089 double desired_framerate; 00090 CEventServer *event_server; 00091 std::string new_frame_event; 00092 std::string tf_prefix_; 00093 00101 void postNodeOpenHook(void); 00102 00103 public: 00121 FirewireCameraDriverNode(ros::NodeHandle& nh); 00122 00129 ~FirewireCameraDriverNode(); 00130 00131 protected: 00144 void mainNodeThread(void); 00145 00146 // [diagnostic functions] 00147 void check_configuration(diagnostic_updater::DiagnosticStatusWrapper &stat); 00148 00159 void addNodeDiagnostics(void); 00160 00161 // [driver test functions] 00162 00172 void addNodeOpenedTests(void); 00173 00183 void addNodeStoppedTests(void); 00184 00194 void addNodeRunningTests(void); 00195 00203 void reconfigureNodeHook(int level); 00204 00205 }; 00206 00207 class FirewireCameraNodelet : public nodelet::Nodelet 00208 { 00209 private: 00210 virtual void onInit();// initialization function 00211 FirewireCameraDriverNode *dev; 00212 // thread attributes 00213 CThreadServer *thread_server; 00214 std::string spin_thread_id; 00215 protected: 00216 static void *spin_thread(void *param); 00217 public: 00218 FirewireCameraNodelet(); 00219 ~FirewireCameraNodelet(); 00220 }; 00221 00222 #endif