zyonz_tof_color_driver_node.h
Go to the documentation of this file.
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 _zyonz_tof_color_driver_node_h_
00026 #define _zyonz_tof_color_driver_node_h_
00027 
00028 #include <iri_base_driver/iri_base_driver_node.h>
00029 #include "zyonz_tof_color_driver.h"
00030 
00031 #include <iostream>
00032 #include <string>
00033 //#include <sstream>
00034 #include <fstream>
00035 
00036 //operacions amb matrius
00037 #include <Eigen/Core>
00038 //#include <Eigen/Array> // Not required anymore
00039 // import most common Eigen types 
00040 using namespace Eigen;
00041 
00042 // [publisher subscriber headers]
00043 #include <sensor_msgs/Image.h>
00044 #include <sensor_msgs/PointCloud2.h>
00045 
00046 // [service client headers]
00047 #include <std_srvs/Empty.h>
00048 
00049 // [action server client headers]
00050 
00068 class ZyonzTofColorDriverNode : public iri_base_driver::IriBaseNodeDriver<ZyonzTofColorDriver>
00069 {
00070   private:
00071     // [publisher attributes]
00072     ros::Publisher cloud2_raw_publisher_;
00073     sensor_msgs::PointCloud2 PointCloud2_msg_;
00074 
00075     // [subscriber attributes]
00076     ros::Subscriber input_intens_subscriber_;
00077     void input_intens_callback(const sensor_msgs::Image::ConstPtr& msg);
00078     CMutex input_intens_mutex_;
00079     ros::Subscriber image_subscriber_;
00080     void image_callback(const sensor_msgs::Image::ConstPtr& msg);
00081     CMutex image_mutex_;
00082     
00083     ros::Subscriber pointCloud_subscriber_;
00084     void pointCloud_callback(const sensor_msgs::PointCloud2::ConstPtr& msg);
00085     CMutex pointCloud_mutex_;
00086 
00087     // [service attributes]
00088     ros::ServiceServer saveImage_server_;
00089     bool saveImageCallback(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res);
00090     CMutex saveImage_mutex_;
00091 
00092     // [client attributes]
00093 
00094     // [action server attributes]
00095 
00096     // [action client attributes]
00097 
00105     void postNodeOpenHook(void);
00106         //matrius de calibratge
00107     Matrix3f K_; 
00108     Matrix4f P_; 
00109     //MatrixXf Z_buffer_;
00110     int kernel_size_; // size of the kernel used to mask the Z_buffer to account for 
00111                       // the different image resolutions     
00115     bool depth_sent_;
00116     bool rgb_sent_;
00117     bool intens_sent_;
00118     
00119     int zbuffer_threshold_;
00120 
00124     bool saveFile; //save the depth file
00125     int saveFileCounter;//save the depth file
00126     std::ofstream outFile;
00127     std::string fileName;
00128 
00129     
00131     sensor_msgs::Image::ConstPtr rgb_image_;
00132     sensor_msgs::Image::ConstPtr intens_image_;
00134     sensor_msgs::PointCloud2::ConstPtr cloud2_;
00138     void processRgbAndDepth();
00139     
00140 
00141   public:
00159     ZyonzTofColorDriverNode(ros::NodeHandle& nh);
00160 
00167     ~ZyonzTofColorDriverNode();
00168 
00169   protected:
00182     void mainNodeThread(void);
00183 
00184     // [diagnostic functions]
00185 
00196     void addNodeDiagnostics(void);
00197 
00198     // [driver test functions]
00199 
00209     void addNodeOpenedTests(void);
00210 
00220     void addNodeStoppedTests(void);
00221 
00231     void addNodeRunningTests(void);
00232 
00240     void reconfigureNodeHook(int level);
00241 
00242 };
00243 
00244 #endif


zyonz_tof_color
Author(s): Guillem AlenyĆ  - IRI Robotics Lab
autogenerated on Fri Dec 6 2013 21:08:56