openrave-yarp-plugins
YarpOpenraveRGBDSensor.hpp
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 #ifndef __YARP_OPENRAVE_RGBDSENSOR_HPP__
4 #define __YARP_OPENRAVE_RGBDSENSOR_HPP__
5 
6 #include <yarp/dev/DeviceDriver.h>
7 #include <yarp/dev/IRGBDSensor.h>
8 
9 #include <openrave/openrave.h>
10 
11 #include <boost/smart_ptr/shared_ptr.hpp>
12 
13 #include "YarpOpenraveBase.hpp"
14 
15 namespace roboticslab
16 {
17 
31  public yarp::dev::DeviceDriver,
32  public yarp::dev::IRGBDSensor
33 {
34 public:
35  YarpOpenraveRGBDSensor() : rgb(true), rgbReady(false), depthReady(false) {}
36 
37  // ------- DeviceDriver declarations. Implementation in DeviceDriverImageImpl.cpp -------
38  bool open(yarp::os::Searchable& config) override;
39  bool close() override;
40 
41  // ------- IRGBDSensor declarations. Implementation in IRGBDSensorImpl.cpp -------
42  // IRgbVisualParams interface. Look at IVisualParams.h for documentation
43  int getRgbHeight() override { return 0; }
44  int getRgbWidth() override { return 0; }
45  bool getRgbSupportedConfigurations(yarp::sig::VectorOf<yarp::dev::CameraConfig> &configurations) override { return false; }
46  bool getRgbResolution(int &width, int &height) override { return false; }
47  bool setRgbResolution(int width, int height) override { return false; }
48  bool getRgbFOV(double &horizontalFov, double &verticalFov) override { return false; }
49  bool setRgbFOV(double horizontalFov, double verticalFov) override { return false; }
50  bool getRgbIntrinsicParam(yarp::os::Property &intrinsic) override { return false; }
51  bool getRgbMirroring(bool &mirror) override { return false; }
52  bool setRgbMirroring(bool mirror) override { return false; }
53 
54  // IDepthVisualParams interface. Look at IVisualParams.h for documentation
55  int getDepthHeight() override;
56  int getDepthWidth() override;
57  bool setDepthResolution(int width, int height) override;
58  bool getDepthFOV(double &horizontalFov, double &verticalFov) override { return false; }
59  bool setDepthFOV(double horizontalFov, double verticalFov) override { return false; }
60  double getDepthAccuracy() override { return 0.0; }
61  bool setDepthAccuracy(double accuracy) override { return false; }
62  bool getDepthClipPlanes(double &nearPlane, double &farPlane) override { return false; }
63  bool setDepthClipPlanes(double nearPlane, double farPlane) override { return false; }
64  bool getDepthIntrinsicParam(yarp::os::Property &intrinsic) override { return false; }
65  bool getDepthMirroring(bool &mirror) override { return false; }
66  bool setDepthMirroring(bool mirror) override { return false; }
67 
68  // IRGBDSensor specific interface methods
69  bool getExtrinsicParam(yarp::sig::Matrix &extrinsic) override { return false; }
70  std::string getLastErrorMsg(yarp::os::Stamp *timeStamp = NULL) override { return ""; }
71  bool getRgbImage(yarp::sig::FlexImage &rgbImage, yarp::os::Stamp *timeStamp = NULL) override;
72  bool getDepthImage(yarp::sig::ImageOf<yarp::sig::PixelFloat> &depthImage, yarp::os::Stamp *timeStamp = NULL) override;
73  bool getImages(yarp::sig::FlexImage &colorFrame, yarp::sig::ImageOf<yarp::sig::PixelFloat> &depthFrame, yarp::os::Stamp *colorStamp=NULL, yarp::os::Stamp *depthStamp=NULL) override;
74  RGBDSensor_status getSensorStatus() override;
75 
76 private:
77  // General RGBDSensor parameters
78  int rgbHeight, rgbWidth, depthHeight, depthWidth;
79  bool rgb;
80  bool rgbReady;
81  bool depthReady;
82 
83  // OpenRAVE
84  OpenRAVE::SensorBasePtr depthSensorBasePtr;
85  OpenRAVE::SensorBasePtr rgbSensorBasePtr;
86  boost::shared_ptr<OpenRAVE::SensorBase::LaserSensorData> depthSensorDataPtr;
87  boost::shared_ptr<OpenRAVE::SensorBase::CameraSensorData> rgbSensorDataPtr;
88 };
89 
90 } // namespace roboticslab
91 
92 #endif // __YARP_OPENRAVE_RGBDSENSOR_HPP__
Implements shared configuration functions.
Definition: YarpOpenraveBase.hpp:32
Implements the YARP_dev IRGBDSensor, etc. interface class member functions.
Definition: YarpOpenraveRGBDSensor.hpp:33
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:5