Multiple rgbd cameras using OpenNI2Grabber

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple rgbd cameras using OpenNI2Grabber

Malin
This post has NOT been accepted by the mailing list yet.
Hi all,

I've been using PCL for some time, but only recently we tried to connect two Asus Xtion cameras into our system. The problem I encountered is that PCL has problems we correctly starting the device via USB . I can easily get both devices URI, but the OpenNI2Grabber, according to its description in constructor, doesn't parse bus address. In the code we can read that it only checks for string starting with '#' and than parses the number which follows (important note: device number needs to start from 1 not 0, as later they are decrement by 1).
OpenNI2Grabber.cpp: https://github.com/PointCloudLibrary/pcl/blob/master/io/src/openni2_grabber.cpp line 312 'setupDevice'.
Now in the constructor of OpenNI2Device class shows that it should be possible to instantiate the class using URI, but it seems to lack callbacks for point clouds.

My question is: what, in your opinion, is the best approach in my case. Is it possible to bypass OpenNI2Grabber? Or should I wait for a fix that will allow starting RGBD cameras using URI? I can try to do the change on my own and rebuild whole PCL, but the system needs to work reliably on multiple machines and making any tweak adds more complexity.

Maybe there is some simply solution to my problem, which I can't easily find.

Many thanks in advance,
Mateusz
Reply | Threaded
Open this post in threaded view
|

Re: Multiple rgbd cameras using OpenNI2Grabber

Malin
I realise, that I'm actually writing about two separate things. One is being able to attach multiple cameras, the other is to be able to initialise camera using URI. With only index it is not straight-forward to know which camera will be added under which index.

I thought that I will share some debug output:

1425387170.4932 xtion my id: #1
1425387170.8867 xtion my uri: 1d27/0601@1/15
1425387171.8173 xtion Hello World!

1425387171.8134 xtion2 my id: #2
1425387171.8177 xtion2 Error when initialising xtion2. Reason: void pcl::io::OpenNI2Grabber::setupDevice(const string&, const pcl::io::OpenNI2Grabber::Mode&, const pcl::io::OpenNI2Grabber::Mode&) in /build/buildd/pcl-1.7-1.7.2/io/src/openni2_grabber.cpp @ 340 : No matching device found. pcl::io::openni2::OpenNI2Device::OpenNI2Device(const string&) @ /build/buildd/pcl-1.7-1.7.2/io/src/openni2/openni2_device.cpp @ 75 : Initialize failed
        Could not open "1d27/0601@2/3": Failed to open the USB device!

Maybe it's not a PCL-related problem? If I try multiple time by unplugging and plugging camera back, sometimes they do work together, but it is difficult to reproduce. More often one of them just fail to initialise throwing output as pasted above.

Many thanks,
Mateusz
Reply | Threaded
Open this post in threaded view
|

Re: Multiple rgbd cameras using OpenNI2Grabber

kwaegel
Administrator
In theory, you should be able to add this check to openni2_grabber.cpp, around line 331:

else if ( !device_id.empty() )
{
    device_ = deviceManager->getDevice(device_id);
}

and use deviceManager->getConnectedDeviceURIs() to enumerate the correct URI strings to pass in.