ViSP  2.8.0
vpServolens.h
1 /****************************************************************************
2  *
3  * $Id: vpServolens.h 4056 2013-01-05 13:04:42Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Interface for the Servolens lens attached to the camera fixed on the
36  * Afma4 robot.
37  *
38  * Authors:
39  * Fabien Spindler
40  *
41  *****************************************************************************/
42 
43 #ifndef __vpServolens_h
44 #define __vpServolens_h
45 
46 #include <visp/vpConfig.h>
47 
48 #if defined(UNIX)
49 
59 #include <visp/vpCameraParameters.h>
60 #include <visp/vpImage.h>
61 
95 class VISP_EXPORT vpServolens
96 {
97  public:
98  typedef enum {
99  ZOOM = 1,
100  FOCUS= 2,
101  IRIS = 3
102  } vpServoType;
103  typedef enum {
104  ZOOM_MAX = 10000, // Valeur maxi zoom (mm/100)
105  ZOOM_MIN = 1000, // Valeur mini zoom (mm/100)
106  FOCUS_MAX = 1500, // Valeur maxi focus (metres/100)
107  FOCUS_MIN = 100, // Valeur mini focus (metres/100)
108  IRIS_MAX = 1000, // Valeur maxi diaph (ouverture/100)
109  IRIS_MIN = 160 // Valeur mini disph (ouverture/100)
110  } vpLimitsType;
111  typedef enum {
112  AUTO = 1,
113  CONTROLLED = 2,
114  RELEASED = 3
115  } vpControllerType;
116 
117  vpServolens();
118  vpServolens(const char *port);
119  ~vpServolens();
120 
121  void open(const char *port="/dev/ttyS0");
122  void close();
123  void reset();
124 
125  void setController(vpControllerType controller);
126  void setAutoIris(bool enable);
127  void setPosition(vpServoType servo, unsigned int position);
128  bool getPosition(vpServoType servo, unsigned int &position);
129  vpCameraParameters getCameraParameters(vpImage<unsigned char> &I);
130 
131  void enablePrompt(bool active);
132 
133  private:
134 
135  void init();
136 
137  void enableCmdComplete(vpServoType servo, bool active);
138 
139  char wait();
140  void wait(vpServoType servo);
141 
142  bool read(char *c, long timeout_s);
143  void write(const char *s);
144 
145  bool clean(const char *in, char *out);
146 
147  int remfd; // file pointer of the host's tty
148  bool isinit;
149 };
150 
151 /*
152  * Local variables:
153  * c-basic-offset: 2
154  * End:
155  */
156 #endif
157 #endif
158 
Interface for the Servolens lens attached to the camera fixed on the Afma4 robot. ...
Definition: vpServolens.h:95
Generic class defining intrinsic camera parameters.