yarp-devices
AravisGigE.hpp
1 #ifndef __ARAVIS_GIGE_HPP__
2 #define __ARAVIS_GIGE_HPP__
3 
4 #include <map>
5 
6 #include <yarp/dev/DeviceDriver.h>
7 #include <yarp/dev/IFrameGrabberControls.h>
8 #include <yarp/dev/IFrameGrabberImage.h>
9 
10 #include <arv.h>
11 
12 namespace roboticslab
13 {
14 
25 class AravisGigE : public yarp::dev::DeviceDriver,
26  public yarp::dev::IFrameGrabberImageRaw,
27  public yarp::dev::IFrameGrabberControls
28 {
29 public:
30 
31  ~AravisGigE() override { close(); }
32 
33  // --------- DeviceDriver Declarations. Implementation in DeviceDriverImpl.cpp ---------
34  bool open(yarp::os::Searchable& config) override;
35  bool close() override;
36 
37  // --------- IFrameGrabberImageRaw Declarations. Implementation in IFrameGrabberImageRawImpl.cpp ---------
38  bool getImage(yarp::sig::ImageOf<yarp::sig::PixelMono>& image) override;
39  int height() const override;
40  int width() const override;
41 
42  // ---------- IFrameGrabberControls Declarations. Implementation in IFrameGrabberControlsImpl.cpp ---------
43  bool getCameraDescription(CameraDescriptor *camera) override;
44  bool hasFeature(int feature, bool *hasFeature) override;
45  bool setFeature(int feature, double value) override;
46  bool getFeature(int feature, double *value) override;
47  bool setFeature(int feature, double value1, double value2) override;
48  bool getFeature(int feature, double *value1, double *value2) override;
49  bool hasOnOff(int feature, bool *HasOnOff) override;
50  bool setActive(int feature, bool onoff) override;
51  bool getActive(int feature, bool *isActive) override;
52  bool hasAuto(int feature, bool *hasAuto) override;
53  bool hasManual(int feature, bool *hasManual) override;
54  bool hasOnePush(int feature, bool *hasOnePush) override;
55  bool setMode(int feature, FeatureMode mode) override;
56  bool getMode(int feature, FeatureMode *mode) override;
57  bool setOnePush(int feature) override;
58 
59 private:
60  ArvCamera *camera; // Camera to control.
61  ArvStream *stream; // Object for video stream reception.
62  void *framebuffer; //
63 
64  unsigned int payload; // Width x height x Pixel width.
65 
66  int widthMin; // Camera sensor minium width.
67  int widthMax; // Camera sensor maximum width.
68  int heightMin; // Camera sensor minium height.
69  int heightMax; // Camera sensor maximum height.
70  bool fpsAvailable;
71  double fpsMin; // Camera minium fps.
72  double fpsMax; // Camera maximum fps.
73  bool gainAvailable;
74  double gainMin; // Camera minimum gain.
75  double gainMax; // Camera maximum gain.
76  bool exposureAvailable;
77  double exposureMin; // Camera's minimum exposure time.
78  double exposureMax; // Camera's maximum exposure time.
79 
80  bool controlExposure; // Flag if automatic exposure shall be done by this SW
81  bool autoGain;
82  double targetGrey; // Target grey value (mid grey))
83 
84  gint64 *pixelFormats;
85  guint pixelFormatsCnt;
86 
87 
88  int num_buffers; // number of payload transmission buffers
89 
90  ArvPixelFormat pixelFormat; // pixel format
91 
92  int xoffset; // current frame region x offset
93  int yoffset; // current frame region y offset
94  int _width; // current frame width of frame
95  int _height; // current frame height of image
96 
97  double fps; // current value of fps
98  double exposure; // current value of exposure time
99  double gain; // current value of gain
100  double midGrey; // current value of mid grey (brightness)
101 
102  unsigned frameID; // current frame id
103  unsigned prevFrameID;
104 
105  //-- Lens Controls
106  bool zoomAvailable;
107  gint64 zoomMin; // Camera zoom minimum value
108  gint64 zoomMax; // Camera zoom maximum value
109  bool focusAvailable;
110  gint64 focusMin; // Camera focus minimum value
111  gint64 focusMax; // Camera focus maximum value
112  bool irisAvailable;
113  gint64 irisMin; // Camera iris minimum value
114  gint64 irisMax; // Camera iris maximum value
115 
116  //-- IFrameGrabberControls2
117  std::map<cameraFeature_id_t, const char*> yarp_arv_int_feature_map; //-- Map yarp features with aravis feature ids
118  std::map<cameraFeature_id_t, const char*> yarp_arv_float_feat_map;
119 };
120 
121 }
122 
123 #endif // __ARAVIS_GIGE_HPP__
Implementation for GigE cameras using Aravis as driver.
Definition: AravisGigE.hpp:28
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:6