329 lines
13 KiB
C++
329 lines
13 KiB
C++
/**
|
|
* @file
|
|
*
|
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
|
*
|
|
* @section LICENSE
|
|
*
|
|
* (The MIT License)
|
|
*
|
|
* Copyright (c) 2020 - 2022 NovaGlove
|
|
*
|
|
* 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/SGNovaGloveKismetLibrary.h"
|
|
|
|
#include "SGCore/SGBuzzCommand.h"
|
|
#include "SGCore/SGForceFeedbackCommand.h"
|
|
#include "SGCore/SGHandPose.h"
|
|
#include "SGCore/SGHandProfile.h"
|
|
#include "SGCore/SGNovaGlove.h"
|
|
#include "SGCore/SGNovaGloveSensorData.h"
|
|
#include "SGCore/SGThumperCommand.h"
|
|
|
|
FString USGNovaGloveKismetLibrary::GetHapticsByte()
|
|
{
|
|
return FString::Printf(TEXT("%c"), USGNovaGlove::GetHapticsByte());
|
|
}
|
|
|
|
FVector USGNovaGloveKismetLibrary::GetMinCalibrationRange()
|
|
{
|
|
return USGNovaGlove::GetMinCalibrationRange();
|
|
}
|
|
|
|
USGHandPose* USGNovaGloveKismetLibrary::CalculateHandPose(UObject* WorldContextObject,
|
|
const USGBasicHandModel* HandModel,
|
|
const USGNovaGloveSensorData* NovaData,
|
|
const USGNovaGloveHandProfile* Profile)
|
|
{
|
|
return USGNovaGlove::CalculateHandPose(WorldContextObject, HandModel, NovaData, Profile);
|
|
}
|
|
|
|
USGDevice* USGNovaGloveKismetLibrary::Parse(UObject* WorldContextObject, const FString& ConstantsString)
|
|
{
|
|
return USGNovaGlove::Parse(WorldContextObject, ConstantsString);
|
|
}
|
|
|
|
TArray<USGNovaGlove*> USGNovaGloveKismetLibrary::GetNovaGloves(UObject* WorldContextObject)
|
|
{
|
|
return USGNovaGlove::GetNovaGloves(WorldContextObject);
|
|
}
|
|
|
|
bool USGNovaGloveKismetLibrary::GetNovaGlove_OutGlove(UObject* WorldContextObject, USGNovaGlove*& OutGlove)
|
|
{
|
|
return USGNovaGlove::GetNovaGlove(WorldContextObject, OutGlove);
|
|
}
|
|
|
|
bool USGNovaGloveKismetLibrary::GetNovaGlove_bRightHanded_OutGlove(UObject* WorldContextObject,
|
|
const bool bRightHanded, USGNovaGlove*& OutGlove)
|
|
{
|
|
return USGNovaGlove::GetNovaGlove(WorldContextObject, bRightHanded, OutGlove);
|
|
}
|
|
|
|
TArray<FVector> USGNovaGloveKismetLibrary::GetCalibrationValues_SensorData(const USGNovaGloveSensorData* SensorData)
|
|
{
|
|
return USGNovaGlove::GetCalibrationValues(SensorData);
|
|
}
|
|
|
|
void USGNovaGloveKismetLibrary::CalibrateInterpolation(
|
|
UObject* WorldContextObject,
|
|
const TArray<FVector>& MinValues, const TArray<FVector>& MaxValues, USGNovaGloveHandProfile*& OutProfile)
|
|
{
|
|
USGNovaGlove::CalibrateInterpolation(WorldContextObject, MinValues, MaxValues, OutProfile);
|
|
}
|
|
|
|
void USGNovaGloveKismetLibrary::
|
|
CalculateGloveLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_bRightHanded_OutGlovePosition_FQuatOutGloveRotation(
|
|
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
|
|
const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded,
|
|
FVector& OutGlovePosition, FQuat& OutGloveRotation)
|
|
{
|
|
USGNovaGlove::CalculateGloveLocation(ReferencePosition, ReferenceRotation,
|
|
TrackingHardware, bRightHanded,
|
|
OutGlovePosition, OutGloveRotation);
|
|
}
|
|
|
|
void USGNovaGloveKismetLibrary::
|
|
CalculateGloveLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_bRightHanded_OutGlovePosition_FRotatorOutGloveRotation(
|
|
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
|
|
const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded,
|
|
FVector& OutGlovePosition, FRotator& OutGloveRotation)
|
|
{
|
|
USGNovaGlove::CalculateGloveLocation(ReferencePosition, ReferenceRotation,
|
|
TrackingHardware, bRightHanded,
|
|
OutGlovePosition, OutGloveRotation);
|
|
}
|
|
|
|
void USGNovaGloveKismetLibrary::
|
|
CalculateWristLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_bRightHanded_OutWristPosition_FQuatOutWristRotation(
|
|
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
|
|
const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded,
|
|
FVector& OutWristPosition, FQuat& OutWristRotation)
|
|
{
|
|
USGNovaGlove::CalculateWristLocation(ReferencePosition, ReferenceRotation,
|
|
TrackingHardware, bRightHanded,
|
|
OutWristPosition, OutWristRotation);
|
|
}
|
|
|
|
void
|
|
USGNovaGloveKismetLibrary::CalculateWristLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_bRightHanded_OutWristPosition_FRotatorOutWristRotation(
|
|
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
|
|
const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded,
|
|
FVector& OutWristPosition, FRotator& OutWristRotation)
|
|
{
|
|
USGNovaGlove::CalculateWristLocation(ReferencePosition, ReferenceRotation,
|
|
TrackingHardware, bRightHanded,
|
|
OutWristPosition, OutWristRotation);
|
|
}
|
|
|
|
FString USGNovaGloveKismetLibrary::ToBytes_ThumperCommand(const USGThumperCommand* ThumperCommand)
|
|
{
|
|
return USGNovaGlove::ToBytes(ThumperCommand);
|
|
}
|
|
|
|
FString USGNovaGloveKismetLibrary::ToBytes_ForceFeedbackCommand(const USGForceFeedbackCommand* ForceFeedbackCommand)
|
|
{
|
|
return USGNovaGlove::ToBytes(ForceFeedbackCommand);
|
|
}
|
|
|
|
FString USGNovaGloveKismetLibrary::ToBytes_BuzzCommand(const USGBuzzCommand* BuzzCommand)
|
|
{
|
|
return USGNovaGlove::ToBytes(BuzzCommand);
|
|
}
|
|
|
|
ESGDeviceType USGNovaGloveKismetLibrary::GetDeviceType(const USGNovaGlove* NovaGlove)
|
|
{
|
|
return NovaGlove->GetDeviceType();
|
|
}
|
|
|
|
FString USGNovaGloveKismetLibrary::GetDeviceId(const USGNovaGlove* NovaGlove)
|
|
{
|
|
return NovaGlove->GetDeviceId();
|
|
}
|
|
|
|
FString USGNovaGloveKismetLibrary::GetHardwareVersion(const USGNovaGlove* NovaGlove)
|
|
{
|
|
return NovaGlove->GetHardwareVersion();
|
|
}
|
|
|
|
int32 USGNovaGloveKismetLibrary::GetFirmwareVersion(const USGNovaGlove* NovaGlove)
|
|
{
|
|
return NovaGlove->GetFirmwareVersion();
|
|
}
|
|
|
|
int32 USGNovaGloveKismetLibrary::GetSubFirmwareVersion(const USGNovaGlove* NovaGlove)
|
|
{
|
|
return NovaGlove->GetSubFirmwareVersion();
|
|
}
|
|
|
|
bool USGNovaGloveKismetLibrary::HasBattery(const USGNovaGlove* NovaGlove)
|
|
{
|
|
return NovaGlove->HasBattery();
|
|
}
|
|
|
|
bool USGNovaGloveKismetLibrary::IsCharging(USGNovaGlove* NovaGlove)
|
|
{
|
|
return NovaGlove->IsCharging();
|
|
}
|
|
|
|
bool USGNovaGloveKismetLibrary::GetBatteryLevel(USGNovaGlove* NovaGlove, float& OutBatteryLevel)
|
|
{
|
|
return NovaGlove->GetBatteryLevel(OutBatteryLevel);
|
|
}
|
|
|
|
bool USGNovaGloveKismetLibrary::GetSensorData(
|
|
UObject* WorldContextObject, USGNovaGlove* NovaGlove, USGNovaGloveSensorData*& OutSensorData)
|
|
{
|
|
return NovaGlove->GetSensorData(WorldContextObject, OutSensorData);
|
|
}
|
|
|
|
bool USGNovaGloveKismetLibrary::GetImuRotation_FQuatOutImu(USGNovaGlove* NovaGlove, FQuat& OutImu)
|
|
{
|
|
return NovaGlove->GetImuRotation(OutImu);
|
|
}
|
|
|
|
bool USGNovaGloveKismetLibrary::GetImuRotation_FRotatorOutImu(USGNovaGlove* NovaGlove, FRotator& OutImu)
|
|
{
|
|
return NovaGlove->GetImuRotation(OutImu);
|
|
}
|
|
|
|
bool USGNovaGloveKismetLibrary::GetHandPose_HandModel_Profile_OutHandPose(
|
|
UObject* WorldContextObject, USGNovaGlove* NovaGlove,
|
|
const USGBasicHandModel* HandModel, const USGNovaGloveHandProfile* Profile, USGHandPose*& OutHandPose)
|
|
{
|
|
return NovaGlove->GetHandPose(WorldContextObject, HandModel, Profile, OutHandPose);
|
|
}
|
|
|
|
bool USGNovaGloveKismetLibrary::GetHandPose_HandGeometry_HandProfile_OutHandPose(
|
|
UObject* WorldContextObject, USGNovaGlove* NovaGlove,
|
|
const USGBasicHandModel* HandGeometry, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose)
|
|
{
|
|
return NovaGlove->GetHandPose(WorldContextObject, HandGeometry, HandProfile, OutHandPose);
|
|
}
|
|
|
|
bool USGNovaGloveKismetLibrary::GetHandPose_HandProfile_OutHandPose(
|
|
UObject* WorldContextObject, USGNovaGlove* NovaGlove,
|
|
const USGHandProfile* HandProfile, USGHandPose*& OutHandPose)
|
|
{
|
|
return NovaGlove->GetHandPose(WorldContextObject, HandProfile, OutHandPose);
|
|
}
|
|
|
|
void USGNovaGloveKismetLibrary::SendHaptics_ForceFeedbackCommand(
|
|
USGNovaGlove* NovaGlove, const USGForceFeedbackCommand* ForceFeedbackCommand)
|
|
{
|
|
NovaGlove->SendHaptics(ForceFeedbackCommand);
|
|
}
|
|
|
|
void USGNovaGloveKismetLibrary::SendHaptics_BuzzCommand(
|
|
USGNovaGlove* NovaGlove, const USGBuzzCommand* BuzzCommand)
|
|
{
|
|
NovaGlove->SendHaptics(BuzzCommand);
|
|
}
|
|
|
|
void USGNovaGloveKismetLibrary::SendHaptics_ThumperCommand(
|
|
USGNovaGlove* NovaGlove, const USGThumperCommand* ThumperCommand)
|
|
{
|
|
NovaGlove->SendHaptics(ThumperCommand);
|
|
}
|
|
|
|
void USGNovaGloveKismetLibrary::SendHaptics_ForceFeedbackCommand_BuzzCommand_ThumperCommand(
|
|
USGNovaGlove* NovaGlove,
|
|
const USGForceFeedbackCommand* ForceFeedbackCommand,
|
|
const USGBuzzCommand* BuzzCommand,
|
|
const USGThumperCommand* ThumperCommand)
|
|
{
|
|
NovaGlove->SendHaptics(ForceFeedbackCommand, BuzzCommand, ThumperCommand);
|
|
}
|
|
|
|
bool USGNovaGloveKismetLibrary::GetCalibrationValues_OutValues(USGNovaGlove* NovaGlove,
|
|
TArray<FVector>& OutValues)
|
|
{
|
|
return NovaGlove->GetCalibrationValues(OutValues);
|
|
}
|
|
|
|
void USGNovaGloveKismetLibrary::ApplyCalibration_HandProfile(
|
|
UObject* WorldContextObject, const USGNovaGlove* NovaGlove, USGHandProfile*& OutProfile)
|
|
{
|
|
return NovaGlove->ApplyCalibration(WorldContextObject, OutProfile);
|
|
}
|
|
|
|
void USGNovaGloveKismetLibrary::ApplyCalibration_NovaGloveHandProfile(
|
|
UObject* WorldContextObject, const USGNovaGlove* NovaGlove, USGNovaGloveHandProfile*& OutProfile)
|
|
{
|
|
return NovaGlove->ApplyCalibration(WorldContextObject, OutProfile);
|
|
}
|
|
|
|
void USGNovaGloveKismetLibrary::
|
|
GetGloveLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_OutGlovePosition_FQuatOutGloveRotation(
|
|
const USGNovaGlove* NovaGlove,
|
|
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
|
|
const ESGPositionalTrackingHardware TrackingHardware,
|
|
FVector& OutGlovePosition, FQuat& OutGloveRotation)
|
|
{
|
|
return NovaGlove->GetGloveLocation(ReferencePosition, ReferenceRotation,
|
|
TrackingHardware,
|
|
OutGlovePosition, OutGloveRotation);
|
|
}
|
|
|
|
void USGNovaGloveKismetLibrary::
|
|
GetGloveLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_OutGlovePosition_FRotatorOutGloveRotation(
|
|
const USGNovaGlove* NovaGlove,
|
|
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
|
|
const ESGPositionalTrackingHardware TrackingHardware,
|
|
FVector& OutGlovePosition, FRotator& OutGloveRotation)
|
|
{
|
|
return NovaGlove->GetGloveLocation(ReferencePosition, ReferenceRotation,
|
|
TrackingHardware,
|
|
OutGlovePosition, OutGloveRotation);
|
|
}
|
|
|
|
void USGNovaGloveKismetLibrary::
|
|
GetWristLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_OutWristPosition_FQuatOutWristRotation(
|
|
const USGNovaGlove* NovaGlove,
|
|
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
|
|
const ESGPositionalTrackingHardware TrackingHardware,
|
|
FVector& OutWristPosition, FQuat& OutWristRotation)
|
|
{
|
|
return NovaGlove->GetWristLocation(ReferencePosition, ReferenceRotation,
|
|
TrackingHardware,
|
|
OutWristPosition, OutWristRotation);
|
|
}
|
|
|
|
void USGNovaGloveKismetLibrary::
|
|
GetWristLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_OutWristPosition_FRotatorOutWristRotation(
|
|
const USGNovaGlove* NovaGlove,
|
|
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
|
|
const ESGPositionalTrackingHardware TrackingHardware,
|
|
FVector& OutWristPosition, FRotator& OutWristRotation)
|
|
{
|
|
return NovaGlove->GetWristLocation(ReferencePosition, ReferenceRotation,
|
|
TrackingHardware,
|
|
OutWristPosition, OutWristRotation);
|
|
}
|
|
|
|
FString USGNovaGloveKismetLibrary::ToString(const USGNovaGlove* NovaGlove)
|
|
{
|
|
return NovaGlove->ToString();
|
|
} |