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