Fawkes API  Fawkes Development Version
swissranger.h
1 
2 /***************************************************************************
3  * swissranger.h - SwissRanger SR4000 Camera
4  *
5  * Created: Wed Jan 13 17:04:51 2010
6  * Copyright 2005-2010 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __FIREVISION_CAMS_SWISSRANGER_H_
25 #define __FIREVISION_CAMS_SWISSRANGER_H_
26 
27 #include <fvcams/camera.h>
28 #include <fvcams/control/focus.h>
29 
30 // libmesasr header defining basic types and enums
31 #include <definesSR.h>
32 
33 namespace firevision {
34 #if 0 /* just to make Emacs auto-indent happy */
35 }
36 #endif
37 
38 class CameraArgumentParser;
39 
41 : public Camera
42 {
43  public:
44  /** Operation mode of the camera. */
45  typedef enum {
46  DISTANCE, /**< raw distance image, unsigned short distance values */
47  DISTANCE_GRAY_8, /**< gray distance image, plain gray 8bpp buffer */
48  AMPLITUDE, /**< raw amplitude image, unsigned short values */
49  AMPLITUDE_GRAY, /**< amplitude gray image, 16bpp */
50  AMPLITUDE_GRAY_8, /**< amplitude gray image, 8bpp */
51  CONF_MAP, /**< confidence map, 16bpp*/
52  CARTESIAN_UINT16, /**< Cartesian coordinates, three consecutive planes for
53  * X, Y, Z data, each with unsigned short values (mm) */
54  CARTESIAN_FLOAT, /**< Cartesian coordinates, three consecutive planes for
55  * X, Y, Z data, each with float values (meters) */
56  CARTESIAN_DOUBLE /**< Cartesian coordinates, three consecutive planes for
57  * X, Y, Z data, each with double values (meters) */
58  } mode_t;
59 
61  virtual ~SwissRangerCamera();
62 
63  virtual void open();
64  virtual void start();
65  virtual void stop();
66  virtual void close();
67  virtual void flush();
68  virtual void capture();
69 
70  virtual void print_info();
71  virtual bool ready();
72 
73  virtual unsigned char* buffer();
74  virtual unsigned int buffer_size();
75  virtual void dispose_buffer();
76 
77  virtual unsigned int pixel_width();
78  virtual unsigned int pixel_height();
79  virtual colorspace_t colorspace();
80 
81  virtual void set_image_number(unsigned int n);
82 
83  virtual const char * model() const;
84 
85  static void print_available_cams();
86 
87  protected:
88  /** true if camera has been opened, false otherwise */
89  bool _opened;
90  /** true if camera has been started, false otherwise */
91  bool _started;
92  /** true, if a valid frame has been received, false otherwise */
94 
95  private:
96  SRCAM __cam;
97 
98  /** Camera model, used in open to identify the camera,
99  * if empty first found camera is used */
100  char *__model;
101  char *__vendor;
102  unsigned int __vendor_id;
103  unsigned int __product_id;
104  unsigned int __serial;
105 
106  mode_t __mode;
107  bool __set_modfreq;
108  bool __use_median;
109  bool __use_denoise;
110  unsigned int __integration_time;
111  unsigned int __amplitude_threshold;
112 
113  ModulationFrq __modulation_freq;
114 
115  unsigned int __width;
116  unsigned int __height;
117 
118  size_t __buffer_size;
119  unsigned char *__buffer;
120  unsigned char *__gray_buffer;
121  void *__coord_uint16_buf;
122  float *__coord_float_buf;
123  double *__coord_double_buf;
124 
125  short *__xu;
126  short *__yu;
127  unsigned short *__zu;
128 
129  float *__xf;
130  float *__yf;
131  float *__zf;
132 
133  double *__xd;
134  double *__yd;
135  double *__zd;
136 
137 };
138 
139 } // end namespace firevision
140 
141 #endif
virtual void flush()
Flush image queue.
bool _valid_frame_received
true, if a valid frame has been received, false otherwise
Definition: swissranger.h:93
Camera interface for image aquiring devices in FireVision.
Definition: camera.h:35
bool _started
true if camera has been started, false otherwise
Definition: swissranger.h:91
raw distance image, unsigned short distance values
Definition: swissranger.h:46
virtual unsigned char * buffer()
Get access to current image buffer.
virtual bool ready()
Camera is ready for taking pictures.
virtual ~SwissRangerCamera()
Empty destructor.
Definition: swissranger.cpp:60
SwissRangerCamera(const CameraArgumentParser *cap)
Constructor.
raw amplitude image, unsigned short values
Definition: swissranger.h:48
Camera argument parser.
Definition: camargp.h:38
static void print_available_cams()
Print list of cameras.
virtual unsigned int pixel_width()
Width of image in pixels.
Cartesian coordinates, three consecutive planes for X, Y, Z data, each with double values (meters) ...
Definition: swissranger.h:56
virtual void close()
Close camera.
virtual unsigned int buffer_size()
Size of buffer.
virtual void set_image_number(unsigned int n)
Set image number to retrieve.
virtual const char * model() const
Get camera model.
Cartesian coordinates, three consecutive planes for X, Y, Z data, each with float values (meters) ...
Definition: swissranger.h:54
Cartesian coordinates, three consecutive planes for X, Y, Z data, each with unsigned short values (mm...
Definition: swissranger.h:52
virtual void capture()
Capture an image.
bool _opened
true if camera has been opened, false otherwise
Definition: swissranger.h:89
virtual unsigned int pixel_height()
Height of image in pixels.
virtual colorspace_t colorspace()
Colorspace of returned image.
virtual void stop()
Stop image transfer from the camera.
mode_t
Operation mode of the camera.
Definition: swissranger.h:45
gray distance image, plain gray 8bpp buffer
Definition: swissranger.h:47
virtual void print_info()
Print out camera information.
SwissRanger camera.
Definition: swissranger.h:40
virtual void start()
Start image transfer from the camera.
virtual void open()
Open the camera.
Definition: swissranger.cpp:71
virtual void dispose_buffer()
Dispose current buffer.