-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathAzureKinectManager.h
74 lines (59 loc) · 2.92 KB
/
AzureKinectManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "AzureKinectHelper.h"
#include "AzureKinectDevice.h"
#include "AzureKinectManager.generated.h"
DECLARE_LOG_CATEGORY_EXTERN(AzureKinectLog, Log, All);
/**
* A singleton class used in Blueprints to control and get info from the connected
* azure kinect device(s).
*/
UCLASS(BlueprintType, Category = "Azure Kinect")
class AZUREKINECTUNREAL_API UAzureKinectManager : public UObject
{
GENERATED_BODY()
public:
/** Ctor */
UAzureKinectManager();
/** Destructor */
~UAzureKinectManager();
/**
* Initializes the azure kinect device with the given details and if the initialization is
* successful, then adds it to the TMap.
*
* @param DeviceId The device id of the Azure Kinect Device to initialize.
* @param DepthMode The default is set to NFOV_UNBINNED. For body tracking it should be NFOV_UNBINNED or WFOV_BINNED.
* @param TimeOutInMilliSecs Default is Zero (Non-blocking). Set it to -1 (K4A_WAIT_INFINITE) for Blocking call.
*/
UFUNCTION(BlueprintCallable, Category = "Azure Kinect", meta = (DisplayName = "Init Azure Kinect"))
static void InitDevice(int32 DeviceId = 0, EKinectDepthMode DepthMode = EKinectDepthMode::NFOV_UNBINNED, int32 TimeOutInMilliSecs = 0);
/** Shuts down the azure kinect device with the given device id. */
UFUNCTION(BlueprintCallable, Category = "Azure Kinect", meta = (DisplayName = "Shutdown Azure Kinect"))
static void ShutdownDevice(int32 DeviceId = 0);
/** Check to see if the azure kinect device with the given device id is initialized. */
UFUNCTION(BlueprintPure, Category = "Azure Kinect", meta = (DisplayName = "Is Azure Kinect Device Initialized"))
static bool IsDeviceInitialized(int32 DeviceId = 0);
static AzureKinectDevice* GetDevice(int32 DeviceId);
/** Retrieves the bodies tracked and non-tracked by the azure kinect device with the given device id. */
UFUNCTION(BlueprintPure, Category = "Azure Kinect", meta = (DisplayName = "Get Bodies for Device"))
static TArray<UAzureKinectBody*> GetBodies(int32 DeviceId = 0);
/** Retrieves the azure kinect body joint count. */
UFUNCTION(BlueprintPure, Category = "Azure Kinect", meta = (DisplayName = "Get Kinect Body Joint Count"))
static int32 GetJointCount();
UFUNCTION(BlueprintCallable, Category = "Azure Kinect", meta = (DisplayName = "Toggle Kinect Device Logging"))
static void ToggleDeviceLogging(int32 DeviceId, bool ShouldShowLogs, bool ShouldShowOnScreenMsgs);
private:
/** A singleton instance. */
static UAzureKinectManager *Instance;
/**
* A map (key value pair) of connected azure kinect devices with their
* ids as keys.
*
* @note This is mainly useful when more than one azure kinect device is connected.
*/
TMap<int32, AzureKinectDevice*> KinectDevicesById;
/** Iterates through all the devices and shuts them down. */
void ShutdownAllDevices();
};