Description
Hey,
I tried connecting two Xbox Kinect v2s using processing and the OpenKinect library.
I installed two Transcend USB 3.0 Expansion cards (one on a PCI-E 1x and one on a PCI-E 16x).
I used an example sketch that uses two Kinect v2s:
/*
Thomas Sanchez Lengeling
http://codigogenerativo.com/
How to use multiple Kinects v2 in the same sketch.
Should work up n number of Kinects v2 connected to the USB 3.0 port.
https://github.com/shiffman/OpenKinect-for-Processing
http://shiffman.net/p5/kinect/
*/
import org.openkinect.processing.*;
Kinect2 kinect2a;
Kinect2 kinect2b;
void setup() {
size(1536, 848, P2D);
kinect2a = new Kinect2(this);
kinect2a.initDepth();
kinect2a.initVideo();
kinect2a.initIR();
kinect2b = new Kinect2(this);
kinect2b.initDepth();
kinect2b.initVideo();
kinect2b.initIR();
//Start tracking each kinect
kinect2a.initDevice(0); //index 0
kinect2b.initDevice(1); //index 1
background(0);
}
void draw() {
background(0);
image(kinect2a.getDepthImage(), 0, 0);
image(kinect2a.getIrImage(), 512, 0);
image(kinect2a.getVideoImage(), 512*2, 0, 512, 424);
image(kinect2b.getDepthImage(), 0, 424);
image(kinect2b.getIrImage(), 512, 424);
image(kinect2b.getVideoImage(), 512*2, 424, 512, 424);
}
When both Kinects are on the same PCI expansion card I get the following in console:
The sketch has been automatically resized to fit the screen resolution
64 windows
Init Kinect2
[Freenect2Impl] enumerating devices...
[Freenect2Impl] 15 usb devices connected
[Freenect2Impl] found valid Kinect v2 @4:7 with serial 000619550747
[Freenect2Impl] found valid Kinect v2 @4:4 with serial 000430750747
[Freenect2Impl] found 2 devices
2 Device Connected!
Init Kinect2
[Freenect2Impl] enumerating devices...
[Freenect2Impl] 15 usb devices connected
[Freenect2Impl] found valid Kinect v2 @4:7 with serial 000619550747
[Freenect2Impl] found valid Kinect v2 @4:4 with serial 000430750747
[Freenect2Impl] found 2 devices
2 Device Connected!
[OpenCLDepthPacketProcessor::listDevice] devices:
0: Caicos (GPU)[Advanced Micro Devices, Inc.]
1: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz (CPU)[GenuineIntel]
2: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz (CPU)[Intel(R) Corporation]
[OpenCLDepthPacketProcessor::init] selected device: Caicos (GPU)[Advanced Micro Devices, Inc.]
Devce: 0
[Freenect2Impl] enumerating devices...
[Freenect2Impl] 15 usb devices connected
[Freenect2Impl] found valid Kinect v2 @4:7 with serial 000619550747
[Freenect2Impl] found valid Kinect v2 @4:4 with serial 000430750747
[Freenect2Impl] found 2 devices
[Freenect2DeviceImpl] opening...
[Freenect2DeviceImpl] opened
Enable Kinect 2 Video
Enable Kinect 2 IR
Enable Kinect 2 Depth
[Freenect2DeviceImpl] starting...
[Freenect2DeviceImpl] ReadData0x14 response
92 bytes of raw data
0x0000: 00 00 15 00 00 00 00 00 01 00 00 00 43 c1 1f 41 2e2e2e2e2e2e2e2e2e2e2e2e432e2e41
0x0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e
0x0020: 0a 21 33 55 c2 00 17 20 00 08 00 00 10 00 00 00 2e2133552e2e2e202e2e2e2e2e2e2e2e
0x0030: 00 01 00 00 00 10 00 00 00 00 80 00 01 00 00 00 2e2e2e2e2e2e2e2e2e2e802e2e2e2e2e
0x0040: 31 33 00 00 00 03 09 03 47 4d 46 31 35 32 2e 31 31332e2e2e2e2e2e474d463135322e31
0x0050: 58 00 00 00 00 00 00 00 07 00 00 00 582e2e2e2e2e2e2e2e2e2e2e
[Freenect2DeviceImpl] ReadStatus0x090000 response
4 bytes of raw data
0x0000: 7f 26 00 00 7f262e2e
[Freenect2DeviceImpl] ReadStatus0x090000 response
4 bytes of raw data
0x0000: 7f 26 00 00 7f262e2e
[Freenect2DeviceImpl] enabling usb transfer submission...
[Freenect2DeviceImpl] submitting usb transfers...
[Freenect2DeviceImpl] started
Device Serial: 000619550747
Device Firmware: 4.3.3913.0.7
[RgbPacketStreamParser::onDataReceived] packetsize or sequence doesn't match!
[OpenCLDepthPacketProcessor::listDevice] devices:
0: Caicos (GPU)[Advanced Micro Devices, Inc.]
1: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz (CPU)[GenuineIntel]
2: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz (CPU)[Intel(R) Corporation]
[OpenCLDepthPacketProcessor::init] selected device: Caicos (GPU)[Advanced Micro Devices, Inc.]
Devce: 1
[Freenect2Impl] enumerating devices...
[Freenect2Impl] 15 usb devices connected
[Freenect2Impl] found valid Kinect v2 @4:7 with serial 000619550747
[Freenect2Impl] found valid Kinect v2 @4:4 with serial 000430750747
[Freenect2Impl] found 2 devices
[Freenect2DeviceImpl] opening...
[Freenect2DeviceImpl] opened
Enable Kinect 2 Video
Enable Kinect 2 IR
Enable Kinect 2 Depth
[Freenect2DeviceImpl] starting...
[DepthPacketStreamParser::onDataReceived] not all subsequences received 0
[Freenect2DeviceImpl] ReadData0x14 response
92 bytes of raw data
0x0000: 00 00 15 00 00 00 00 00 01 00 00 00 43 c1 1f 41 2e2e2e2e2e2e2e2e2e2e2e2e432e2e41
0x0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e
0x0020: 0a 21 33 55 c2 00 17 20 00 08 00 00 10 00 00 00 2e2133552e2e2e202e2e2e2e2e2e2e2e
0x0030: 00 01 00 00 00 10 00 00 00 00 80 00 01 00 00 00 2e2e2e2e2e2e2e2e2e2e802e2e2e2e2e
0x0040: 31 33 00 00 00 02 05 0e 47 4d 46 31 32 38 2e 31 31332e2e2e2e2e2e474d463132382e31
0x0050: 58 00 00 00 00 00 00 00 07 00 00 00 582e2e2e2e2e2e2e2e2e2e2e
[Freenect2DeviceImpl] ReadStatus0x090000 response
4 bytes of raw data
0x0000: 7f 26 00 00 7f262e2e
[DepthPacketStreamParser::onDataReceived] not all subsequences received 1022
[UsbControl::setIrInterfaceState] failed! libusb error -1: LIBUSB_ERROR_IO
[Freenect2DeviceImpl] ReadStatus0x090000 response
4 bytes of raw data
0x0000: 7f 26 00 00 7f262e2e
[Freenect2DeviceImpl] enabling usb transfer submission...
[Freenect2DeviceImpl] submitting usb transfers...
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[Freenect2DeviceImpl] started
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
Device Serial: 000430750747
Device Firmware: 4.3.3913.0.7
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[TransferPool::submit] failed to submit transfer: LIBUSB_ERROR_NOT_FOUND
[DepthPacketStreamParser::onDataReceived] not all subsequences received 1021
[RgbPacketStreamParser::onDataReceived] packetsize or sequence doesn't match!
[DepthPacketStreamParser::onDataReceived] not all subsequences received 512
[DepthPacketStreamParser::onDataReceived] not all subsequences received 1015
I came to the conclusion this was related to memory. I tried to put one of the Xbox Kinects into the other PCI Expansion Card USB 3.0 slot and that actually ended up working fine!
So I was wondering, is there a way I can change a line of code somewhere that will allow me to use two kinects on the same PCI bus? I've seen another issue that changed the /etc/default/grub file, also related to memory. However, I cannot seem to find this file anywhere. Where is this supposed to be located?
Another suggestion I found in the troubleshooting page
Multiple Kinects
Try to use less but larger transfers with the environment variables:
LIBFREENECT2_RGB_TRANSFER_SIZE=1048576 (default 0x4000)
LIBFREENECT2_RGB_TRANSFERS=3 (default 20)
LIBFREENECT2_IR_PACKETS=128 (or 64, default 8)
LIBFREENECT2_IR_TRANSFERS=4 (or 8, default 60)
Where can I find these environment variables?
Thanks in advance!