Files
Plugin/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveKismetLibrary.h
T

322 lines
18 KiB
C++

/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2022 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#pragma once
#include "SGCore/SGHandPose.h"
#include "SGCore/SGHandProfile.h"
#include "SGCore/SGSenseGlove.h"
#include "SGCore/SGSenseGlovePose.h"
#include "SGCore/SGSenseGloveSensorData.h"
#include "SGCore/SGVectorArray.h"
#include "SGKismet/SGBlueprintFunctionLibrary.h"
#include "SGSenseGloveKismetLibrary.generated.h"
class USGBuzzCommand;
class USGDevice;
class USGForceFeedbackCommand;
class USGSenseGlove;
UCLASS(meta=(ScriptName = "SesneGloveSenseGloveKismetLibrary"))
class SENSEGLOVECOREKISMET_API USGSenseGloveKismetLibrary final : public USGBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove")
static FString GetHapticsByte();
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove")
static FString GetThumperByte();
UFUNCTION(BlueprintCallable, DisplayName="Calculate Glove Pose", Category="SenseGlove | Core | SG | Sense Glove",
meta=(WorldContext="WorldContextObject"))
static USGSenseGlovePose* CalculateGlovePose_SensorData_GloveModel(
UObject* WorldContextObject,
const USGSenseGloveSensorData* SensorData, const USGSenseGloveInfo* GloveModel);
UFUNCTION(BlueprintCallable, DisplayName="Calculate Glove Pose", Category="SenseGlove | Core | SG | Sense Glove",
meta=(WorldContext="WorldContextObject"))
static USGSenseGlovePose* CalculateGlovePose_GloveAngles_GloveModel(
UObject* WorldContextObject,
const TArray<FSGVectorArray>& GloveAngles, const USGSenseGloveInfo* GloveModel);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove",
meta=(WorldContext="WorldContextObject"))
static USGHandPose* CalculateHandPose(
UObject* WorldContextObject,
const USGSenseGlovePose* GlovePose, const USGBasicHandModel* HandModel,
const USGSenseGloveHandProfile* Profile);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove",
meta=(WorldContext="WorldContextObject"))
static USGDevice* Parse(UObject* WorldContextObject, const FString& ConstantsString);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove",
meta=(WorldContext="WorldContextObject"))
static TArray<USGSenseGlove*> GetSenseGloves(UObject* WorldContextObject);
UFUNCTION(BlueprintCallable, DisplayName="Get Sense Glove", Category="SenseGlove | Core | SG | Sense Glove",
meta=(WorldContext="WorldContextObject"))
static bool GetSenseGlove_OutGlove(UObject* WorldContextObject, USGSenseGlove*& OutGlove);
UFUNCTION(BlueprintCallable, DisplayName="Get Sense Glove", Category="SenseGlove | Core | SG | Sense Glove",
meta=(WorldContext="WorldContextObject"))
static bool GetSenseGlove_bRightHanded_OutGlove(UObject* WorldContextObject, bool bRightHanded,
USGSenseGlove*& OutGlove);
UFUNCTION(BlueprintCallable, DisplayName="Get Calibration Values", Category="SenseGlove | Core | SG | Sense Glove")
static TArray<FVector> GetCalibrationValues_GlovePose(const USGSenseGlovePose* GlovePose);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove",
meta=(WorldContext="WorldContextObject"))
static void CalibrateInterpolation(UObject* WorldContextObject,
const TArray<FVector>& MinValues, const TArray<FVector>& MaxValues,
bool bRightHanded, USGSenseGloveHandProfile*& OutProfile);
UFUNCTION(BlueprintCallable, DisplayName="Calculate Glove Location",
Category="SenseGlove | Core | SG | Sense Glove")
static void
CalculateGloveLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_bRightHanded_MountedOn_OutGlovePosition_FQuatOutGloveRotation(
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
bool bRightHanded, ESGFinger MountedOn,
FVector& OutGlovePosition, FQuat& OutGloveRotation);
UFUNCTION(BlueprintCallable, DisplayName="Calculate Glove Location",
Category="SenseGlove | Core | SG | Sense Glove")
static void
CalculateGloveLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_bRightHanded_MountedOn_OutGlovePosition_FRotatorOutGloveRotation(
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
bool bRightHanded, ESGFinger MountedOn,
FVector& OutGlovePosition, FRotator& OutGloveRotation);
UFUNCTION(BlueprintCallable, DisplayName="Calculate Wrist Location",
Category="SenseGlove | Core | SG | Sense Glove")
static void
CalculateWristLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_bRightHanded_MountedOn_GloveWristPositionOffset_FQuatGloveWristRotationOffset_OutWristPosition_FQuatOutWristRotation
(
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
bool bRightHanded, ESGFinger MountedOn,
const FVector& GloveWristPositionOffset,
const FQuat& GloveWristRotationOffset,
FVector& OutWristPosition, FQuat& OutWristRotation);
UFUNCTION(BlueprintCallable, DisplayName="Calculate Wrist Location",
Category="SenseGlove | Core | SG | Sense Glove")
static void
CalculateWristLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_bRightHanded_MountedOn_GloveWristPositionOffset_FRotatorGloveWristRotationOffset_OutWristPosition_FRotatorOutWristRotation(
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
bool bRightHanded, ESGFinger MountedOn,
const FVector& GloveWristPositionOffset,
const FRotator& GloveWristRotationOffset,
FVector& OutWristPosition, FRotator& OutWristRotation);
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove", meta=(WorldContext="WorldContextObject"))
static USGSenseGloveInfo* GetGloveModel(UObject* WorldContextObject, const USGSenseGlove* SenseGlove);
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove")
static bool IsRight(const USGSenseGlove* SenseGlove);
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove")
static ESGDeviceType GetDeviceType(const USGSenseGlove* SenseGlove);
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove")
static FString GetDeviceId(const USGSenseGlove* SenseGlove);
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove")
static FString GetHardwareVersion(const USGSenseGlove* SenseGlove);
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove")
static int32 GetFirmwareVersion(const USGSenseGlove* SenseGlove);
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove")
static int32 GetSubFirmwareVersion(const USGSenseGlove* SenseGlove);
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove", meta=(WorldContext="WorldContextObject"))
static bool GetSensorData(UObject* WorldContextObject,
const USGSenseGlove* SenseGlove, USGSenseGloveSensorData*& OutSensorData);
UFUNCTION(BlueprintCallable, DisplayName="Get Imu Rotation", Category="SenseGlove | Core | SG | Sense Glove")
static bool GetImuRotation_FQuatOutImu(UPARAM(ref) USGSenseGlove* SenseGlove, FQuat& OutImu);
UFUNCTION(BlueprintCallable, DisplayName="Get Imu Rotation", Category="SenseGlove | Core | SG | Sense Glove")
static bool GetImuRotation_FRotatorOutImu(UPARAM(ref) USGSenseGlove* SenseGlove, FRotator& OutImu);
UFUNCTION(BlueprintCallable, DisplayName="Get Glove Pose", Category="SenseGlove | Core | SG | Sense Glove",
meta=(WorldContext="WorldContextObject"))
static bool GetGlovePose_OutGlovePose(UObject* WorldContextObject,
UPARAM(ref) USGSenseGlove* SenseGlove,
USGSenseGlovePose*& OutGlovePose);
UFUNCTION(BlueprintCallable, DisplayName="Get Glove Pose", Category="SenseGlove | Core | SG | Sense Glove",
meta=(WorldContext="WorldContextObject"))
static bool GetGlovePose_SensorData_OutGlovePose(UObject* WorldContextObject,
UPARAM(ref) USGSenseGlove* SenseGlove,
const USGSenseGloveSensorData* SensorData,
USGSenseGlovePose*& OutGlovePose);
UFUNCTION(BlueprintCallable, DisplayName="Get Hand Pose", Category="SenseGlove | Core | SG | Sense Glove",
meta=(WorldContext="WorldContextObject"))
static bool GetHandPose_HandModel_Profile_OutHandPose(UObject* WorldContextObject,
UPARAM(ref) USGSenseGlove* SenseGlove,
const USGBasicHandModel* HandModel,
const USGSenseGloveHandProfile* Profile,
USGHandPose*& OutHandPose);
UFUNCTION(BlueprintCallable, DisplayName="Get Hand Pose", Category="SenseGlove | Core | SG | Sense Glove",
meta=(WorldContext="WorldContextObject"))
static bool GetHandPose_HandGeometry_HandProfile_OutHandPose(UObject* WorldContextObject,
UPARAM(ref) USGSenseGlove* SenseGlove,
const USGBasicHandModel* HandGeometry,
const USGHandProfile* HandProfile,
USGHandPose*& OutHandPose);
UFUNCTION(BlueprintCallable, DisplayName="Get Hand Pose", Category="SenseGlove | Core | SG | Sense Glove",
meta=(WorldContext="WorldContextObject"))
static bool GetHandPose_HandProfile_OutHandPose(UObject* WorldContextObject,
UPARAM(ref) USGSenseGlove* SenseGlove,
const USGHandProfile* HandProfile,
USGHandPose*& OutHandPose);
UFUNCTION(BlueprintCallable, DisplayName="Send Haptics", Category="SenseGlove | Core | SG | Sense Glove")
static void SendHaptics_ForceFeedbackCommand(UPARAM(ref) USGSenseGlove* SenseGlove,
const USGForceFeedbackCommand* ForceFeedbackCommand);
UFUNCTION(BlueprintCallable, DisplayName="Send Haptics", Category="SenseGlove | Core | SG | Sense Glove")
static void SendHaptics_BuzzCommand(UPARAM(ref) USGSenseGlove* SenseGlove,
const USGBuzzCommand* BuzzCommand);
UFUNCTION(BlueprintCallable, DisplayName="Send Haptics", Category="SenseGlove | Core | SG | Sense Glove")
static void SendHaptics_ForceFeedbackCommand_BuzzCommand_ThumperCommand(
UPARAM(ref) USGSenseGlove* SenseGlove,
const USGForceFeedbackCommand* ForceFeedbackCommand,
const USGBuzzCommand* BuzzCommand,
const USGThumperCommand* ThumperCommand);
UFUNCTION(BlueprintCallable, DisplayName="Get Calibration Values", Category="SenseGlove | Core | SG | Sense Glove")
static bool GetCalibrationValues_OutValues(UPARAM(ref) USGSenseGlove* SenseGlove,
TArray<FVector>& OutValues);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove")
static void ResetCalibrationRange(UPARAM(ref) USGSenseGlove* SenseGlove);
UFUNCTION(BlueprintPure, DisplayName="Apply Calibration", Category="SenseGlove | Core | SG | Sense Glove",
meta=(WorldContext="WorldContextObject"))
static void ApplyCalibration_HandProfile(UObject* WorldContextObject,
const USGSenseGlove* SenseGlove,
USGHandProfile*& OutProfile);
UFUNCTION(BlueprintPure, DisplayName="Apply Calibration", Category="SenseGlove | Core | SG | Sense Glove",
meta=(WorldContext="WorldContextObject"))
static void ApplyCalibration_SenseGloveHandProfile(UObject* WorldContextObject,
const USGSenseGlove* SenseGlove,
USGSenseGloveHandProfile*& OutProfile);
UFUNCTION(BlueprintPure, DisplayName="Get Glove Location", Category="SenseGlove | Core | SG | Sense Glove")
static void
GetGloveLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_OutGlovePosition_FQuatOutGloveRotation(
const USGSenseGlove* SenseGlove,
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutGlovePosition, FQuat& OutGloveRotation);
UFUNCTION(BlueprintPure, DisplayName="Get Glove Location", Category="SenseGlove | Core | SG | Sense Glove")
static void
GetGloveLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_OutGlovePosition_FRotatorOutGloveRotation(
const USGSenseGlove* SenseGlove,
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutGlovePosition, FRotator& OutGloveRotation);
UFUNCTION(BlueprintPure, DisplayName="Get Glove Location", Category="SenseGlove | Core | SG | Sense Glove")
static void
GetGloveLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_MountedOn_OutGlovePosition_FQuatOutGloveRotation(
const USGSenseGlove* SenseGlove,
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware, ESGFinger MountedOn,
FVector& OutGlovePosition, FQuat& OutGloveRotation);
UFUNCTION(BlueprintPure, DisplayName="Get Glove Location", Category="SenseGlove | Core | SG | Sense Glove")
static void
GetGloveLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_MountedOn_OutGlovePosition_FRotatorOutGloveRotation(
const USGSenseGlove* SenseGlove,
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware, ESGFinger MountedOn,
FVector& OutGlovePosition, FRotator& OutGloveRotation);
UFUNCTION(BlueprintPure, DisplayName="Get Wrist Location", Category="SenseGlove | Core | SG | Sense Glove")
static void
GetWristLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_OutWristPosition_FQuatOutWristRotation(
const USGSenseGlove* SenseGlove,
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FQuat& OutWristRotation);
UFUNCTION(BlueprintPure, DisplayName="Get Wrist Location", Category="SenseGlove | Core | SG | Sense Glove")
static void
GetWristLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_OutWristPosition_FRotatorOutWristRotation(
const USGSenseGlove* SenseGlove,
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FRotator& OutWristRotation);
UFUNCTION(BlueprintPure, DisplayName="Get Wrist Location", Category="SenseGlove | Core | SG | Sense Glove")
static void
GetWristLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_GloveWristPositionOffset_FQuatGloveWristRotationOffset_OutWristPosition_FQuatOutWristRotation(
const USGSenseGlove* SenseGlove,
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
const FVector& GloveWristPositionOffset,
const FQuat& GloveWristRotationOffset,
FVector& OutWristPosition, FQuat& OutWristRotation);
UFUNCTION(BlueprintPure, DisplayName="Get Wrist Location", Category="SenseGlove | Core | SG | Sense Glove")
static void
GetWristLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_GloveWristPositionOffset_FRotatorGloveWristRotationOffset_OutWristPosition_FRotatorOutWristRotation(
const USGSenseGlove* SenseGlove,
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
const FVector& GloveWristPositionOffset,
const FRotator& GloveWristRotationOffset,
FVector& OutWristPosition, FRotator& OutWristRotation);
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove")
static FString ToString(const USGSenseGlove* SenseGlove);
};