Search code examples
c++linux-device-driveropennipoint-cloud-libraryasus-xtion

How to set a specific device ID on OpenNIGrabber?


how can I set a specific device ID to the constructor of the OpenNIGrabber object?

The tutorial example with OpenNIGrabber("#1") or OpenNIGrabber("#2") works well but I need to select a specific device somehow. Is it possible to choose the device connected to a specific USB port?

I'm using some Xtion PRO. I'm on ubuntu 13.04 64bit.


Solution

  • You can use bus@address ID where bus number and USB port address (device) can be looked up with lsusb command on Linux. This type of device ID works only on non-Windows systems as you can see in PCL sources (https://github.com/PointCloudLibrary/pcl/blob/master/io/src/openni_grabber.cpp#L352-L361, method pcl::OpenNIGrabber::setupDevice, lines 352-361).

    Also you can use ASUS Xtion Pro's serial number as an ID.

    More in PCL documentation: http://docs.pointclouds.org/1.7.2/a00897.html#a5753a422ff92067c9065797697d69244

    Example

    quepas@ubuntu:~$ lsusb
    Bus 001 Device 002: ID 1d27:0601 ASUS 
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    

    Then:

    OpenNIGrabber("1@2")