YARP
Yet Another Robot Platform
IRGBDSensor.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 #ifndef YARP_DEV_IRGBDSENSOR_H
10 #define YARP_DEV_IRGBDSENSOR_H
11 
12 #include <yarp/os/Vocab.h>
13 #include <yarp/os/Stamp.h>
14 #include <yarp/os/Property.h>
15 #include <yarp/sig/Image.h>
16 #include <yarp/sig/Matrix.h>
17 #include <yarp/dev/api.h>
18 #include <yarp/dev/IVisualParams.h>
19 
20 
21 // Interface name
24 
25 // Methods
32 
33 
34 namespace yarp {
35 namespace dev {
36 
54  public IRgbVisualParams,
55  public IDepthVisualParams
56 {
57 public:
58 
59  // We should distinguish between rgb and depth sensors, which one is working
60  // and which one isn't. Maybe a specific function with two separated values is better.
61  // Here values are referred to the sensor as a whole.
63  {
64  RGBD_SENSOR_NOT_READY = 0,
65  RGBD_SENSOR_OK_STANBY = 1,
66  RGBD_SENSOR_OK_IN_USE = 2,
67  RGB_SENSOR_ERROR = 3,
68  DEPTH_SENSOR_ERROR = 4,
69  RGBD_SENSOR_GENERIC_ERROR = 5,
70  RGBD_SENSOR_TIMEOUT = 6
71  };
72 
73  virtual ~IRGBDSensor();
74 
75  /*
76  * IRgbVisualParams interface. Look at IVisualParams.h for documentation
77  */
78  int getRgbHeight() override = 0;
79  int getRgbWidth() override = 0;
80  bool getRgbSupportedConfigurations(yarp::sig::VectorOf<CameraConfig> &configurations) override { return false;};
81  bool getRgbResolution(int &width, int &height) override { return false;};
82  bool setRgbResolution(int width, int height) override = 0;
83  bool getRgbFOV(double &horizontalFov, double &verticalFov) override = 0;
84  bool setRgbFOV(double horizontalFov, double verticalFov) override = 0;
85  bool getRgbIntrinsicParam(yarp::os::Property &intrinsic) override = 0;
86 
87  /*
88  * IDepthVisualParams interface. Look at IVisualParams.h for documentation
89  */
90  int getDepthHeight() override = 0;
91  int getDepthWidth() override = 0;
92  bool setDepthResolution(int width, int height) override = 0;
93  bool getDepthFOV(double &horizontalFov, double &verticalFov) override = 0;
94  bool setDepthFOV(double horizontalFov, double verticalFov) override = 0;
95  double getDepthAccuracy() override = 0;
96  bool setDepthAccuracy(double accuracy) override = 0;
97  bool getDepthClipPlanes(double &nearPlane, double &farPlane) override = 0;
98  bool setDepthClipPlanes(double nearPlane, double farPlane) override = 0;
99  bool getDepthIntrinsicParam(yarp::os::Property &intrinsic) override = 0;
100 
101  /*
102  * IRGBDSensor specific interface methods
103  */
104 
111  virtual bool getExtrinsicParam(yarp::sig::Matrix &extrinsic) = 0;
112 
118  virtual std::string getLastErrorMsg(yarp::os::Stamp *timeStamp = NULL) = 0;
119 
132  virtual bool getRgbImage(yarp::sig::FlexImage &rgbImage, yarp::os::Stamp *timeStamp = NULL) = 0;
133 
142 
154  virtual bool getImages(yarp::sig::FlexImage &colorFrame, yarp::sig::ImageOf<yarp::sig::PixelFloat> &depthFrame, yarp::os::Stamp *colorStamp=NULL, yarp::os::Stamp *depthStamp=NULL) = 0;
155 
163 };
164 
165 } // namespace dev
166 } // namespace yarp
167 
168 #endif // YARP_DEV_IRGBDSENSOR_H
yarp::dev::IRGBDSensor::setDepthAccuracy
bool setDepthAccuracy(double accuracy) override=0
Set the minimum detectable variation in distance [meter] when possible.
yarp::dev::IRGBDSensor::getRgbHeight
int getRgbHeight() override=0
Return the height of each frame.
yarp::dev::IRGBDSensor::setDepthFOV
bool setDepthFOV(double horizontalFov, double verticalFov) override=0
Set the field of view (FOV) of the depth camera.
yarp::os::createVocab
constexpr yarp::conf::vocab32_t createVocab(char a, char b=0, char c=0, char d=0)
Definition: Vocab.h:22
yarp::dev::IRGBDSensor::getDepthImage
virtual bool getDepthImage(yarp::sig::ImageOf< yarp::sig::PixelFloat > &depthImage, yarp::os::Stamp *timeStamp=NULL)=0
Get the depth frame from the device.
yarp::dev::IRGBDSensor::getExtrinsicParam
virtual bool getExtrinsicParam(yarp::sig::Matrix &extrinsic)=0
Get the extrinsic parameters from the device.
yarp::dev::IRGBDSensor::setRgbResolution
bool setRgbResolution(int width, int height) override=0
Set the resolution of the rgb image from the camera.
yarp::dev::IRGBDSensor::~IRGBDSensor
virtual ~IRGBDSensor()
VOCAB_RGBD_PROTOCOL_VERSION
constexpr yarp::conf::vocab32_t VOCAB_RGBD_PROTOCOL_VERSION
Definition: IRGBDSensor.h:23
yarp::dev::IRGBDSensor::getDepthAccuracy
double getDepthAccuracy() override=0
Get the minimum detectable variation in distance [meter].
VOCAB_STATUS
constexpr yarp::conf::vocab32_t VOCAB_STATUS
Definition: IRGBDSensor.h:31
yarp::dev::IRGBDSensor::getDepthFOV
bool getDepthFOV(double &horizontalFov, double &verticalFov) override=0
Get the field of view (FOV) of the depth camera.
VOCAB_RGBD_SENSOR
constexpr yarp::conf::vocab32_t VOCAB_RGBD_SENSOR
Definition: IRGBDSensor.h:22
Matrix.h
contains the definition of a Matrix type
yarp::dev::IRGBDSensor::RGBDSensor_status
RGBDSensor_status
Definition: IRGBDSensor.h:63
yarp::dev::IRGBDSensor::getDepthIntrinsicParam
bool getDepthIntrinsicParam(yarp::os::Property &intrinsic) override=0
Get the intrinsic parameters of the depth camera.
yarp::sig::ImageOf< yarp::sig::PixelFloat >
yarp::dev::IRGBDSensor::getRgbResolution
bool getRgbResolution(int &width, int &height) override
Get the resolution of the rgb image from the camera.
Definition: IRGBDSensor.h:81
VOCAB_ERROR_MSG
constexpr yarp::conf::vocab32_t VOCAB_ERROR_MSG
Definition: IRGBDSensor.h:27
yarp::sig::VectorOf
Provides:
Definition: Vector.h:122
yarp::dev::IRGBDSensor::getDepthClipPlanes
bool getDepthClipPlanes(double &nearPlane, double &farPlane) override=0
Get the clipping planes of the sensor.
yarp::dev::IRGBDSensor::setDepthClipPlanes
bool setDepthClipPlanes(double nearPlane, double farPlane) override=0
Set the clipping planes of the sensor.
yarp::dev::IRGBDSensor::getRgbImage
virtual bool getRgbImage(yarp::sig::FlexImage &rgbImage, yarp::os::Stamp *timeStamp=NULL)=0
Get the rgb frame from the device.
Property.h
yarp::sig::FlexImage
Image class with user control of representation details.
Definition: Image.h:403
yarp::dev::IRGBDSensor::getDepthHeight
int getDepthHeight() override=0
Return the height of each frame.
Stamp.h
yarp::dev::IRGBDSensor
A generic interface for cameras that have both color camera as well as depth camera sensor,...
Definition: IRGBDSensor.h:56
yarp::dev::IRGBDSensor::getRgbIntrinsicParam
bool getRgbIntrinsicParam(yarp::os::Property &intrinsic) override=0
Get the intrinsic parameters of the rgb camera.
YARP_dev_API
#define YARP_dev_API
Definition: api.h:19
yarp::dev::IRGBDSensor::setDepthResolution
bool setDepthResolution(int width, int height) override=0
Set the resolution of the depth image from the camera.
Image.h
yarp::dev::IRGBDSensor::setRgbFOV
bool setRgbFOV(double horizontalFov, double verticalFov) override=0
Set the field of view (FOV) of the rgb camera.
yarp::dev::IRGBDSensor::getImages
virtual bool getImages(yarp::sig::FlexImage &colorFrame, yarp::sig::ImageOf< yarp::sig::PixelFloat > &depthFrame, yarp::os::Stamp *colorStamp=NULL, yarp::os::Stamp *depthStamp=NULL)=0
Get the both the color and depth frame in a single call.
yarp::os::Stamp
An abstraction for a time stamp and/or sequence number.
Definition: Stamp.h:25
yarp::dev::IRGBDSensor::getDepthWidth
int getDepthWidth() override=0
Return the height of each frame.
VOCAB_IMAGES
constexpr yarp::conf::vocab32_t VOCAB_IMAGES
Definition: IRGBDSensor.h:30
yarp::dev::IRgbVisualParams
An interface for retrieving intrinsic parameter from a rgb camera.
Definition: IVisualParams.h:73
yarp::dev::IRGBDSensor::getRgbSupportedConfigurations
bool getRgbSupportedConfigurations(yarp::sig::VectorOf< CameraConfig > &configurations) override
Get the possible configurations of the camera.
Definition: IRGBDSensor.h:80
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::conf::vocab32_t
std::int32_t vocab32_t
Definition: numeric.h:52
Vocab.h
VOCAB_RGB_IMAGE
constexpr yarp::conf::vocab32_t VOCAB_RGB_IMAGE
Definition: IRGBDSensor.h:28
yarp::dev::IRGBDSensor::getLastErrorMsg
virtual std::string getLastErrorMsg(yarp::os::Stamp *timeStamp=NULL)=0
Return an error message in case of error.
yarp::dev::IRGBDSensor::getRgbWidth
int getRgbWidth() override=0
Return the width of each frame.
IVisualParams.h
yarp::dev::IRGBDSensor::getSensorStatus
virtual RGBDSensor_status getSensorStatus()=0
Get the surrent status of the sensor, using enum type.
yarp::dev::IDepthVisualParams
An interface for retrieving intrinsic parameter from a depth camera.
Definition: IVisualParams.h:183
VOCAB_EXTRINSIC_PARAM
constexpr yarp::conf::vocab32_t VOCAB_EXTRINSIC_PARAM
Definition: IRGBDSensor.h:26
api.h
yarp::dev::IRGBDSensor::getRgbFOV
bool getRgbFOV(double &horizontalFov, double &verticalFov) override=0
Get the field of view (FOV) of the rgb camera.
yarp::os::Property
A class for storing options and configuration information.
Definition: Property.h:37
yarp::sig::Matrix
A class for a Matrix.
Definition: Matrix.h:46
VOCAB_DEPTH_IMAGE
constexpr yarp::conf::vocab32_t VOCAB_DEPTH_IMAGE
Definition: IRGBDSensor.h:29