From 698f7e94454babf3e0469b625233474b04725b09 Mon Sep 17 00:00:00 2001 From: Nicolo' Genesio Date: Mon, 24 Sep 2018 13:55:05 +0200 Subject: [PATCH 1/6] realsense2: add documentation for verbose and stereoMode parameters It fixes #1871 --- src/devices/realsense2/realsense2Driver.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/devices/realsense2/realsense2Driver.h b/src/devices/realsense2/realsense2Driver.h index 1956b3434e..eff4cb4876 100644 --- a/src/devices/realsense2/realsense2Driver.h +++ b/src/devices/realsense2/realsense2Driver.h @@ -68,6 +68,8 @@ namespace yarp * Parameters used by this device are: * | Parameter name | SubParameter | Type | Read / write | Units | Default Value | Required | Description | Notes | * |:----------------------------:|:-------------------:|:-------------------:|:---------------:|:--------------:|:-------------:|:--------------------------------:|:--------------------------------------------------------------------------------------:|:---------------------------------------------------------------------:| + * | stereoMode | - | bool | Read / write | | false | No(see notes) | Flag for using the realsense as stereo camera | This option is to use it with yarp::dev::ServerGrabber as network wrapper. The stereo images provided are raw images(yarp::sig::PixelMono) and note that not all the realsense devices have the stereo streams. | + * | verbose | - | bool | Read / write | | false | No | Flag for enabling debug prints | | * | SETTINGS | - | group | Read / write | - | - | Yes | Initial setting of the device. | Properties must be read/writable in order for setting to work | * | | rgbResolution | int, int | Read / write | pixels | - | Yes | Size of rgb image in pixels | 2 values expected as height, width | * | | depthResolution | int, int | Read / write | pixels | - | Yes | Size of depth image in pixels | Values are height, width | @@ -78,7 +80,7 @@ namespace yarp * | HW_DESCRIPTION | - | group | | - | - | Yes | Hardware description of device property. | Read only property. Setting will be disabled | * | | clipPlanes | double, double | Read / write | meters | - | No | Minimum and maximum distance at which an object is seen by the depth sensor | parameter introduced mainly for simulated sensors, it can be used to set the clip planes if Openni gives wrong values | * - * Configuration file using .ini format, using subdevice keyword. + * Configuration file using .ini format, for using as RGBD device: * * \code{.unparsed} @@ -96,6 +98,24 @@ needAlignment true [HW_DESCRIPTION] clipPlanes (0.2 10.0) * + * \endcode + * + * Configuration file using .ini format, for using as stereo camera: + * \code{.unparsed} +device grabberDual +subdevice realsense2 +name /stereoCamera +capabilities RAW +stereoMode true + +[SETTINGS] +rgbResolution (640 480) +depthResolution (640 480) +framerate 30 +enableEmitter false + +[HW_DESCRIPTION] +clipPlanes (0.2 10.0) * \endcode */ From ccbf8407237753743472bcad64cc9cd16d662536 Mon Sep 17 00:00:00 2001 From: Nicolo' Genesio Date: Wed, 26 Sep 2018 11:21:29 +0200 Subject: [PATCH 2/6] YARP_dev: Cleanup + IWYU --- src/libYARP_dev/include/yarp/dev/IVisualParams.h | 1 + src/libYARP_dev/src/FrameGrabberControlImpl.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libYARP_dev/include/yarp/dev/IVisualParams.h b/src/libYARP_dev/include/yarp/dev/IVisualParams.h index e9a6e51403..97f10ae8e6 100644 --- a/src/libYARP_dev/include/yarp/dev/IVisualParams.h +++ b/src/libYARP_dev/include/yarp/dev/IVisualParams.h @@ -9,6 +9,7 @@ #ifndef YARP_DEV_IVISUALPARAMS_H #define YARP_DEV_IVISUALPARAMS_H +#include #include #include #include diff --git a/src/libYARP_dev/src/FrameGrabberControlImpl.cpp b/src/libYARP_dev/src/FrameGrabberControlImpl.cpp index 627882e4b4..2e28b28753 100644 --- a/src/libYARP_dev/src/FrameGrabberControlImpl.cpp +++ b/src/libYARP_dev/src/FrameGrabberControlImpl.cpp @@ -243,7 +243,7 @@ bool FrameGrabberControls_Parser::respond(const yarp::os::Bottle& cmd, yarp::os: if(!fgCtrl) { - yError() << " Selected camera device has no IFrameGrabberControl2 interface"; + yError() << " Selected camera device has no IFrameGrabberControl interface"; return false; } From 3bc7048dee2dedc0c52e186e142674730586c8b6 Mon Sep 17 00:00:00 2001 From: Nicolo' Genesio Date: Wed, 26 Sep 2018 11:22:25 +0200 Subject: [PATCH 3/6] YARP_dev: fix documentation about IDepthVisualParams::get/setDepthAccuracy --- src/libYARP_dev/include/yarp/dev/IVisualParams.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libYARP_dev/include/yarp/dev/IVisualParams.h b/src/libYARP_dev/include/yarp/dev/IVisualParams.h index 97f10ae8e6..6f808fd6fd 100644 --- a/src/libYARP_dev/include/yarp/dev/IVisualParams.h +++ b/src/libYARP_dev/include/yarp/dev/IVisualParams.h @@ -249,14 +249,14 @@ class YARP_dev_API yarp::dev::IDepthVisualParams virtual bool getDepthIntrinsicParam(yarp::os::Property &intrinsic) = 0; /** - * Get the accuracy of the depth measure in [meter] - * @return the accuracy of the sensor in meters. + * Get the minimum detectable variation in distance [meter] + * @return the sensor resolution in meters. */ virtual double getDepthAccuracy() = 0; /** - * Set the accuracy of the depth measure in [meter] when possible - * @param the accuracy of the sensor in meters. + * Set the minimum detectable variation in distance [meter] when possible + * @param the desired resolution in meters. * @return true on success */ virtual bool setDepthAccuracy(double accuracy) = 0; From ad654953cc30a69e69e35e252a6c529a3a3b544a Mon Sep 17 00:00:00 2001 From: Nicolo' Genesio Date: Wed, 26 Sep 2018 11:23:35 +0200 Subject: [PATCH 4/6] RGBDSensorWrapper: make the view of IFrameGrabberControl optional. It fixes #1875 --- .../RGBDSensorWrapper/RGBDSensorWrapper.cpp | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/libYARP_dev/src/devices/RGBDSensorWrapper/RGBDSensorWrapper.cpp b/src/libYARP_dev/src/devices/RGBDSensorWrapper/RGBDSensorWrapper.cpp index 0fece54921..20b9dd5bdb 100644 --- a/src/libYARP_dev/src/devices/RGBDSensorWrapper/RGBDSensorWrapper.cpp +++ b/src/libYARP_dev/src/devices/RGBDSensorWrapper/RGBDSensorWrapper.cpp @@ -385,22 +385,6 @@ bool RGBDSensorWrapper::openAndAttachSubDevice(Searchable& prop) if(!attach(subDeviceOwned)) return false; - if(!rgbdParser.configure(sensor_p) || !rgbdParser.configure(fgCtrl)) - { - yError() << "RGBD wrapper: error configuring interfaces for parsers"; - return false; - } - - /* - bool conf = rgbParser.configure(rgbVis_p); - conf &= depthParser.configure(depthVis_p); - - if(!conf) - { - yError() << "RGBD wrapper: error configuring interfaces for parsers"; - return false; - } - */ return true; } @@ -577,14 +561,14 @@ bool RGBDSensorWrapper::attach(yarp::dev::IRGBDSensor *s) return false; } sensor_p = s; - if(!rgbdParser.configure(sensor_p) ) + if(!rgbdParser.configure(sensor_p)) { yError() << "RGBD wrapper: error configuring interfaces for parsers"; return false; } if (fgCtrl) { - if(!rgbdParser.configure(fgCtrl) ) + if(!rgbdParser.configure(fgCtrl)) { yError() << "RGBD wrapper: error configuring interfaces for parsers"; return false; @@ -609,11 +593,17 @@ bool RGBDSensorWrapper::attach(PolyDriver* poly) return false; } - if(!rgbdParser.configure(sensor_p) || !rgbdParser.configure(fgCtrl)) + if(!rgbdParser.configure(sensor_p)) { - yError() << "RGBD wrapper: error configuring interfaces for parsers"; + yError() << "RGBD wrapper: error configuring IRGBD interface"; return false; } + + if (!rgbdParser.configure(fgCtrl)) + { + yWarning() <<"RGBDWrapper: interface IFrameGrabberControl not implemented by the device"; + } + PeriodicThread::setPeriod(period); return PeriodicThread::start(); } From ff3902297a95889e35f28384de52972dc2a03a3c Mon Sep 17 00:00:00 2001 From: Nicolo' Genesio Date: Wed, 26 Sep 2018 11:24:24 +0200 Subject: [PATCH 5/6] realsense2: fix set/getDepthAccuracy methods. It fixes #1877 --- src/devices/realsense2/realsense2Driver.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/devices/realsense2/realsense2Driver.cpp b/src/devices/realsense2/realsense2Driver.cpp index df85bcb395..464dd13817 100644 --- a/src/devices/realsense2/realsense2Driver.cpp +++ b/src/devices/realsense2/realsense2Driver.cpp @@ -803,7 +803,12 @@ bool realsense2Driver::setDepthFOV(double horizontalFov, double verticalFov) bool realsense2Driver::setDepthAccuracy(double accuracy) { - return setOption(RS2_OPTION_ACCURACY, m_depth_sensor, accuracy);; + std::lock_guard guard(m_mutex); + bool ok = setOption(RS2_OPTION_DEPTH_UNITS, m_depth_sensor, accuracy); + if (ok) { + m_scale = accuracy; + } + return ok; } bool realsense2Driver::getRgbFOV(double &horizontalFov, double &verticalFov) @@ -903,7 +908,7 @@ bool realsense2Driver::getDepthIntrinsicParam(Property& intrinsic) double realsense2Driver::getDepthAccuracy() { float accuracy = 0.0; - if (getOption(RS2_OPTION_ACCURACY, m_depth_sensor, accuracy)) + if (getOption(RS2_OPTION_DEPTH_UNITS, m_depth_sensor, accuracy)) { return accuracy; } From 936667a825f4c0db6a5fa2de83ca76803934d2df Mon Sep 17 00:00:00 2001 From: Nicolo' Genesio Date: Wed, 26 Sep 2018 11:30:48 +0200 Subject: [PATCH 6/6] Update release notes --- doc/release/v3_1_1.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/release/v3_1_1.md b/doc/release/v3_1_1.md index 06a9d0e9a2..8cd09ce52a 100644 --- a/doc/release/v3_1_1.md +++ b/doc/release/v3_1_1.md @@ -22,10 +22,12 @@ Bug Fixes * Fixed `write()` in BufferedPort after interrupting-resuming(#1834). * Fixed assertion when `YARP_FORWARD_LOG_ENABLE=1` (#1851). -#### YARP_dev +#### `YARP_dev` * Fixed `IControlLimits.h` not being a self-sufficient header (#1845). * Added missing `YARP_dev_API` to `IRobotDescription`. +* Made optional the view of `IFrameGrabberControls` in `RGBDSensorWrapper` + (#1875). #### yarpidl_thrift @@ -46,6 +48,11 @@ Bug Fixes * Fixed memory leak when using `cvLoad(...)`. +### Devices + +#### `realsense2` + +* Fixed `set/getDepthAccuracy` methods (#1877). Contributors ------------