Kinect 2 libfreenect2 HW acceleration - full performance obtained

xlz,
Your code works with both the native USB port and the mPCIe USB card. I’ve tested using two different Jetsons, and two different USB 3.0 hubs. Here’s what I have learned:

  1. The mPCIe card does not appear to have any issues, and seems to work reliably. If the Kinect V2 is plugged into the card’s port when the system boots, it works properly. The Kinect can also be hot plugged into the card’s port and it works properly.

  2. The native USB 3.0 port works, but seems less reliable and requires a few extra steps.

Notes: The term ‘hub’ refers to an external, powered, USB 3.0 7 port hub. I am using a USB 3.0 hub with a keyboard and mouse also plugged into it, along with the Kinect. Before running Protonect each time, I checked the auto suspend state to make sure everything was -1. Replug means to unplug the device, wait a few seconds, and then plug it back in. Protonect is an example program which displays the RGB, infrared and depth camera streams.

FAILURE:
If the Jetson is booted with the hub and Kinect plugged into the hub, when Protonect is executed, it fails. Protonect gets to the point where it prints out ‘device firmware: 4.3.3912.0.7’ and gets deadlocked in waitForNewFrame. No windows appear., but the [TegraJpegRgbPacketProcessor] heartbeat message appears.The [CudaDepthPacketProcessor] heartbeat does NOT appear .

Subsequent attempts to run Protonect also fail. Protonect fails after it prints out the 92 bytes of raw data and then:

[CommandTransaction::receive] bulk transfer failed! libusb error -1: LIBUSB_ERROR_IO
Segmentation fault

This happens in the case where the Kinect remains in place, the case where the Kinect is replugged, and the case where the hub is replugged.

SUCCESS:
A) Boot the Jetson with the USB hub connected. Do not run Protonect.
B) Once the Jetson boots, replug the hub.
C) Turn off auto suspend
D) Run Protonect.

This brings up the program as expected.

The Kinect can be plugged into the hub at boot time, or after the replug. I did have issues in the case where the Jetson booted without the Kinect in the hub, unplug the hub, plug the Kinect into the hub, plug the hub back into the Jetson. In that case, the keyboard and mouse failed to be recognized. That could be a hub issue.

I played with the different combinations for several hours. The boot, replug the hub solution worked consistently, though there were times that replugging did not show the Kinect using “$ lsusb -t” and required replugging the hub once again.

The dmesg logs appeared the same when Protonect was running correctly, and when it was first loaded in the failure case. The second failure case was slightly different, it only contained the first 4 lines of the successful one. I’m assuming that’s at the point where the segmentation fault happens.

Since the L4T kernel lags behind the mainstream Linux one, it’s possible that the above issue has been addressed. At this point, my curiosity has been more than satisfied, and I’m going to rate Kinect V2 support as working if still experimental. With the addition of xlz’s tegra code, it is also at the point of being usable.

I plugged Kinect 2 straight into the Jetson, with no hub.

I can confirm this. But I don’t have any idea of why.

I’ve also seen how Intel USB 3 controllers became from not working in earlier kernels to working with kernel 3.16. So I expect improvement with later L4T releases, or when Jetson gets totally upstreamed.

Hey, how did you manage to achive 60 fps with depth data from kinectV2 if it only provides a 30 fps from any sensor?