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