Fawkes API Fawkes Development Version
nao.h
1
2/***************************************************************************
3 * nao.h - V4L2 camera with Nao specific extensions
4 *
5 * Created: Sun Feb 01 13:56:23 2009
6 * Copyright 2008 Tobias Kellner
7 * 2009 Tim Niemueller [www.niemueller.de]
8 *
9 ****************************************************************************/
10
11/* This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version. A runtime exception applies to
15 * this software (see LICENSE.GPL_WRE file mentioned below for details).
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Library General Public License for more details.
21 *
22 * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
23 */
24
25#ifndef _FIREVISION_CAMS_NAO_H_
26#define _FIREVISION_CAMS_NAO_H_
27
28#include <core/exceptions/software.h>
29#include <fvcams/control/source.h>
30#include <fvcams/v4l2.h>
31
32#include <unistd.h>
33
34#define DSPIC_I2C_ADDR 0x8
35#define DSPIC_SWITCH_REG 220
36#define I2C_SLAVE 0x0703
37
38namespace firevision {
39
40class CameraArgumentParser;
41
43{
44public:
46 virtual ~NaoCamera();
47
48 virtual unsigned char source();
49 virtual void set_source(unsigned char source);
50 virtual bool exposure_auto();
51 virtual void set_exposure_auto(bool enabled);
52
53private:
54 static int open_dev(const char *i2c);
55 static void close_dev(int dev, const char *error = 0);
56 static int get_open_cam_id(int dev);
57 static void switch_to_cam_id(int dev, int cam_id);
58 static void init_cam(const char *cam);
59
60private:
61 char *i2c_device_name_; ///< I2C device file descriptor
62 int cam_id_; ///< ID of the Camera to be used
63 bool can_switch_cam_; ///< Needs to be Nao V3 for camera switching
64};
65
66} // end namespace firevision
67
68#endif //FIREVISION_CAMS_V4L2_H__
Camera argument parser.
Definition: camargp.h:36
Camera source control interface.
Definition: source.h:33
Video4Linux 2 camera with Nao-specific extensions.
Definition: nao.h:43
NaoCamera(const CameraArgumentParser *cap)
Constructor.
Definition: nao.cpp:108
virtual unsigned char source()
Return which cam is currently being used.
Definition: nao.cpp:251
virtual bool exposure_auto()
Return whether auto exposure is enabled.
Definition: nao.cpp:286
virtual void set_source(unsigned char source)
Switch currently used camera.
Definition: nao.cpp:268
virtual void set_exposure_auto(bool enabled)
Enable/disable auto exposure.
Definition: nao.cpp:296
Video4Linux 2 camera access implementation.
Definition: v4l2.h:43