openrave-yarp-plugins
YarpOpenraveGrabber.hpp
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 #ifndef __YARP_OPENRAVE_GRABBER_HPP__
4 #define __YARP_OPENRAVE_GRABBER_HPP__
5 
6 #include <yarp/dev/DeviceDriver.h>
7 
8 #include <yarp/dev/IFrameGrabberImage.h>
9 #include <yarp/dev/IFrameGrabberControls.h>
10 
11 #include <yarp/dev/IVisualParams.h>
12 
13 #include <openrave/openrave.h>
14 
15 #include <boost/smart_ptr/shared_ptr.hpp>
16 
17 #include "YarpOpenraveBase.hpp"
18 
19 namespace roboticslab
20 {
21 
35  public yarp::dev::DeviceDriver,
36  public yarp::dev::IFrameGrabberControls,
37  public yarp::dev::IFrameGrabberImage,
38  public yarp::dev::IRgbVisualParams
39 {
40 public:
41  // ------- DeviceDriver declarations. Implementation in DeviceDriverImageImpl.cpp -------
42  bool open(yarp::os::Searchable& config) override;
43  bool close() override;
44 
45  // ------- IFrameGrabberControls declarations. Implementation in IFrameGrabberControlsImpl.cpp -------
46  bool getCameraDescription(CameraDescriptor *camera) override;
47  bool hasFeature(int feature, bool *hasFeature) override;
48  bool setFeature(int feature, double value) override;
49  bool getFeature(int feature, double *value) override;
50  bool setFeature(int feature, double value1, double value2) override;
51  bool getFeature(int feature, double *value1, double *value2) override;
52  bool hasOnOff(int feature, bool *HasOnOff) override;
53  bool setActive(int feature, bool onoff) override;
54  bool getActive(int feature, bool *isActive) override;
55  bool hasAuto(int feature, bool *hasAuto) override;
56  bool hasManual(int feature, bool *hasManual) override;
57  bool hasOnePush(int feature, bool *hasOnePush) override;
58  bool setMode(int feature, FeatureMode mode) override;
59  bool getMode(int feature, FeatureMode *mode) override;
60  bool setOnePush(int feature) override;
61 
62  // ------- IFrameGrabberImage declarations. Implementation in IFrameGrabberImageImpl.cpp -------
63  bool getImage(yarp::sig::ImageOf<yarp::sig::PixelRgb>& image) override;
64  int height() const override;
65  int width() const override;
66 
67  // ------- IRgbVisualParams declarations. Look at IVisualParams.h for documentation. Implementation in IFrameGrabberImageImpl.cpp -------
68  int getRgbHeight() override;
69  int getRgbWidth() override;
70  bool getRgbSupportedConfigurations(yarp::sig::VectorOf<yarp::dev::CameraConfig> &configurations) override { return true; }
71  bool getRgbResolution(int &width, int &height) override { return true; }
72  bool setRgbResolution(int width, int height) override { return true; }
73  bool getRgbFOV(double &horizontalFov, double &verticalFov) override { return true; }
74  bool setRgbFOV(double horizontalFov, double verticalFov) override { return true; }
75  bool getRgbIntrinsicParam(yarp::os::Property &intrinsic) override { return true; }
76  bool getRgbMirroring(bool &mirror) override { return true; }
77  bool setRgbMirroring(bool mirror) override { return true; }
78 
79 private:
80  // General Grabber parameters
81  int _height, _width;
82 
83  // OpenRAVE
84  OpenRAVE::SensorBasePtr sensorBasePtr;
85  boost::shared_ptr<OpenRAVE::SensorBase::CameraSensorData> sensorDataPtr;
86  boost::shared_ptr<OpenRAVE::SensorBase::CameraGeomData> modGeomDataPtr;
87 
88  // YARP
89  CameraDescriptor cameraDescriptor;
90 };
91 
92 } // namespace roboticslab
93 
94 #endif // __YARP_OPENRAVE_GRABBER_HPP__
Implements shared configuration functions.
Definition: YarpOpenraveBase.hpp:32
Implements the YARP_dev IFrameGrabberImage, etc. interface class member functions.
Definition: YarpOpenraveGrabber.hpp:39
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:5