OpenKinect / libfreenect2

Open source drivers for the Kinect for Windows v2 device
2.08k stars 751 forks source link

Failed to work with Jetson TX2 & CUDA 9.0 #1011

Open MarsTechHAN opened 6 years ago

MarsTechHAN commented 6 years ago

Overview Description: Libfreenect2 failed to work on Jetson TX2 with CUDA enabled. (I tried with TX@ before but with UCDA 8.0, so I believe it might be problem with the CUDA)

OpenCL and CPU mode works fine.

Version, Platform, and Hardware Bug Found:

  1. ae39a6d Update FindTegraJPEG.cmake (#999)
  2. Linux 4.4.38+ #1 SMP PREEMPT Mon May 28 11:32:22 CST 2018 aarch64 aarch64 aarch64 GNU/Linux
  3. /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-tegra/3p, 5000M
    |__ Port 2: Dev 3, If 0, Class=Vendor Specific Class, Driver=, 5000M
    |__ Port 2: Dev 3, If 1, Class=Vendor Specific Class, Driver=, 5000M
    |__ Port 2: Dev 3, If 2, Class=Audio, Driver=snd-usb-audio, 5000M
    |__ Port 2: Dev 3, If 3, Class=Audio, Driver=snd-usb-audio, 5000M
    |__ Port 3: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
    /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-tegra/4p, 480M
    |__ Port 3: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 2: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 2: Dev 4, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
  4. (Nothing Shows here)
  5. CUDA Version
    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2017 NVIDIA Corporation
    Built on Sun_Nov_19_03:16:56_CST_2017
    Cuda compilation tools, release 9.0, V9.0.252

Steps to Reproduce:

  1. Run Protonect at Jetson TX2 platform at CUDA 9.0

Actual Results:

./build/bin/Protonect cuda
Version: 0.2.0
Environment variables: LOGFILE=<protonect.log>
Usage: ./build/bin/Protonect [-gpu=<id>] [gl | cl | clkde | cuda | cudakde | cpu] [<device serial>]
        [-noviewer] [-norgb | -nodepth] [-help] [-version]
        [-frames <number of frames to process>]
To pause and unpause: pkill -USR1 Protonect
[Info] [CudaDepthPacketProcessorImpl] device 0: NVIDIA Tegra X2 @ 1300MHz Memory 7845MB
[Info] [CudaDepthPacketProcessorImpl] selected device 0
[Error] [CudaDepthPacketProcessorImpl] cudaGetLastError(): unknown error
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 7 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @2:3 with serial 003215364647
[Info] [Freenect2Impl] found 1 devices
[Info] [Freenect2DeviceImpl] opening...
[Info] [Freenect2DeviceImpl] transfer pool sizes rgb: 20*16384 ir: 60*8*33792
[Info] [Freenect2DeviceImpl] opened
[Info] [Freenect2DeviceImpl] starting...
^C^C^C^C^C^C[Debug] [Freenect2DeviceImpl] status 0x090000: 9839
[Debug] [Freenect2DeviceImpl] status 0x090000: 9839
[Info] [Freenect2DeviceImpl] submitting rgb transfers...
[Info] [RgbPacketStreamParser] packetsize or sequence doesn't match!
[Info] [Freenect2DeviceImpl] submitting depth transfers...
[Error] [DepthPacketStreamParser] Packet buffer is NULL
[Error] [DepthPacketStreamParser] Packet buffer is NULL
[Error] [DepthPacketStreamParser] Packet buffer is NULL
[Error] [DepthPacketStreamParser] Packet buffer is NULL

Expected Results:

./build/bin/Protonect cl
Version: 0.2.0
Environment variables: LOGFILE=<protonect.log>
Usage: ./build/bin/Protonect [-gpu=<id>] [gl | cl | clkde | cuda | cudakde | cpu] [<device serial>]
        [-noviewer] [-norgb | -nodepth] [-help] [-version]
        [-frames <number of frames to process>]
To pause and unpause: pkill -USR1 Protonect
OpenCL pipeline is not supported!
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 7 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @2:3 with serial 003215364647
[Info] [Freenect2Impl] found 1 devices
[Info] [Freenect2DeviceImpl] opening...
[Info] [Freenect2DeviceImpl] transfer pool sizes rgb: 20*16384 ir: 60*8*33792
[Info] [Freenect2DeviceImpl] opened
[Info] [Freenect2DeviceImpl] starting...
[Debug] [Freenect2DeviceImpl] status 0x090000: 9741
[Debug] [Freenect2DeviceImpl] status 0x090000: 9743
[Info] [Freenect2DeviceImpl] submitting rgb transfers...
[Info] [Freenect2DeviceImpl] submitting depth transfers...
[Debug] [DepthPacketStreamParser] not all subsequences received 0
[Info] [Freenect2DeviceImpl] started
device serial: 003215364647
device firmware: 2.3.3913.0
[Debug] [DepthPacketStreamParser] not all subsequences received 960
[Debug] [DepthPacketStreamParser] skipping depth packet
[Debug] [RgbPacketStreamParser] skipping rgb packet!
[Debug] [DepthPacketStreamParser] skipping depth packet
[Debug] [RgbPacketStreamParser] skipping rgb packet!
[Debug] [RgbPacketStreamParser] skipping rgb packet!
[Debug] [RgbPacketStreamParser] skipping rgb packet!
[Debug] [RgbPacketStreamParser] skipping rgb packet!
[Debug] [RgbPacketStreamParser] skipping rgb packet!
[Debug] [RgbPacketStreamParser] skipping rgb packet!
[Info] [DepthPacketStreamParser] 2 packets were lost
[Debug] [RgbPacketStreamParser] skipping rgb packet!
[Debug] [RgbPacketStreamParser] skipping rgb packet!
[Debug] [RgbPacketStreamParser] skipping rgb packet!
[Debug] [RgbPacketStreamParser] skipping rgb packet!
^C[Info] [Freenect2DeviceImpl] stopping...
[Info] [Freenect2DeviceImpl] canceling rgb transfers...
[Info] [Freenect2DeviceImpl] canceling depth transfers...
[Debug] [DepthPacketStreamParser] subpacket too large
[Info] [Freenect2DeviceImpl] stopped
[Info] [Freenect2DeviceImpl] closing...
[Info] [Freenect2DeviceImpl] releasing usb interfaces...
[Info] [Freenect2DeviceImpl] deallocating usb transfer pools...
[Info] [Freenect2DeviceImpl] closing usb device...
[Info] [Freenect2DeviceImpl] closed
[Info] [Freenect2DeviceImpl] closing...
[Info] [Freenect2DeviceImpl] already closed, doing nothing 

Reproducibility: Every time run with CUDA 9.0 Additional Information: N/A

xlz commented 6 years ago

This looks like a pure USB problem.

MarsTechHAN commented 6 years ago

But if I switch to use other mode, like OpenCL or pure CPU, It works just fine. (Like I showed on the Expected Results part.)

xlz commented 6 years ago

OK, I spotted the error: [Error] [CudaDepthPacketProcessorImpl] cudaGetLastError(): unknown error.

If you have gdb you can trace this error to a line of code where it happened.

xlz commented 6 years ago

Actually, the above isn't going to find the problem for you. I'm just saying it's possible to pinpoint the problem location by debugging.

kunalchelani commented 6 years ago

@MarsTechHAN, I am getting the same error when trying to use Logger2 with Kinect v2. Were you able to solve the issue when trying to use the GPU ? I can't seem to change the mode to OpenCL or CPU here

leviresende commented 5 years ago

Hey guys! I'm using the JETSON TX 2 with the following configuration: L4T 28.2.1 [ JetPack 3.3 or 3.2.1 ] Board: t186ref Ubuntu 16.04.6 LTS Kernel Version: 4.4.38-tegra CUDA 9.0.252

And I'd like to connect it with a Kinect v2, however, I didn't have success. I've done everything that I read on the forums here, on NVIDIA and on JetsonHacks, even tried to install as Kinect v1, but nothing. After all, I saw that it's not possible to connect a default board (TX2) with this device. Is it true?

By the way, which camera is it better to develop SLAM applications? ZED?

Thanks in advance.