curiosity-inc / azure-kinect-dk-unity

Azure Kinect C# wrapper compatible both with Sensor SDK and Body Tracking SDK ant Unity sample project using it.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unity2019.2.1 Build pc error

qazqaz12378 opened this issue · comments

The scene in the project can be run, packaged out of the project, can not run, prompt K4A_RESULT_FAILED

k4a.dll
k4abt.dll
onnxruntime.dll
depthengine_1_0.dll
dnn_model.onnx
Where is the packaged file located?
1566371971(1)

Can you try to put all of dll files + onnx to the same directory as your exe file?

hello
error same
I don't know how to get it now.
1566381652(1)
1566381618(1)

Can you check C:\Users\[YourUserName]\AppData\LocalLow\DefaultCompany\azure-kinect-dk-unity\Player.log ? You can see error details in that file.

Mono path[0] = 'C:/Users/Mloong/Desktop/unity/azure-kinect-dk-unity_Data/Managed'
Mono config path = 'C:/Users/Mloong/Desktop/unity/MonoBleedingEdge/etc'
Initialize engine version: 2019.2.1f1 (ca4d5af0be6f)
[XR] Discovering subsystems at path C:/Users/Mloong/Desktop/unity/azure-kinect-dk-unity_Data/UnitySubsystems
GfxDevice: creating device client; threaded=1
Direct3D:
Version: Direct3D 11.0 [level 11.1]
Renderer: NVIDIA GeForce GTX 1080 Ti (ID=0x1b06)
Vendor:
VRAM: 11127 MB
Driver: 26.21.14.3160
Begin MonoManager ReloadAssembly

  • Completed reload, in 0.146 seconds
    Initializing input.

Input initialized.

Initialized touch support.

UnloadTime: 5.479300 ms
AzureKinectException: result = K4A_RESULT_FAILED
at Microsoft.Azure.Kinect.Sensor.AzureKinectException.ThrowIfNotSuccess (Microsoft.Azure.Kinect.Sensor.NativeMethods+k4a_result_t result) [0x00018] in :0
at Microsoft.Azure.Kinect.Sensor.BodyTracking.BodyTracker.Create (Microsoft.Azure.Kinect.Sensor.Calibration sensorCalibration) [0x00008] in :0
at DebugRenderer.OnEnable () [0x0004b] in :0

(Filename: Line: 0)

Scene SampleScene is loaded

(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)

NullReferenceException: Object reference not set to an instance of an object
at DebugRenderer.Update () [0x0000d] in :0

(Filename: Line: 0)

Setting up 6 worker threads for Enlighten.
Thread -> id: be0 -> priority: 1
Thread -> id: 2e84 -> priority: 1
Thread -> id: 253c -> priority: 1
Thread -> id: 5604 -> priority: 1
Thread -> id: 24e0 -> priority: 1
Thread -> id: 2f20 -> priority: 1
NullReferenceException: Object reference not set to an instance of an object
at DebugRenderer.Update () [0x0000d] in :0

(Filename: Line: 0)

NullReferenceException: Object reference not set to an instance of an object
at DebugRenderer.Update () [0x0000d] in :0

(Filename: Line: 0)

NullReferenceException: Object reference not set to an instance of an object
at DebugRenderer.Update () [0x0000d] in :0

(Filename: Line: 0)

NullReferenceException: Object reference not set to an instance of an object
at DebugRenderer.Update () [0x0000d] in :0

(Filename: Line: 0)

NullReferenceException: Object reference not set to an instance of an object
at DebugRenderer.Update () [0x0000d] in :0

(Filename: Line: 0)

NullReferenceException: Object reference not set to an instance of an object
at DebugRenderer.Update () [0x0000d] in :0

(Filename: Line: 0)

NullReferenceException: Object reference not set to an instance of an object
at DebugRenderer.Update () [0x0000d] in :0

(Filename: Line: 0)

error AzureKinectException:result = K4A_RESULT_FAILED

The error message is the same, I don't understand

hmm that's weird... there is no error output from sdk...
Do you happen to use body tracking sdk 0.9.1? If so, could you try 0.9.0? I have never tested with 0.9.1.

Hey, I'm getting the same sort of errors.

err


I'm not super familiar with Unity. But maybe it has something to do with initialization not completing before the Update() method gets called continuously? Looks like tracker is the issue.

// DebugRenderer.cs

private void OnEnable()
{
    this.device = Device.Open(0);
    var config = new DeviceConfiguration
    {
        ColorResolution = ColorResolution.r720p,
        ColorFormat = ImageFormat.ColorBGRA32,
        DepthMode = DepthMode.NFOV_Unbinned
    };
    device.StartCameras(config);

    var calibration = device.GetCalibration(config.DepthMode, config.ColorResolution);
    this.tracker = BodyTracker.Create(calibration);
    debugObjects = new GameObject[(int)JointId.Count];
    for (var i = 0; i < (int)JointId.Count; i++)
    {
        var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
        cube.name = Enum.GetName(typeof(JointId), i);
        cube.transform.localScale = Vector3.one * 0.4f;
        debugObjects[i] = cube;
    }
}

...

void Update()
{
    using (Capture capture = device.GetCapture())
    {
        // FAILS HERE -- LINE 55
        tracker.EnqueueCapture(capture);
        var color = capture.Color;
        if (color.WidthPixels > 0)
        {
            Texture2D tex = new Texture2D(color.WidthPixels, color.HeightPixels, TextureFormat.BGRA32, false);
            tex.LoadRawTextureData(color.GetBufferCopy());
            tex.Apply();
            renderer.material.mainTexture = tex;
        }
    }
...

@ryanmjacobs Unity's console does not provide detailed info. Please see ~/Library/Logs/Unity/Editor.log (if you run on the Editor) or ~/Library/Logs/DefaultCompany/azure-kinect-dk-unity/Player.log (if you run the built app) assuming you use macOS. If you use other OSs, please see here for the log location. My guess is that either you did not put dlls and onnx file in the same folder as Assets or Cuda is not installed.

It's my fault, it has nothing to do with the sdk version.
I copied some dlls less.
I can copy these dlls and run them normally.
1566457722(1)

@ryanmjacobs
Did you managed to solve it? was it because of Cuda?

@UmbraExperencia adding cud/cub.dll's just fixed it for me

@xrami247 Thanks a lot! that worked for me. Luv U <3

@UmbraExperencia No, sorry I never ended up diving into it. Looks like you solved your issue though!

commented

(1) depthengine_2_0.dll is required only if you are using Transformation or Device classes. All other Sensor API (types from K4AdotNet.Sensor namespace) depends only on k4a.dll.
(2) k4abt.dll uses ONNX Runtime — onnxruntime.dll, which in turn depends on the following NVIDIA cuDNN and NVIDIA CUDA 10.0 libraries: cudnn64_7.dll, cublas64_100.dll, cudart64_100.dll. Also, Visual C++ Redistributable for Visual Studio 2015 is required: vcomp140.dll.
(3) The full list of libraries and data files required for Body Tracking:
k4abt.dll (3.7 MB),
dnn_model_2_0.onnx (159 MB),
cudnn64_7.dll (333 MB),
cublas64_100.dll (64 MB),
cudart64_100.dll (0.4 MB),
vcomp140.dll (0.2 MB).
It is mostly unpractical to have such bulky files in repositories. For this reason they are not included to the repository. Also, they are not included to NuGet package.