Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * swissranger.h - SwissRanger SR4000 Camera 00004 * 00005 * Created: Wed Jan 13 17:04:51 2010 00006 * Copyright 2005-2010 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #ifndef __FIREVISION_CAMS_SWISSRANGER_H_ 00025 #define __FIREVISION_CAMS_SWISSRANGER_H_ 00026 00027 #include <cams/camera.h> 00028 #include <cams/control/focus.h> 00029 00030 // libmesasr header defining basic types and enums 00031 #include <definesSR.h> 00032 00033 namespace firevision { 00034 #if 0 /* just to make Emacs auto-indent happy */ 00035 } 00036 #endif 00037 00038 class CameraArgumentParser; 00039 00040 class SwissRangerCamera 00041 : public Camera 00042 { 00043 public: 00044 /** Operation mode of the camera. */ 00045 typedef enum { 00046 DISTANCE, /**< raw distance image, unsigned short distance values */ 00047 DISTANCE_GRAY_8, /**< gray distance image, plain gray 8bpp buffer */ 00048 AMPLITUDE, /**< raw amplitude image, unsigned short values */ 00049 AMPLITUDE_GRAY, /**< amplitude gray image, 16bpp */ 00050 AMPLITUDE_GRAY_8, /**< amplitude gray image, 8bpp */ 00051 CONF_MAP, /**< confidence map, 16bpp*/ 00052 CARTESIAN_UINT16, /**< Cartesian coordinates, three consecutive planes for 00053 * X, Y, Z data, each with unsigned short values (mm) */ 00054 CARTESIAN_FLOAT, /**< Cartesian coordinates, three consecutive planes for 00055 * X, Y, Z data, each with float values (meters) */ 00056 CARTESIAN_DOUBLE /**< Cartesian coordinates, three consecutive planes for 00057 * X, Y, Z data, each with double values (meters) */ 00058 } mode_t; 00059 00060 SwissRangerCamera(const CameraArgumentParser *cap); 00061 virtual ~SwissRangerCamera(); 00062 00063 virtual void open(); 00064 virtual void start(); 00065 virtual void stop(); 00066 virtual void close(); 00067 virtual void flush(); 00068 virtual void capture(); 00069 00070 virtual void print_info(); 00071 virtual bool ready(); 00072 00073 virtual unsigned char* buffer(); 00074 virtual unsigned int buffer_size(); 00075 virtual void dispose_buffer(); 00076 00077 virtual unsigned int pixel_width(); 00078 virtual unsigned int pixel_height(); 00079 virtual colorspace_t colorspace(); 00080 00081 virtual void set_image_number(unsigned int n); 00082 00083 virtual const char * model() const; 00084 00085 static void print_available_cams(); 00086 00087 protected: 00088 /** true if camera has been opened, false otherwise */ 00089 bool _opened; 00090 /** true if camera has been started, false otherwise */ 00091 bool _started; 00092 /** true, if a valid frame has been received, false otherwise */ 00093 bool _valid_frame_received; 00094 00095 private: 00096 SRCAM __cam; 00097 00098 /** Camera model, used in open to identify the camera, 00099 * if empty first found camera is used */ 00100 char *__model; 00101 char *__vendor; 00102 unsigned int __vendor_id; 00103 unsigned int __product_id; 00104 unsigned int __serial; 00105 00106 mode_t __mode; 00107 bool __set_modfreq; 00108 bool __use_median; 00109 bool __use_denoise; 00110 unsigned int __integration_time; 00111 unsigned int __amplitude_threshold; 00112 00113 ModulationFrq __modulation_freq; 00114 00115 unsigned int __width; 00116 unsigned int __height; 00117 00118 size_t __buffer_size; 00119 unsigned char *__buffer; 00120 unsigned char *__gray_buffer; 00121 void *__coord_uint16_buf; 00122 float *__coord_float_buf; 00123 double *__coord_double_buf; 00124 00125 short *__xu; 00126 short *__yu; 00127 unsigned short *__zu; 00128 00129 float *__xf; 00130 float *__yf; 00131 float *__zf; 00132 00133 double *__xd; 00134 double *__yd; 00135 double *__zd; 00136 00137 }; 00138 00139 } // end namespace firevision 00140 00141 #endif