Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpServolens.h
1/****************************************************************************
2 *
3 * ViSP, open source Visual Servoing Platform software.
4 * Copyright (C) 2005 - 2023 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 https://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*****************************************************************************/
36
37#ifndef _vpServolens_h_
38#define _vpServolens_h_
39
40#include <visp3/core/vpConfig.h>
41
42#if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)))
43
53#include <visp3/core/vpCameraParameters.h>
54#include <visp3/core/vpImage.h>
55
89class VISP_EXPORT vpServolens
90{
91public:
92 typedef enum { ZOOM = 1, FOCUS = 2, IRIS = 3 } vpServoType;
93 typedef enum {
94 ZOOM_MAX = 10000, // Valeur maxi zoom (mm/100)
95 ZOOM_MIN = 1000, // Valeur mini zoom (mm/100)
96 FOCUS_MAX = 1500, // Valeur maxi focus (metres/100)
97 FOCUS_MIN = 100, // Valeur mini focus (metres/100)
98 IRIS_MAX = 1000, // Valeur maxi diaph (ouverture/100)
99 IRIS_MIN = 160 // Valeur mini disph (ouverture/100)
100 } vpLimitsType;
101 typedef enum { AUTO = 1, CONTROLLED = 2, RELEASED = 3 } vpControllerType;
102
103 vpServolens();
104 explicit vpServolens(const char *port);
105 virtual ~vpServolens();
106
107 void open(const char *port = "/dev/ttyS0");
108 void close();
109 void reset() const;
110
111 void setController(vpControllerType controller) const;
112 void setAutoIris(bool enable) const;
113 void setPosition(vpServoType servo, unsigned int position) const;
114 bool getPosition(vpServoType servo, unsigned int &position) const;
115 vpCameraParameters getCameraParameters(vpImage<unsigned char> &I) const;
116
117 void enablePrompt(bool active) const;
118
119private:
120 void init() const;
121
122 char wait() const;
123 void wait(vpServoType servo) const;
124
125 bool read(char *c, long timeout_s) const;
126 void write(const char *s) const;
127
128 bool clean(const char *in, char *out) const;
129
130 int remfd; // file pointer of the host's tty
131 bool isinit;
132};
133
134#endif
135#endif
Generic class defining intrinsic camera parameters.
Definition of the vpImage class member functions.
Definition vpImage.h:135
Interface for the Servolens lens attached to the camera fixed on the Afma4 robot.
Definition vpServolens.h:90