Files
Plugin/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGloveKismetLibrary.cpp
T

378 lines
16 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
*
*
*/
#include "SGCoreKismet/SGSenseGloveKismetLibrary.h"
#include "SGCore/SGBuzzCommand.h"
#include "SGCore/SGForceFeedbackCommand.h"
#include "SGCore/SGSenseGlove.h"
#include "SGCore/SGThumperCommand.h"
FString USGSenseGloveKismetLibrary::GetHapticsByte()
{
return FString::Printf(TEXT("%c"), USGSenseGlove::GetHapticsByte());
}
FString USGSenseGloveKismetLibrary::GetThumperByte()
{
return FString::Printf(TEXT("%c"), USGSenseGlove::GetThumperByte());
}
USGSenseGlovePose* USGSenseGloveKismetLibrary::CalculateGlovePose_SD_GM(
UObject* WorldContextObject,
const USGSenseGloveSensorData* SensorData, const USGSenseGloveInfo* GloveModel)
{
return USGSenseGlove::CalculateGlovePose(WorldContextObject, SensorData, GloveModel);
}
USGSenseGlovePose* USGSenseGloveKismetLibrary::CalculateGlovePose_GA_GM(
UObject* WorldContextObject,
const TArray<FSGVectorArray>& GloveAngles, const USGSenseGloveInfo* GloveModel)
{
TArray<TArray<FVector>> GloveAnglesNestedArray{
FSGArrayUtils::FromBPNestedArray<FVector, FSGVectorArray, &FSGVectorArray::VectorArray>(GloveAngles)
};
return USGSenseGlove::CalculateGlovePose(WorldContextObject, MoveTemp(GloveAnglesNestedArray), GloveModel);
}
USGHandPose* USGSenseGloveKismetLibrary::CalculateHandPose(
UObject* WorldContextObject,
const USGSenseGlovePose* GlovePose, const USGBasicHandModel* HandModel, const USGSenseGloveHandProfile* Profile)
{
return USGSenseGlove::CalculateHandPose(WorldContextObject, GlovePose, HandModel, Profile);
}
USGDevice* USGSenseGloveKismetLibrary::Parse(UObject* WorldContextObject, const FString& ConstantsString)
{
return USGSenseGlove::Parse(WorldContextObject, ConstantsString);
}
TArray<USGSenseGlove*> USGSenseGloveKismetLibrary::GetSenseGloves(UObject* WorldContextObject)
{
return USGSenseGlove::GetSenseGloves(WorldContextObject);
}
bool USGSenseGloveKismetLibrary::GetSenseGlove_OutG(UObject* WorldContextObject, USGSenseGlove*& OutGlove)
{
return USGSenseGlove::GetSenseGlove(WorldContextObject, OutGlove);
}
bool USGSenseGloveKismetLibrary::GetSenseGlove_bRH_OutG(UObject* WorldContextObject,
const bool bRightHanded, USGSenseGlove*& OutGlove)
{
return USGSenseGlove::GetSenseGlove(WorldContextObject, bRightHanded, OutGlove);
}
TArray<FVector> USGSenseGloveKismetLibrary::GetCalibrationValues_GlovePose(const USGSenseGlovePose* GlovePose)
{
return USGSenseGlove::GetCalibrationValues(GlovePose);
}
void USGSenseGloveKismetLibrary::CalibrateInterpolation(
UObject* WorldContextObject,
const TArray<FVector>& MinValues, const TArray<FVector>& MaxValues,
const bool bRightHanded, USGSenseGloveHandProfile*& OutProfile)
{
USGSenseGlove::CalibrateInterpolation(WorldContextObject, MinValues, MaxValues, bRightHanded, OutProfile);
}
void USGSenseGloveKismetLibrary::CalculateGloveLocation_RP_FQuat_RR_TH_bRH_MO_OutGP_FQuat_OutGR(
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded, const ESGFinger MountedOn,
FVector& OutGlovePosition, FQuat& OutGloveRotation)
{
USGSenseGlove::CalculateGloveLocation(ReferencePosition, ReferenceRotation,
TrackingHardware, bRightHanded, MountedOn,
OutGlovePosition, OutGloveRotation);
}
void USGSenseGloveKismetLibrary::CalculateGloveLocation_RP_FRotator_RR_TH_bRH_MO_OutGP_FRotator_OutGR(
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded, const ESGFinger MountedOn,
FVector& OutGlovePosition, FRotator& OutGloveRotation)
{
USGSenseGlove::CalculateGloveLocation(ReferencePosition, ReferenceRotation,
TrackingHardware, bRightHanded, MountedOn,
OutGlovePosition, OutGloveRotation);
}
void USGSenseGloveKismetLibrary::CalculateWristLocation_RP_FQuat_RR_TH_bRH_MO_GWPOffset_FQuat_GWRO_OutWP_FQuat_OutWR(
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded, const ESGFinger MountedOn,
const FVector& GloveWristPositionOffset, const FQuat& GloveWristRotationOffset,
FVector& OutWristPosition, FQuat& OutWristRotation)
{
USGSenseGlove::CalculateWristLocation(ReferencePosition, ReferenceRotation,
TrackingHardware, bRightHanded, MountedOn,
GloveWristPositionOffset, GloveWristRotationOffset,
OutWristPosition, OutWristRotation);
}
void
USGSenseGloveKismetLibrary::CalculateWristLocation_RP_FRotator_RR_TH_bRH_MO_GWPOffset_FRotator_GWRO_OutWP_FRotator_OutWR(
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded, const ESGFinger MountedOn,
const FVector& GloveWristPositionOffset, const FRotator& GloveWristRotationOffset,
FVector& OutWristPosition, FRotator& OutWristRotation)
{
USGSenseGlove::CalculateWristLocation(ReferencePosition, ReferenceRotation,
TrackingHardware, bRightHanded, MountedOn,
GloveWristPositionOffset, GloveWristRotationOffset,
OutWristPosition, OutWristRotation);
}
USGSenseGloveInfo* USGSenseGloveKismetLibrary::GetGloveModel(
UObject* WorldContextObject, const USGSenseGlove* SenseGlove)
{
return SenseGlove->GetGloveModel(WorldContextObject);
}
bool USGSenseGloveKismetLibrary::IsRight(const USGSenseGlove* SenseGlove)
{
return SenseGlove->IsRight();
}
ESGDeviceType USGSenseGloveKismetLibrary::GetDeviceType(const USGSenseGlove* SenseGlove)
{
return SenseGlove->GetDeviceType();
}
FString USGSenseGloveKismetLibrary::GetDeviceId(const USGSenseGlove* SenseGlove)
{
return SenseGlove->GetDeviceId();
}
FString USGSenseGloveKismetLibrary::GetHardwareVersion(const USGSenseGlove* SenseGlove)
{
return SenseGlove->GetHardwareVersion();
}
int32 USGSenseGloveKismetLibrary::GetFirmwareVersion(const USGSenseGlove* SenseGlove)
{
return SenseGlove->GetFirmwareVersion();
}
int32 USGSenseGloveKismetLibrary::GetSubFirmwareVersion(const USGSenseGlove* SenseGlove)
{
return SenseGlove->GetSubFirmwareVersion();
}
bool USGSenseGloveKismetLibrary::GetSensorData(UObject* WorldContextObject, const USGSenseGlove* SenseGlove,
USGSenseGloveSensorData*& OutSensorData)
{
return SenseGlove->GetSensorData(WorldContextObject, OutSensorData);
}
bool USGSenseGloveKismetLibrary::GetImuRotation_FQuat_OutI(USGSenseGlove* SenseGlove, FQuat& OutImu)
{
return SenseGlove->GetImuRotation(OutImu);
}
bool USGSenseGloveKismetLibrary::GetImuRotation_FRotator_OutI(USGSenseGlove* SenseGlove, FRotator& OutImu)
{
return SenseGlove->GetImuRotation(OutImu);
}
bool USGSenseGloveKismetLibrary::GetGlovePose_OutGP(UObject* WorldContextObject, USGSenseGlove* SenseGlove,
USGSenseGlovePose*& OutGlovePose)
{
return SenseGlove->GetGlovePose(WorldContextObject, OutGlovePose);
}
bool USGSenseGloveKismetLibrary::GetGlovePose_SD_OutGP(
UObject* WorldContextObject, USGSenseGlove* SenseGlove,
const USGSenseGloveSensorData* SensorData, USGSenseGlovePose*& OutGlovePose)
{
return SenseGlove->GetGlovePose(WorldContextObject, SensorData, OutGlovePose);
}
bool USGSenseGloveKismetLibrary::GetHandPose_HM_P_OutHP(
UObject* WorldContextObject, USGSenseGlove* SenseGlove,
const USGBasicHandModel* HandModel, const USGSenseGloveHandProfile* Profile, USGHandPose*& OutHandPose)
{
return SenseGlove->GetHandPose(WorldContextObject, HandModel, Profile, OutHandPose);
}
bool USGSenseGloveKismetLibrary::GetHandPose_HG_HP_OutHP(
UObject* WorldContextObject, USGSenseGlove* SenseGlove,
const USGBasicHandModel* HandGeometry, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose)
{
return SenseGlove->GetHandPose(WorldContextObject, HandGeometry, HandProfile, OutHandPose);
}
bool USGSenseGloveKismetLibrary::GetHandPose_HP_OutHP(
UObject* WorldContextObject, USGSenseGlove* SenseGlove,
const USGHandProfile* HandProfile, USGHandPose*& OutHandPose)
{
return SenseGlove->GetHandPose(WorldContextObject, HandProfile, OutHandPose);
}
void USGSenseGloveKismetLibrary::SendHaptics_FFC(USGSenseGlove* SenseGlove,
const USGForceFeedbackCommand* ForceFeedbackCommand)
{
SenseGlove->SendHaptics(ForceFeedbackCommand);
}
void USGSenseGloveKismetLibrary::SendHaptics_BC(USGSenseGlove* SenseGlove,const USGBuzzCommand* BuzzCommand)
{
SenseGlove->SendHaptics(BuzzCommand);
}
void USGSenseGloveKismetLibrary::SendHaptics_FFC_BC_TC(USGSenseGlove* SenseGlove,
const USGForceFeedbackCommand* ForceFeedbackCommand,
const USGBuzzCommand* BuzzCommand,
const USGThumperCommand* ThumperCommand)
{
SenseGlove->SendHaptics(ForceFeedbackCommand, BuzzCommand, ThumperCommand);
}
bool USGSenseGloveKismetLibrary::GetCalibrationValues_OutV(USGSenseGlove* SenseGlove, TArray<FVector>& OutValues)
{
return SenseGlove->GetCalibrationValues(OutValues);
}
void USGSenseGloveKismetLibrary::ResetCalibrationRange(USGSenseGlove* SenseGlove)
{
SenseGlove->ResetCalibrationRange();
}
void USGSenseGloveKismetLibrary::ApplyCalibration_USGHandProfile_OutP(
UObject* WorldContextObject, const USGSenseGlove* SenseGlove, USGHandProfile*& OutProfile)
{
return SenseGlove->ApplyCalibration(WorldContextObject, OutProfile);
}
void USGSenseGloveKismetLibrary::ApplyCalibration_USGSenseGloveHandProfile_OutP(
UObject* WorldContextObject, const USGSenseGlove* SenseGlove, USGSenseGloveHandProfile*& OutProfile)
{
return SenseGlove->ApplyCalibration(WorldContextObject, OutProfile);
}
void USGSenseGloveKismetLibrary::GetGloveLocation_RP_FQuat_RR_TH_OutGP_FQuat_OutGR(
const USGSenseGlove* SenseGlove,
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware,
FVector& OutGlovePosition, FQuat& OutGloveRotation)
{
return SenseGlove->GetGloveLocation(ReferencePosition, ReferenceRotation,
TrackingHardware,
OutGlovePosition, OutGloveRotation);
}
void USGSenseGloveKismetLibrary::GetGloveLocation_RP_FRotator_RR_TH_OutGP_FRotator_OutGR(
const USGSenseGlove* SenseGlove,
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware,
FVector& OutGlovePosition, FRotator& OutGloveRotation)
{
return SenseGlove->GetGloveLocation(ReferencePosition, ReferenceRotation,
TrackingHardware,
OutGlovePosition, OutGloveRotation);
}
void USGSenseGloveKismetLibrary::GetGloveLocation_RP_FQuat_RR_TH_MO_OutGP_FQuat_OutGR(
const USGSenseGlove* SenseGlove,
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware, const ESGFinger MountedOn,
FVector& OutGlovePosition, FQuat& OutGloveRotation)
{
return SenseGlove->GetGloveLocation(ReferencePosition, ReferenceRotation,
TrackingHardware, MountedOn,
OutGlovePosition, OutGloveRotation);
}
void USGSenseGloveKismetLibrary::GetGloveLocation_RP_FRotator_RR_TH_MO_OutGP_FRotator_OutGR(
const USGSenseGlove* SenseGlove,
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware, const ESGFinger MountedOn, FVector& OutGlovePosition,
FRotator& OutGloveRotation)
{
return SenseGlove->GetGloveLocation(ReferencePosition, ReferenceRotation,
TrackingHardware, MountedOn,
OutGlovePosition, OutGloveRotation);
}
void USGSenseGloveKismetLibrary::GetWristLocation_RP_FQuat_RR_TH_OutWP_FQuat_OutWR(
const USGSenseGlove* SenseGlove,
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FQuat& OutWristRotation)
{
return SenseGlove->GetWristLocation(ReferencePosition, ReferenceRotation,
TrackingHardware,
OutWristPosition, OutWristRotation);
}
void USGSenseGloveKismetLibrary::GetWristLocation_RP_FRotator_RR_TH_OutWP_FRotator_OutWR(
const USGSenseGlove* SenseGlove,
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FRotator& OutWristRotation)
{
return SenseGlove->GetWristLocation(ReferencePosition, ReferenceRotation,
TrackingHardware,
OutWristPosition, OutWristRotation);
}
void USGSenseGloveKismetLibrary::GetWristLocation_RP_FQuat_RR_TH_GWPO_FQuat_GWRO_OutWP_FQuat_OutWR(
const USGSenseGlove* SenseGlove,
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware,
const FVector& GloveWristPositionOffset, const FQuat& GloveWristRotationOffset,
FVector& OutWristPosition, FQuat& OutWristRotation)
{
return SenseGlove->GetWristLocation(ReferencePosition, ReferenceRotation,
TrackingHardware,
GloveWristPositionOffset, GloveWristRotationOffset,
OutWristPosition, OutWristRotation);
}
void USGSenseGloveKismetLibrary::GetWristLocation_RP_FRotator_RR_TH_GWPO_FRotator_GWRO_OutWP_FRotator_OutWR(
const USGSenseGlove* SenseGlove,
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware,
const FVector& GloveWristPositionOffset, const FRotator& GloveWristRotationOffset,
FVector& OutWristPosition, FRotator& OutWristRotation)
{
return SenseGlove->GetWristLocation(ReferencePosition, ReferenceRotation,
TrackingHardware,
GloveWristPositionOffset, GloveWristRotationOffset,
OutWristPosition, OutWristRotation);
}
FString USGSenseGloveKismetLibrary::ToString(const USGSenseGlove* SenseGlove)
{
return SenseGlove->ToString();
}