roboticslab-uc3m / vision

Vision processing
https://robots.uc3m.es/vision/
11 stars 7 forks source link

Drop old OpenNI2 interfaces, adopt IRGBDSensor #83

Closed PeterBowman closed 6 years ago

PeterBowman commented 6 years ago

YARP devel has discontinued support for several devices, affecting Kinect/OpenNI2 devices currently used in this repo. This means that the yarp/dev/IOpenNI2DeviceDriver.h header (as well as yarp/dev/IKinectDeviceDriver.h, by the way) is no longer installed: YARP v3.0.0 Release Notes (unreleased).

There is a replacement, though. Client apps must switch to the yarp::dev::RGBDSensorClient device and the yarp::dev::IRGBDSensor interface, which should be barely invasive on our end (the vision repo). Real camera devices are now wrapped by yarp::dev::depthCameraDriver (goes by the .ini name of depthCamera).

jgvictores commented 6 years ago

Yes, this is definitively something we'll have to cope with. No libs for now, just a couple of programs. Transition should not be difficult.

PeterBowman commented 6 years ago

Raising priority. According to https://github.com/robotology/yarp/projects/6, we should solve this before 2018-05-12.

PeterBowman commented 6 years ago

WIP at 0099fd1, testing on Kinect v1 and v2, compiles at latest YARP devel (CI build). Problem: YARP throws a Trying to allocate an invalid pixel type image and makes the program quit (ref) upon calling IRGBDSensor::getImages.

jgvictores commented 6 years ago

I'd add a colorFrame.setPixelCode(VOCAB_PIXEL_RGB); immediately after https://github.com/roboticslab-uc3m/vision/blob/0099fd11d24a0ee8adf4c95c94d6c6059b9d2b42/programs/colorRegionDetection/SegmentorThread.cpp#L143

jgvictores commented 6 years ago

((did some similar stuff around https://github.com/roboticslab-uc3m/openrave-yarp-plugins/commit/f72ff821f102cd562242b2864e5a301e231a4094#diff-203b1994e1821fea53f07aea4e9df0eb))

PeterBowman commented 6 years ago

Did that, didn't help.

Edit: I'll try the copy thing, although it looks like a suboptimal solution.

PeterBowman commented 6 years ago

Fixed by applying a small delay prior to starting the segmentor thread: https://github.com/roboticslab-uc3m/vision/commit/0417b4055d7ae7c4e1db702189955f0f1465ab92. Unfortunately, IRGBDSensor::getSensorStatus is of no help here, it keeps returning RGBD_SENSOR_OK_IN_USE even if the first frames have invalid pixel codes.

This might deserve an upstream issue regarding the somewhat draconian std::exit call, which was introduced back in 2006.

jgvictores commented 6 years ago

I'd also look into why status is returning OK. It's probably referring to the yarp connection status, but it should definitely check if correctly formed frames are available.

PeterBowman commented 6 years ago

It's probably referring to the yarp connection status

Nope, it's strictly bound to the device layer, not to the network wrapper. All it does is check device and stream readiness for publishing data (even if malformed): ref.

jgvictores commented 6 years ago

Hack 0417b4055d7ae7c4e1db702189955f0f1465ab92 is pretty ugly/dangerous. Could we add an upstream label here?

PeterBowman commented 6 years ago

Addendum: review and update .ini files across robot repos (<robot>-configuration-files).

PeterBowman commented 6 years ago

Also: review WIP branches (e.g. ROSInputTopics) per https://github.com/roboticslab-uc3m/vision/issues/70#issuecomment-383098270.

PeterBowman commented 6 years ago

Note: installation of depthCamera is broken at YARP 2.3.72 (and probably at 2.3.70.x, too). Did work at 2.3.68.x, fixed upstream at 2.3.72.1 (unreleased, see https://github.com/robotology/yarp/pull/1633). Workaround: do cmake . -DYARP_HAS_OpenNI2=ON and configure again.

jgvictores commented 6 years ago

Note: installation of depthCamera is broken at YARP 2.3.72 (and probably at 2.3.70.x, too). Did work at 2.3.68.x, fixed upstream at 2.3.72.1 (unreleased, see robotology/yarp#1633). Workaround: do cmake . -DYARP_HAS_OpenNI2=ON and configure again.

Added comment at https://github.com/roboticslab-uc3m/installation-guides/commit/b355edbf73964cc045e79e1a22673e000404c0ff.