From a500603c3ca70ed6d22c2963ebbaed93bfcd0c3a Mon Sep 17 00:00:00 2001 From: Mamadou Babaei Date: Thu, 10 Nov 2022 20:32:33 +0100 Subject: [PATCH] add FRotator overloads for every method that accepts or returns FQuat and some other bug fixes --- .../Private/SGCore/SGBasicHandModel.cpp | 116 +++++++++++- .../Private/SGCore/SGHandInterpolator.cpp | 88 ++++++++- .../Private/SGCore/SGHandPose.cpp | 111 ++++++++++- .../Private/SGCore/SGHapticGlove.cpp | 63 +++++++ .../Private/SGCore/SGJointKinematics.cpp | 64 ++++++- .../Private/SGCore/SGNovaGlove.cpp | 101 ++++++++++ .../Private/SGCore/SGNovaGloveSensorData.cpp | 45 ++++- .../Private/SGCore/SGRotatorArray.cpp | 36 ++++ .../Private/SGCore/SGSenseGlove.cpp | 163 ++++++++++++++++ .../Private/SGCore/SGSenseGloveInfo.cpp | 161 +++++++++++++++- .../Private/SGCore/SGSenseGlovePose.cpp | 106 ++++++++++- .../Private/SGCore/SGSenseGloveSensorData.cpp | 72 ++++++- .../Private/SGCore/SGSenseGloveVars.cpp | 28 ++- .../Private/SGCore/SGTracking.cpp | 176 ++++++++++++++++-- .../Public/SGCore/SGBasicHandModel.h | 26 ++- .../Public/SGCore/SGHandInterpolator.h | 18 +- .../SenseGloveCore/Public/SGCore/SGHandPose.h | 24 ++- .../Public/SGCore/SGHapticGlove.h | 12 +- .../Public/SGCore/SGJointKinematics.h | 9 + .../Public/SGCore/SGNovaGlove.h | 18 ++ .../Public/SGCore/SGNovaGloveSensorData.h | 11 +- .../Public/SGCore/SGRotatorArray.h | 50 +++++ .../Public/SGCore/SGSenseGlove.h | 32 ++++ .../Public/SGCore/SGSenseGloveInfo.h | 38 +++- .../Public/SGCore/SGSenseGlovePose.h | 29 ++- .../Public/SGCore/SGSenseGloveSensorData.h | 18 +- .../Public/SGCore/SGSenseGloveVars.h | 8 +- .../SenseGloveCore/Public/SGCore/SGTracking.h | 60 ++++-- .../SGBasicHandModelKismetLibrary.cpp | 40 +++- .../SGHandInterpolatorKismetLibrary.cpp | 18 +- .../SGCoreKismet/SGHandPoseKismetLibrary.cpp | 21 ++- .../SGHapticGloveKismetLibrary.cpp | 52 +++++- .../SGJointKinematicsKismetLibrary.cpp | 24 ++- .../SGCoreKismet/SGNovaGloveKismetLibrary.cpp | 70 ++++++- .../SGNovaGloveSensorDataKismetLibrary.cpp | 18 +- .../SGSenseGloveInfoKismetLibrary.cpp | 41 +++- .../SGSenseGloveKismetLibrary.cpp | 105 +++++++++-- .../SGSenseGlovePoseKismetLibrary.cpp | 30 ++- .../SGSenseGloveSensorDataKismetLibrary.cpp | 19 +- .../SGSenseGloveVarsKismetLibrary.cpp | 21 ++- .../SGCoreKismet/SGTrackingKismetLibrary.cpp | 139 ++++++++++++-- .../SGBasicHandModelKismetLibrary.h | 40 +++- .../SGHandInterpolatorKismetLibrary.h | 17 +- .../SGCoreKismet/SGHandPoseKismetLibrary.h | 21 ++- .../SGCoreKismet/SGHapticGloveKismetLibrary.h | 45 +++-- .../SGJointKinematicsKismetLibrary.h | 17 +- .../SGCoreKismet/SGNovaGloveKismetLibrary.h | 66 +++++-- .../SGNovaGloveSensorDataKismetLibrary.h | 18 +- .../SGSenseGloveInfoKismetLibrary.h | 33 +++- .../SGCoreKismet/SGSenseGloveKismetLibrary.h | 101 ++++++++-- .../SGSenseGlovePoseKismetLibrary.h | 27 ++- .../SGSenseGloveSensorDataKismetLibrary.h | 17 +- .../SGSenseGloveVarsKismetLibrary.h | 20 +- .../SGCoreKismet/SGTrackingKismetLibrary.h | 161 ++++++++++++---- .../Private/SGUtils/SGArrayUtils.cpp | 54 +++++- .../Public/SGUtils/SGArrayUtils.h | 95 +++++++++- 56 files changed, 2744 insertions(+), 269 deletions(-) create mode 100644 Source/SenseGloveCore/Private/SGCore/SGRotatorArray.cpp create mode 100644 Source/SenseGloveCore/Public/SGCore/SGRotatorArray.h diff --git a/Source/SenseGloveCore/Private/SGCore/SGBasicHandModel.cpp b/Source/SenseGloveCore/Private/SGCore/SGBasicHandModel.cpp index 75bdd455..1ec83793 100644 --- a/Source/SenseGloveCore/Private/SGCore/SGBasicHandModel.cpp +++ b/Source/SenseGloveCore/Private/SGCore/SGBasicHandModel.cpp @@ -143,6 +143,22 @@ USGBasicHandModel* USGBasicHandModel::NewBasicHandModel(UObject* Outer, const bo return NewBasicHandModel(Outer, MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl)); } +USGBasicHandModel* USGBasicHandModel::NewBasicHandModel(UObject* Outer, const bool bRightHanded, + const TArray>& Lengths, + const TArray& StartPositions, + const TArray& StartRotations) +{ + FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; + FSGIC_TArray_TArray_float LengthsContainer{Lengths}; + FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; + FSGIC_TArray_FQuat StartRotationsContainer{FSGArrayUtils::RotatorsToQuats(StartRotations)}; + SGCoreImpl_FSGBasicHandModelImpl_ctor_bRightHanded_Lengths_StartPositions_StartRotations( + &OutBasicHandModelImplContainer, bRightHanded, &LengthsContainer, + &StartPositionsContainer, &StartRotationsContainer); + + return NewBasicHandModel(Outer, MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl)); +} + USGBasicHandModel* USGBasicHandModel::NewBasicHandModel(UObject* Outer, const bool bRightHanded, const TArray& Lengths, const TArray& StartPositions, @@ -161,6 +177,24 @@ USGBasicHandModel* USGBasicHandModel::NewBasicHandModel(UObject* Outer, const bo return NewBasicHandModel(Outer, MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl)); } +USGBasicHandModel* USGBasicHandModel::NewBasicHandModel(UObject* Outer, const bool bRightHanded, + const TArray& Lengths, + const TArray& StartPositions, + const TArray& StartRotations) +{ + FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; + FSGIC_TArray_TArray_float LengthsContainer{ + FSGArrayUtils::FromBPNestedArray(Lengths) + }; + FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; + FSGIC_TArray_FQuat StartRotationsContainer{FSGArrayUtils::RotatorsToQuats(StartRotations)}; + SGCoreImpl_FSGBasicHandModelImpl_ctor_bRightHanded_Lengths_StartPositions_StartRotations( + &OutBasicHandModelImplContainer, bRightHanded, &LengthsContainer, + &StartPositionsContainer, &StartRotationsContainer); + + return NewBasicHandModel(Outer, MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl)); +} + USGBasicHandModel* USGBasicHandModel::Default(UObject* Outer, const bool bRightHanded) { FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; @@ -273,7 +307,28 @@ USGBasicHandModel::USGBasicHandModel(const bool bRightHanded, const TArraySyncUProperties(); } -USGBasicHandModel::USGBasicHandModel(bool bRightHanded, const TArray& Lengths, +USGBasicHandModel::USGBasicHandModel(const bool bRightHanded, const TArray>& Lengths, + const TArray& StartPositions, const TArray& StartRotations) + : +#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) + Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) +#else + Pimpl(TUniquePtr(new FImpl{this})) +#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */ +{ + FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; + FSGIC_TArray_TArray_float LengthsContainer{Lengths}; + FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; + FSGIC_TArray_FQuat StartRotationsContainer{FSGArrayUtils::RotatorsToQuats(StartRotations)}; + SGCoreImpl_FSGBasicHandModelImpl_ctor_bRightHanded_Lengths_StartPositions_StartRotations( + &OutBasicHandModelImplContainer, bRightHanded, &LengthsContainer, + &StartPositionsContainer, &StartRotationsContainer); + + Pimpl->BasicHandModelImpl = MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl); + Pimpl->SyncUProperties(); +} + +USGBasicHandModel::USGBasicHandModel(const bool bRightHanded, const TArray& Lengths, const TArray& StartPositions, const TArray& StartRotations) : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) @@ -296,6 +351,29 @@ USGBasicHandModel::USGBasicHandModel(bool bRightHanded, const TArraySyncUProperties(); } +USGBasicHandModel::USGBasicHandModel(const bool bRightHanded, const TArray& Lengths, + const TArray& StartPositions, const TArray& StartRotations) + : +#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) + Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) +#else + Pimpl(TUniquePtr(new FImpl{this})) +#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */ +{ + FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; + FSGIC_TArray_TArray_float LengthsContainer{ + FSGArrayUtils::FromBPNestedArray(Lengths) + }; + FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; + FSGIC_TArray_FQuat StartRotationsContainer{FSGArrayUtils::RotatorsToQuats(StartRotations)}; + SGCoreImpl_FSGBasicHandModelImpl_ctor_bRightHanded_Lengths_StartPositions_StartRotations( + &OutBasicHandModelImplContainer, bRightHanded, &LengthsContainer, + &StartPositionsContainer, &StartRotationsContainer); + + Pimpl->BasicHandModelImpl = MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl); + Pimpl->SyncUProperties(); +} + USGBasicHandModel::USGBasicHandModel(const FSGBasicHandModelImpl& BasicHandModelImpl) : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) @@ -432,7 +510,7 @@ void USGBasicHandModel::SetStartJointPosition(const uint8 Finger, const FVector& Pimpl->SyncUProperties(); } -TArray USGBasicHandModel::GetStartJointRotations() const +TArray USGBasicHandModel::GetStartJointRotationsQ() const { FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_TArray_FQuat OutRotationsContainer; @@ -440,6 +518,14 @@ TArray USGBasicHandModel::GetStartJointRotations() const return MoveTemp(OutRotationsContainer.Array); } +TArray USGBasicHandModel::GetStartJointRotations() const +{ + FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; + FSGIC_TArray_FQuat OutRotationsContainer; + SGCoreImpl_FSGBasicHandModelImpl_GetStartJointRotations(&InstanceContainer, &OutRotationsContainer); + return FSGArrayUtils::QuatsToRotators(OutRotationsContainer.Array); +} + FVector USGBasicHandModel::GetJointPosition(const ESGFinger Finger) const { Pimpl->SyncImplObject(); @@ -464,7 +550,7 @@ void USGBasicHandModel::SetJointPosition(const FVector& NewPosition, const ESGFi Pimpl->SyncUProperties(); } -FQuat USGBasicHandModel::GetJointRotation(const ESGFinger Finger) const +FQuat USGBasicHandModel::GetJointRotationQ(const ESGFinger Finger) const { Pimpl->SyncImplObject(); @@ -476,6 +562,18 @@ FQuat USGBasicHandModel::GetJointRotation(const ESGFinger Finger) const return MoveTemp(OutRotationContainer.Quat); } +FRotator USGBasicHandModel::GetJointRotation(const ESGFinger Finger) const +{ + Pimpl->SyncImplObject(); + + FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; + FSGIC_FQuat OutRotationContainer; + FSGIC_ESGFinger FingerContainer{Finger}; + SGCoreImpl_FSGBasicHandModelImpl_GetJointRotation(&InstanceContainer, &OutRotationContainer, &FingerContainer); + + return OutRotationContainer.Quat.Rotator(); +} + void USGBasicHandModel::SetJointRotation(const FQuat& NewRotation, const ESGFinger Finger) { Pimpl->SyncImplObject(); @@ -488,6 +586,18 @@ void USGBasicHandModel::SetJointRotation(const FQuat& NewRotation, const ESGFing Pimpl->SyncUProperties(); } +void USGBasicHandModel::SetJointRotation(const FRotator& NewRotation, const ESGFinger Finger) +{ + Pimpl->SyncImplObject(); + + FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; + FSGIC_FQuat NewRotationContainer{NewRotation.Quaternion()}; + FSGIC_ESGFinger FingerContainer{Finger}; + SGCoreImpl_FSGBasicHandModelImpl_SetJointRotation(&InstanceContainer, &NewRotationContainer, &FingerContainer); + + Pimpl->SyncUProperties(); +} + TArray USGBasicHandModel::GetTotalLengths() const { FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; diff --git a/Source/SenseGloveCore/Private/SGCore/SGHandInterpolator.cpp b/Source/SenseGloveCore/Private/SGCore/SGHandInterpolator.cpp index 5c3161bc..2756729d 100644 --- a/Source/SenseGloveCore/Private/SGCore/SGHandInterpolator.cpp +++ b/Source/SenseGloveCore/Private/SGCore/SGHandInterpolator.cpp @@ -151,6 +151,21 @@ USGHandInterpolator* USGHandInterpolator::NewHandInterpolator( return NewHandInterpolator(Outer, MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl)); } +USGHandInterpolator* USGHandInterpolator::NewHandInterpolator( + UObject* Outer, + const TArray>& JointInterpolations, const FRotator& CmcStartRotation) +{ + FSGIC_FSGHandInterpolatorImpl OutHandInterpolatorImplContainer; + FSGIC_TArray_TArray_FSGInterpolationSetImpl JointInterpolationsContainer{ + FSGArrayUtils::ToImplType(JointInterpolations)}; + FSGIC_FQuat CmcStartRotationContainer{CmcStartRotation.Quaternion()}; + SGCoreImpl_FSGHandInterpolatorImpl_ctor_JointInterpolations_CmcStartRotation( + &OutHandInterpolatorImplContainer, &JointInterpolationsContainer, &CmcStartRotationContainer); + + return NewHandInterpolator(Outer, MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl)); +} + USGHandInterpolator* USGHandInterpolator::NewHandInterpolator( UObject* Outer, const TArray& JointInterpolations, const FQuat& CmcStartRotation) @@ -169,6 +184,24 @@ USGHandInterpolator* USGHandInterpolator::NewHandInterpolator( return NewHandInterpolator(Outer, MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl)); } +USGHandInterpolator* USGHandInterpolator::NewHandInterpolator( + UObject* Outer, + const TArray& JointInterpolations, const FRotator& CmcStartRotation) +{ + FSGIC_FSGHandInterpolatorImpl OutHandInterpolatorImplContainer; + FSGIC_TArray_TArray_FSGInterpolationSetImpl JointInterpolationsContainer{ + FSGArrayUtils::ToImplType< + USGInterpolationSet, FSGInterpolationSetImpl, + &USGInterpolationSet::ToInterpolationSetImpl, + FSGInterpolationSetArray, &FSGInterpolationSetArray::InterpolationSetArray>( + JointInterpolations)}; + FSGIC_FQuat CmcStartRotationContainer{CmcStartRotation.Quaternion()}; + SGCoreImpl_FSGHandInterpolatorImpl_ctor_JointInterpolations_CmcStartRotation( + &OutHandInterpolatorImplContainer, &JointInterpolationsContainer, &CmcStartRotationContainer); + + return NewHandInterpolator(Outer, MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl)); +} + USGHandInterpolator* USGHandInterpolator::Default(UObject* Outer, const bool bRightHanded) { FSGIC_FSGHandInterpolatorImpl OutHandInterpolatorImplContainer; @@ -298,6 +331,27 @@ USGHandInterpolator::USGHandInterpolator(const TArraySyncUProperties(); } +USGHandInterpolator::USGHandInterpolator(const TArray>& JointInterpolations, + const FRotator& CmcStartRotation) + : +#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) + Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) +#else + Pimpl(TUniquePtr(new FImpl{this})) +#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */ +{ + FSGIC_FSGHandInterpolatorImpl OutHandInterpolatorImplContainer; + FSGIC_TArray_TArray_FSGInterpolationSetImpl JointInterpolationsContainer{ + FSGArrayUtils::ToImplType(JointInterpolations)}; + FSGIC_FQuat CmcStartRotationContainer{CmcStartRotation.Quaternion()}; + SGCoreImpl_FSGHandInterpolatorImpl_ctor_JointInterpolations_CmcStartRotation( + &OutHandInterpolatorImplContainer, &JointInterpolationsContainer, &CmcStartRotationContainer); + + Pimpl->HandInterpolatorImpl = MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl); + Pimpl->SyncUProperties(); +} + USGHandInterpolator::USGHandInterpolator(const TArray& JointInterpolations, const FQuat& CmcStartRotation) : @@ -322,6 +376,30 @@ USGHandInterpolator::USGHandInterpolator(const TArray& Pimpl->SyncUProperties(); } +USGHandInterpolator::USGHandInterpolator(const TArray& JointInterpolations, + const FRotator& CmcStartRotation) + : +#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) + Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) +#else + Pimpl(TUniquePtr(new FImpl{this})) +#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */ +{ + FSGIC_FSGHandInterpolatorImpl OutHandInterpolatorImplContainer; + FSGIC_TArray_TArray_FSGInterpolationSetImpl JointInterpolationsContainer{ + FSGArrayUtils::ToImplType< + USGInterpolationSet, FSGInterpolationSetImpl, + &USGInterpolationSet::ToInterpolationSetImpl, + FSGInterpolationSetArray, &FSGInterpolationSetArray::InterpolationSetArray>( + JointInterpolations)}; + FSGIC_FQuat CmcStartRotationContainer{CmcStartRotation.Quaternion()}; + SGCoreImpl_FSGHandInterpolatorImpl_ctor_JointInterpolations_CmcStartRotation( + &OutHandInterpolatorImplContainer, &JointInterpolationsContainer, &CmcStartRotationContainer); + + Pimpl->HandInterpolatorImpl = MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl); + Pimpl->SyncUProperties(); +} + USGHandInterpolator::USGHandInterpolator(const FSGHandInterpolatorImpl& HandInterpolatorImpl) : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) @@ -365,7 +443,7 @@ TArray> USGHandInterpolator::GetJointInterpolations return JointInterpolations; } -FQuat USGHandInterpolator::GetCmcStartRotation() const +FQuat USGHandInterpolator::GetCmcStartRotationQ() const { FSGIC_FSGHandInterpolatorImpl InstanceContainer{ToHandInterpolatorImpl()}; FSGIC_FQuat OutRotationContainer; @@ -373,6 +451,14 @@ FQuat USGHandInterpolator::GetCmcStartRotation() const return MoveTemp(OutRotationContainer.Quat); } +FRotator USGHandInterpolator::GetCmcStartRotation() const +{ + FSGIC_FSGHandInterpolatorImpl InstanceContainer{ToHandInterpolatorImpl()}; + FSGIC_FQuat OutRotationContainer; + SGCoreImpl_FSGHandInterpolatorImpl_GetCmcStartRotation(&InstanceContainer, &OutRotationContainer); + return OutRotationContainer.Quat.Rotator(); +} + float USGHandInterpolator::CalculateAngle(const ESGFinger Finger, const int32 Movement, const float Value) const { Pimpl->SyncImplObject(); diff --git a/Source/SenseGloveCore/Private/SGCore/SGHandPose.cpp b/Source/SenseGloveCore/Private/SGCore/SGHandPose.cpp index b3c48c0d..028df949 100644 --- a/Source/SenseGloveCore/Private/SGCore/SGHandPose.cpp +++ b/Source/SenseGloveCore/Private/SGCore/SGHandPose.cpp @@ -36,6 +36,7 @@ #include "SGCore/SGHandPose.h" #include "Runtime/Launch/Resources/Version.h" +#include "SGCore/SGRotatorArray.h" #include "SGCoreImpl/SGExportedFunctions.h" #include "SGCoreImpl/SGHandPoseImpl.h" @@ -114,6 +115,23 @@ USGHandPose* USGHandPose::NewHandPose( return NewHandPose(Outer, MoveTemp(OutHandPoseImplContainer.HandPoseImpl)); } +USGHandPose* USGHandPose::NewHandPose( + UObject* Outer, + const bool bRightHanded, + const TArray>& JointPositions, const TArray>& JointRotations, + const TArray>& HandAngles) +{ + FSGIC_FSGHandPoseImpl OutHandPoseImplContainer; + FSGIC_TArray_TArray_FVector JointPositionsContainer{JointPositions}; + FSGIC_TArray_TArray_FQuat JointRotationsContainer{FSGArrayUtils::RotatorsToQuats(JointRotations)}; + FSGIC_TArray_TArray_FVector HandAnglesContainer{HandAngles}; + SGCoreImpl_FSGHandPoseImpl_ctor_bRightHanded_JointPositions_JointRotations_HandAngles( + &OutHandPoseImplContainer, bRightHanded, &JointPositionsContainer, + &JointRotationsContainer, &HandAnglesContainer); + + return NewHandPose(Outer, MoveTemp(OutHandPoseImplContainer.HandPoseImpl)); +} + USGHandPose* USGHandPose::NewHandPose( UObject* Outer, const bool bRightHanded, const TArray& JointPositions, const TArray& JointRotations, @@ -136,6 +154,29 @@ USGHandPose* USGHandPose::NewHandPose( return NewHandPose(Outer, MoveTemp(OutHandPoseImplContainer.HandPoseImpl)); } +USGHandPose* USGHandPose::NewHandPose( + UObject* Outer, + const bool bRightHanded, + const TArray& JointPositions, const TArray& JointRotations, + const TArray& HandAngles) +{ + FSGIC_FSGHandPoseImpl OutHandPoseImplContainer; + FSGIC_TArray_TArray_FVector JointPositionsContainer{ + FSGArrayUtils::FromBPNestedArray(JointPositions) + }; + FSGIC_TArray_TArray_FQuat JointRotationsContainer{ + FSGArrayUtils::RotatorsToQuats(JointRotations) + }; + FSGIC_TArray_TArray_FVector HandAnglesContainer{ + FSGArrayUtils::FromBPNestedArray(HandAngles) + }; + SGCoreImpl_FSGHandPoseImpl_ctor_bRightHanded_JointPositions_JointRotations_HandAngles( + &OutHandPoseImplContainer, bRightHanded, &JointPositionsContainer, + &JointRotationsContainer, &HandAnglesContainer); + + return NewHandPose(Outer, MoveTemp(OutHandPoseImplContainer.HandPoseImpl)); +} + USGHandPose* USGHandPose::Deserialize(UObject* Outer, const FString& SerializedString) { FSGIC_FSGHandPoseImpl OutHandPoseImplContainer; @@ -256,8 +297,9 @@ USGHandPose::USGHandPose() Pimpl->SyncUProperties(); } -USGHandPose::USGHandPose(const bool bRightHanded, const TArray>& JointPositions, - const TArray>& JointRotations, const TArray>& HandAngles) +USGHandPose::USGHandPose(const bool bRightHanded, + const TArray>& JointPositions, const TArray>& JointRotations, + const TArray>& HandAngles) : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) @@ -277,8 +319,31 @@ USGHandPose::USGHandPose(const bool bRightHanded, const TArray>& Pimpl->SyncUProperties(); } -USGHandPose::USGHandPose(const bool bRightHanded, const TArray& JointPositions, - const TArray& JointRotations, const TArray& HandAngles) +USGHandPose::USGHandPose(const bool bRightHanded, + const TArray>& JointPositions, const TArray>& JointRotations, + const TArray>& HandAngles) + : +#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) + Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) +#else + Pimpl(TUniquePtr(new FImpl{this})) +#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */ +{ + FSGIC_FSGHandPoseImpl OutHandPoseImplContainer; + FSGIC_TArray_TArray_FVector JointPositionsContainer{JointPositions}; + FSGIC_TArray_TArray_FQuat JointRotationsContainer{FSGArrayUtils::RotatorsToQuats(JointRotations)}; + FSGIC_TArray_TArray_FVector HandAnglesContainer{HandAngles}; + SGCoreImpl_FSGHandPoseImpl_ctor_bRightHanded_JointPositions_JointRotations_HandAngles( + &OutHandPoseImplContainer, bRightHanded, &JointPositionsContainer, + &JointRotationsContainer, &HandAnglesContainer); + + Pimpl->HandPoseImpl = MoveTemp(OutHandPoseImplContainer.HandPoseImpl); + Pimpl->SyncUProperties(); +} + +USGHandPose::USGHandPose(const bool bRightHanded, const + TArray& JointPositions, const TArray& JointRotations, + const TArray& HandAngles) : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) @@ -304,6 +369,34 @@ USGHandPose::USGHandPose(const bool bRightHanded, const TArray& Pimpl->SyncUProperties(); } +USGHandPose::USGHandPose(const bool bRightHanded, + const TArray& JointPositions, const TArray& JointRotations, + const TArray& HandAngles) + : +#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) + Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) +#else + Pimpl(TUniquePtr(new FImpl{this})) +#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */ +{ + FSGIC_FSGHandPoseImpl OutHandPoseImplContainer; + FSGIC_TArray_TArray_FVector JointPositionsContainer{ + FSGArrayUtils::FromBPNestedArray(JointPositions) + }; + FSGIC_TArray_TArray_FQuat JointRotationsContainer{ + FSGArrayUtils::RotatorsToQuats(JointRotations) + }; + FSGIC_TArray_TArray_FVector HandAnglesContainer{ + FSGArrayUtils::FromBPNestedArray(HandAngles) + }; + SGCoreImpl_FSGHandPoseImpl_ctor_bRightHanded_JointPositions_JointRotations_HandAngles( + &OutHandPoseImplContainer, bRightHanded, &JointPositionsContainer, + &JointRotationsContainer, &HandAnglesContainer); + + Pimpl->HandPoseImpl = MoveTemp(OutHandPoseImplContainer.HandPoseImpl); + Pimpl->SyncUProperties(); +} + USGHandPose::USGHandPose(const FSGHandPoseImpl& HandPoseImpl) : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) @@ -346,7 +439,7 @@ TArray> USGHandPose::GetJointPositions() const return MoveTemp(OutPositionsContainer.Array); } -TArray> USGHandPose::GetJointRotations() const +TArray> USGHandPose::GetJointRotationsQ() const { FSGIC_FSGHandPoseImpl InstanceContainer{ToHandPoseImpl()}; FSGIC_TArray_TArray_FQuat OutRotationsContainer; @@ -354,6 +447,14 @@ TArray> USGHandPose::GetJointRotations() const return MoveTemp(OutRotationsContainer.Array); } +TArray> USGHandPose::GetJointRotations() const +{ + FSGIC_FSGHandPoseImpl InstanceContainer{ToHandPoseImpl()}; + FSGIC_TArray_TArray_FQuat OutRotationsContainer; + SGCoreImpl_FSGHandPoseImpl_GetJointRotations(&InstanceContainer, &OutRotationsContainer); + return FSGArrayUtils::QuatsToRotators(OutRotationsContainer.Array); +} + TArray> USGHandPose::GetHandAngles() const { FSGIC_FSGHandPoseImpl InstanceContainer{ToHandPoseImpl()}; diff --git a/Source/SenseGloveCore/Private/SGCore/SGHapticGlove.cpp b/Source/SenseGloveCore/Private/SGCore/SGHapticGlove.cpp index fe2f101a..b88cd2f1 100644 --- a/Source/SenseGloveCore/Private/SGCore/SGHapticGlove.cpp +++ b/Source/SenseGloveCore/Private/SGCore/SGHapticGlove.cpp @@ -349,6 +349,24 @@ bool USGHapticGlove::GetImuRotation(FQuat& OutImu) return bResult; } +bool USGHapticGlove::GetImuRotation(FRotator& OutImu) +{ + SyncImplObject(); + + FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; + FSGIC_FQuat OutImuContainer; + const bool bResult = SGCoreImpl_FSGHapticGloveImpl_GetImuRotation(&InstanceContainer, &OutImuContainer); + + SyncUProperties(); + + if (bResult) + { + OutImu = OutImuContainer.Quat.Rotator(); + } + + return bResult; +} + bool USGHapticGlove::GetHandPose( UObject* Outer, const USGBasicHandModel* HandGeometry, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose) @@ -628,6 +646,28 @@ void USGHapticGlove::GetWristLocation(const FVector& ReferencePosition, const FQ OutWristRotation = MoveTemp(OutWristRotationContainer.Quat); } +void USGHapticGlove::GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + const ESGPositionalTrackingHardware TrackingHardware, + FVector& OutWristPosition, FRotator& OutWristRotation) const +{ + SyncImplObject(); + + FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; + FSGIC_FVector ReferencePositionContainer{ReferencePosition}; + FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()}; + FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware}; + FSGIC_FVector OutWristPositionContainer; + FSGIC_FQuat OutWristRotationContainer; + SGCoreImpl_FSGHapticGloveImpl_GetWristLocation( + &InstanceContainer, + &ReferencePositionContainer, &ReferenceRotationContainer, + &TrackingHardwareContainer, + &OutWristPositionContainer, &OutWristRotationContainer); + + OutWristPosition = MoveTemp(OutWristPositionContainer.Vector); + OutWristRotation = OutWristRotationContainer.Quat.Rotator(); +} + void USGHapticGlove::GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, const ESGPositionalTrackingHardware TrackingHardware, FVector& OutGlovePosition, FQuat& OutGloveRotation) const @@ -651,6 +691,29 @@ void USGHapticGlove::GetGloveLocation(const FVector& ReferencePosition, const FQ OutGloveRotation = MoveTemp(OutGloveRotationContainer.Quat); } +void USGHapticGlove::GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + const ESGPositionalTrackingHardware TrackingHardware, + FVector& OutGlovePosition, FRotator& OutGloveRotation) const +{ + SyncImplObject(); + + FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; + FSGIC_FVector ReferencePositionContainer{ReferencePosition}; + FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()}; + FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware}; + FSGIC_FVector OutGlovePositionContainer; + FSGIC_FQuat OutGloveRotationContainer; + + SGCoreImpl_FSGHapticGloveImpl_GetGloveLocation( + &InstanceContainer, + &ReferencePositionContainer, &ReferenceRotationContainer, + &TrackingHardwareContainer, + &OutGlovePositionContainer, &OutGloveRotationContainer); + + OutGlovePosition = MoveTemp(OutGlovePositionContainer.Vector); + OutGloveRotation = OutGloveRotationContainer.Quat.Rotator(); +} + USGHapticGlove::FImpl::FImpl(USGHapticGlove* InOwner) : Owner(InOwner) { diff --git a/Source/SenseGloveCore/Private/SGCore/SGJointKinematics.cpp b/Source/SenseGloveCore/Private/SGCore/SGJointKinematics.cpp index b4daebf3..66bb1a07 100644 --- a/Source/SenseGloveCore/Private/SGCore/SGJointKinematics.cpp +++ b/Source/SenseGloveCore/Private/SGCore/SGJointKinematics.cpp @@ -54,14 +54,42 @@ bool FSGJointKinematics::ForwardKinematics( FSGIC_TArray_FVector JointAnglesContainer{JointAngles}; FSGIC_TArray_FVector OutNewPositionsContainer; FSGIC_TArray_FQuat OutNewRotationsContainer; - return + + const bool bResult = SGCoreImpl_FSGJointKinematicsImpl_ForwardKinematics_StartPosition_StartRotation_JointLengths_JointAngles_OutNewPositions_OutNewRotations( &StartPositionContainer, &StartRotationContainer, &JointLengthsContainer, &JointAnglesContainer, &OutNewPositionsContainer, &OutNewRotationsContainer); + + OutNewPositions = MoveTemp(OutNewPositionsContainer.Array); + OutNewRotations = MoveTemp(OutNewRotationsContainer.Array); + + return bResult; } bool FSGJointKinematics::ForwardKinematics( - const USGBasicHandModel* Profile, ESGFinger Finger, const TArray& JointAngles, + const FVector& StartPosition, const FRotator& StartRotation, const TArray& JointLengths, + const TArray& JointAngles, TArray& OutNewPositions, TArray& OutNewRotations) +{ + FSGIC_FVector StartPositionContainer{StartPosition}; + FSGIC_FQuat StartRotationContainer{StartRotation.Quaternion()}; + FSGIC_TArray_FVector JointLengthsContainer{JointLengths}; + FSGIC_TArray_FVector JointAnglesContainer{JointAngles}; + FSGIC_TArray_FVector OutNewPositionsContainer; + FSGIC_TArray_FQuat OutNewRotationsContainer; + + const bool bResult = + SGCoreImpl_FSGJointKinematicsImpl_ForwardKinematics_StartPosition_StartRotation_JointLengths_JointAngles_OutNewPositions_OutNewRotations( + &StartPositionContainer, &StartRotationContainer, &JointLengthsContainer, &JointAnglesContainer, + &OutNewPositionsContainer, &OutNewRotationsContainer); + + OutNewPositions = MoveTemp(OutNewPositionsContainer.Array); + OutNewRotations = FSGArrayUtils::QuatsToRotators(OutNewRotationsContainer.Array); + + return bResult; +} + +bool FSGJointKinematics::ForwardKinematics( + const USGBasicHandModel* Profile, const ESGFinger Finger, const TArray& JointAngles, TArray& OutNewPositions, TArray& OutNewRotations) { FSGIC_FSGBasicHandModelImpl ProfileContainer{Profile->ToBasicHandModelImpl()}; @@ -69,7 +97,35 @@ bool FSGJointKinematics::ForwardKinematics( FSGIC_TArray_FVector JointAnglesContainer{JointAngles}; FSGIC_TArray_FVector OutNewPositionsContainer; FSGIC_TArray_FQuat OutNewRotationsContainer; - return + + const bool bResult = SGCoreImpl_FSGJointKinematicsImpl_ForwardKinematics_Profile_Finger_JointAngles_OutNewPositions_OutNewRotations( - &ProfileContainer, &FingerContainer, &JointAnglesContainer, &OutNewPositions, &OutNewRotations); + &ProfileContainer, &FingerContainer, &JointAnglesContainer, + &OutNewPositionsContainer, &OutNewRotationsContainer); + + OutNewPositions = MoveTemp(OutNewPositionsContainer.Array); + OutNewRotations = MoveTemp(OutNewRotationsContainer.Array); + + return bResult; +} + +bool FSGJointKinematics::ForwardKinematics( + const USGBasicHandModel* Profile, const ESGFinger Finger, const TArray& JointAngles, + TArray& OutNewPositions, TArray& OutNewRotations) +{ + FSGIC_FSGBasicHandModelImpl ProfileContainer{Profile->ToBasicHandModelImpl()}; + FSGIC_ESGFinger FingerContainer{Finger}; + FSGIC_TArray_FVector JointAnglesContainer{JointAngles}; + FSGIC_TArray_FVector OutNewPositionsContainer; + FSGIC_TArray_FQuat OutNewRotationsContainer; + + const bool bResult = + SGCoreImpl_FSGJointKinematicsImpl_ForwardKinematics_Profile_Finger_JointAngles_OutNewPositions_OutNewRotations( + &ProfileContainer, &FingerContainer, &JointAnglesContainer, + &OutNewPositionsContainer, &OutNewRotationsContainer); + + OutNewPositions = MoveTemp(OutNewPositionsContainer.Array); + OutNewRotations = FSGArrayUtils::QuatsToRotators(OutNewRotationsContainer.Array); + + return bResult; } \ No newline at end of file diff --git a/Source/SenseGloveCore/Private/SGCore/SGNovaGlove.cpp b/Source/SenseGloveCore/Private/SGCore/SGNovaGlove.cpp index 58954a04..711e9a5e 100644 --- a/Source/SenseGloveCore/Private/SGCore/SGNovaGlove.cpp +++ b/Source/SenseGloveCore/Private/SGCore/SGNovaGlove.cpp @@ -247,6 +247,25 @@ void USGNovaGlove::CalculateGloveLocation(const FVector& ReferencePosition, cons OutGloveRotation = MoveTemp(OutGloveRotationContainer.Quat); } +void USGNovaGlove::CalculateGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded, + FVector& OutGlovePosition, FRotator& OutGloveRotation) +{ + FSGIC_FVector ReferencePositionContainer{ReferencePosition}; + FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()}; + FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware}; + FSGIC_FVector OutGlovePositionContainer; + FSGIC_FQuat OutGloveRotationContainer; + + SGCoreImpl_FSGNovaGloveImpl_CalculateGloveLocation( + &ReferencePositionContainer, &ReferenceRotationContainer, + &TrackingHardwareContainer, bRightHanded, + &OutGlovePositionContainer, &OutGloveRotationContainer); + + OutGlovePosition = MoveTemp(OutGlovePositionContainer.Vector); + OutGloveRotation = OutGloveRotationContainer.Quat.Rotator(); +} + void USGNovaGlove::CalculateWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded, FVector& OutWristPosition, FQuat& OutWristRotation) @@ -266,6 +285,25 @@ void USGNovaGlove::CalculateWristLocation(const FVector& ReferencePosition, cons OutWristRotation = MoveTemp(OutWristRotationContainer.Quat); } +void USGNovaGlove::CalculateWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded, + FVector& OutWristPosition, FRotator& OutWristRotation) +{ + FSGIC_FVector ReferencePositionContainer{ReferencePosition}; + FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()}; + FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware}; + FSGIC_FVector OutWristPositionContainer; + FSGIC_FQuat OutWristRotationContainer; + + SGCoreImpl_FSGNovaGloveImpl_CalculateWristLocation( + &ReferencePositionContainer, &ReferenceRotationContainer, + &TrackingHardwareContainer, bRightHanded, + &OutWristPositionContainer, &OutWristRotationContainer); + + OutWristPosition = MoveTemp(OutWristPositionContainer.Vector); + OutWristRotation = OutWristRotationContainer.Quat.Rotator(); +} + FString USGNovaGlove::ToBytes(const USGThumperCommand* ThumperCommand) { FSGIC_FSGThumperCommandImpl ThumperCommandContainer{ThumperCommand->ToThumperCommandImpl()}; @@ -521,6 +559,24 @@ bool USGNovaGlove::GetImuRotation(FQuat& OutImu) return bResult; } +bool USGNovaGlove::GetImuRotation(FRotator& OutImu) +{ + SyncImplObject(); + + FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()}; + FSGIC_FQuat OutImuContainer; + const bool bResult = SGCoreImpl_FSGNovaGloveImpl_GetImuRotation(&InstanceContainer, &OutImuContainer); + + SyncUProperties(); + + if (bResult) + { + OutImu = OutImuContainer.Quat.Rotator(); + } + + return bResult; +} + bool USGNovaGlove::GetHandPose( UObject* Outer, const USGBasicHandModel* HandModel, const USGNovaGloveHandProfile* Profile, USGHandPose*& OutHandPose) @@ -700,6 +756,29 @@ void USGNovaGlove::GetGloveLocation(const FVector& ReferencePosition, const FQua OutGloveRotation = MoveTemp(OutGloveRotationContainer.Quat); } +void USGNovaGlove::GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + const ESGPositionalTrackingHardware TrackingHardware, + FVector& OutGlovePosition, FRotator& OutGloveRotation) const +{ + SyncImplObject(); + + FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()}; + FSGIC_FVector ReferencePositionContainer{ReferencePosition}; + FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()}; + FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware}; + FSGIC_FVector OutGlovePositionContainer; + FSGIC_FQuat OutGloveRotationContainer; + + SGCoreImpl_FSGNovaGloveImpl_GetGloveLocation( + &InstanceContainer, + &ReferencePositionContainer, &ReferenceRotationContainer, + &TrackingHardwareContainer, + &OutGlovePositionContainer, &OutGloveRotationContainer); + + OutGlovePosition = MoveTemp(OutGlovePositionContainer.Vector); + OutGloveRotation = OutGloveRotationContainer.Quat.Rotator(); +} + void USGNovaGlove::GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, const ESGPositionalTrackingHardware TrackingHardware, FVector& OutWristPosition, FQuat& OutWristRotation) const @@ -722,6 +801,28 @@ void USGNovaGlove::GetWristLocation(const FVector& ReferencePosition, const FQua OutWristRotation = MoveTemp(OutWristRotationContainer.Quat); } +void USGNovaGlove::GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + const ESGPositionalTrackingHardware TrackingHardware, + FVector& OutWristPosition, FRotator& OutWristRotation) const +{ + SyncImplObject(); + + FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()}; + FSGIC_FVector ReferencePositionContainer{ReferencePosition}; + FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()}; + FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware}; + FSGIC_FVector OutWristPositionContainer; + FSGIC_FQuat OutWristRotationContainer; + SGCoreImpl_FSGNovaGloveImpl_GetWristLocation( + &InstanceContainer, + &ReferencePositionContainer, &ReferenceRotationContainer, + &TrackingHardwareContainer, + &OutWristPositionContainer, &OutWristRotationContainer); + + OutWristPosition = MoveTemp(OutWristPositionContainer.Vector); + OutWristRotation = OutWristRotationContainer.Quat.Rotator(); +} + FString USGNovaGlove::ToString() const { SyncImplObject(); diff --git a/Source/SenseGloveCore/Private/SGCore/SGNovaGloveSensorData.cpp b/Source/SenseGloveCore/Private/SGCore/SGNovaGloveSensorData.cpp index 8d805b75..3038a4c5 100644 --- a/Source/SenseGloveCore/Private/SGCore/SGNovaGloveSensorData.cpp +++ b/Source/SenseGloveCore/Private/SGCore/SGNovaGloveSensorData.cpp @@ -111,6 +111,20 @@ USGNovaGloveSensorData* USGNovaGloveSensorData::NewNovaGloveSensorData( return NewNovaGloveSensorData(Outer, MoveTemp(OutNovaGloveSensorDataImplContainer.NovaGloveSensorDataImpl)); } +USGNovaGloveSensorData* USGNovaGloveSensorData::NewNovaGloveSensorData( + UObject* Outer, const TArray& Values, const int32 ParsedValues, + const FRotator& ImuRotation, const bool bImuParsed, const float BatteryLevel, const bool bCharging) +{ + FSGIC_FSGNovaGloveSensorDataImpl OutNovaGloveSensorDataImplContainer; + FSGIC_TArray_FVector ValuesContainer{Values}; + FSGIC_FQuat ImuRotationContainer{ImuRotation.Quaternion()}; + SGCoreImpl_FSGNovaGloveSensorDataImpl_ctor_Values_ParsedValues_ImuRotation_bImuParsed_BatteryLevel_bCharging( + &OutNovaGloveSensorDataImplContainer, &ValuesContainer, ParsedValues, + &ImuRotationContainer, bImuParsed, BatteryLevel, bCharging); + + return NewNovaGloveSensorData(Outer, MoveTemp(OutNovaGloveSensorDataImplContainer.NovaGloveSensorDataImpl)); +} + USGNovaGloveSensorData* USGNovaGloveSensorData::Empty(UObject* Outer) { FSGIC_FSGNovaGloveSensorDataImpl OutNovaGloveSensorDataImplContainer; @@ -176,6 +190,27 @@ USGNovaGloveSensorData::USGNovaGloveSensorData(const TArray& Values, co Pimpl->SyncUProperties(); } +USGNovaGloveSensorData::USGNovaGloveSensorData(const TArray& Values, const int32 ParsedValues, + const FRotator& ImuRotation, const bool bImuParsed, + const float BatteryLevel, const bool bCharging) + : +#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) + Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) +#else + Pimpl(TUniquePtr(new FImpl{this})) +#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */ +{ + FSGIC_FSGNovaGloveSensorDataImpl OutNovaGloveSensorDataImplContainer; + FSGIC_TArray_FVector ValuesContainer{Values}; + FSGIC_FQuat ImuRotationContainer{ImuRotation.Quaternion()}; + SGCoreImpl_FSGNovaGloveSensorDataImpl_ctor_Values_ParsedValues_ImuRotation_bImuParsed_BatteryLevel_bCharging( + &OutNovaGloveSensorDataImplContainer, &ValuesContainer, ParsedValues, + &ImuRotationContainer, bImuParsed, BatteryLevel, bCharging); + + Pimpl->NovaGloveSensorDataImpl = MoveTemp(OutNovaGloveSensorDataImplContainer.NovaGloveSensorDataImpl); + Pimpl->SyncUProperties(); +} + USGNovaGloveSensorData::USGNovaGloveSensorData(const FSGNovaGloveSensorDataImpl& NovaGloveSensorDataImpl) : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) @@ -212,7 +247,7 @@ TArray USGNovaGloveSensorData::GetSensorValues() const return MoveTemp(OutValuesContainer.Array); } -FQuat USGNovaGloveSensorData::GetImuRotation() const +FQuat USGNovaGloveSensorData::GetImuRotationQ() const { FSGIC_FSGNovaGloveSensorDataImpl InstanceContainer{ToNovaGloveSensorDataImpl()}; FSGIC_FQuat OutRotationContainer; @@ -220,6 +255,14 @@ FQuat USGNovaGloveSensorData::GetImuRotation() const return MoveTemp(OutRotationContainer.Quat); } +FRotator USGNovaGloveSensorData::GetImuRotation() const +{ + FSGIC_FSGNovaGloveSensorDataImpl InstanceContainer{ToNovaGloveSensorDataImpl()}; + FSGIC_FQuat OutRotationContainer; + SGCoreImpl_FSGNovaGloveSensorDataImpl_GetImuRotation(&InstanceContainer, &OutRotationContainer); + return OutRotationContainer.Quat.Rotator(); +} + int32 USGNovaGloveSensorData::GetParsedValues() const { FSGIC_FSGNovaGloveSensorDataImpl InstanceContainer{ToNovaGloveSensorDataImpl()}; diff --git a/Source/SenseGloveCore/Private/SGCore/SGRotatorArray.cpp b/Source/SenseGloveCore/Private/SGCore/SGRotatorArray.cpp new file mode 100644 index 00000000..3254e380 --- /dev/null +++ b/Source/SenseGloveCore/Private/SGCore/SGRotatorArray.cpp @@ -0,0 +1,36 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @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 "SGCore/SGRotatorArray.h" \ No newline at end of file diff --git a/Source/SenseGloveCore/Private/SGCore/SGSenseGlove.cpp b/Source/SenseGloveCore/Private/SGCore/SGSenseGlove.cpp index 7136ceab..52244acc 100644 --- a/Source/SenseGloveCore/Private/SGCore/SGSenseGlove.cpp +++ b/Source/SenseGloveCore/Private/SGCore/SGSenseGlove.cpp @@ -276,6 +276,28 @@ void USGSenseGlove::CalculateGloveLocation(const FVector& ReferencePosition, con OutGloveRotation = MoveTemp(OutGloveRotationContainer.Quat); } +void USGSenseGlove::CalculateGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + const ESGPositionalTrackingHardware TrackingHardware, + const bool bRightHanded, const ESGFinger MountedOn, + FVector& OutGlovePosition, FRotator& OutGloveRotation) +{ + FSGIC_FVector ReferencePositionContainer{ReferencePosition}; + FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()}; + FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware}; + FSGIC_ESGFinger MountedOnContainer{MountedOn}; + FSGIC_FVector OutGlovePositionContainer; + FSGIC_FQuat OutGloveRotationContainer; + + SGCoreImpl_FSGSenseGloveImpl_CalculateGloveLocation( + &ReferencePositionContainer, &ReferenceRotationContainer, + &TrackingHardwareContainer, + bRightHanded, &MountedOnContainer, + &OutGlovePositionContainer, &OutGloveRotationContainer); + + OutGlovePosition = MoveTemp(OutGlovePositionContainer.Vector); + OutGloveRotation = OutGloveRotationContainer.Quat.Rotator(); +} + void USGSenseGlove::CalculateWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded, const ESGFinger MountedOn, @@ -303,6 +325,33 @@ void USGSenseGlove::CalculateWristLocation(const FVector& ReferencePosition, con OutWristRotation = MoveTemp(OutWristRotationContainer.Quat); } +void USGSenseGlove::CalculateWristLocation(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) +{ + FSGIC_FVector ReferencePositionContainer{ReferencePosition}; + FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()}; + FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware}; + FSGIC_ESGFinger MountedOnContainer{MountedOn}; + FSGIC_FVector GloveWristPositionOffsetContainer{GloveWristPositionOffset}; + FSGIC_FQuat GloveWristRotationOffsetContainer{GloveWristRotationOffset.Quaternion()}; + FSGIC_FVector OutWristPositionContainer; + FSGIC_FQuat OutWristRotationContainer; + + SGCoreImpl_FSGSenseGloveImpl_CalculateWristLocation( + &ReferencePositionContainer, &ReferenceRotationContainer, + &TrackingHardwareContainer, + bRightHanded, &MountedOnContainer, + &GloveWristPositionOffsetContainer, &GloveWristRotationOffsetContainer, + &OutWristPositionContainer, &OutWristRotationContainer); + + OutWristPosition = MoveTemp(OutWristPositionContainer.Vector); + OutWristRotation = OutWristRotationContainer.Quat.Rotator(); +} + USGSenseGlove::USGSenseGlove() : USGHapticGlove(), #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) @@ -520,6 +569,24 @@ bool USGSenseGlove::GetImuRotation(FQuat& OutImu) return bResult; } +bool USGSenseGlove::GetImuRotation(FRotator& OutImu) +{ + SyncImplObject(); + + FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()}; + FSGIC_FQuat OutImuContainer; + const bool bResult = SGCoreImpl_FSGSenseGloveImpl_GetImuRotation(&InstanceContainer, &OutImuContainer); + + SyncUProperties(); + + if (bResult) + { + OutImu = OutImuContainer.Quat.Rotator(); + } + + return bResult; +} + bool USGSenseGlove::GetGlovePose(UObject* Outer, USGSenseGlovePose*& OutGlovePose) { SyncImplObject(); @@ -738,6 +805,29 @@ void USGSenseGlove::GetGloveLocation(const FVector& ReferencePosition, const FQu OutGloveRotation = MoveTemp(OutGloveRotationContainer.Quat); } +void USGSenseGlove::GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + const ESGPositionalTrackingHardware TrackingHardware, + FVector& OutGlovePosition, FRotator& OutGloveRotation) const +{ + SyncImplObject(); + + FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()}; + FSGIC_FVector ReferencePositionContainer{ReferencePosition}; + FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()}; + FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware}; + FSGIC_FVector OutGlovePositionContainer; + FSGIC_FQuat OutGloveRotationContainer; + + SGCoreImpl_FSGSenseGloveImpl_GetGloveLocation_ReferencePosition_ReferenceRotation_TrackingHardware_OutGlovePosition_OutGloveRotation( + &InstanceContainer, + &ReferencePositionContainer, &ReferenceRotationContainer, + &TrackingHardwareContainer, + &OutGlovePositionContainer, &OutGloveRotationContainer); + + OutGlovePosition = MoveTemp(OutGlovePositionContainer.Vector); + OutGloveRotation = OutGloveRotationContainer.Quat.Rotator(); +} + void USGSenseGlove::GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, const ESGPositionalTrackingHardware TrackingHardware, const ESGFinger MountedOn, FVector& OutGlovePosition, FQuat& OutGloveRotation) const @@ -762,6 +852,30 @@ void USGSenseGlove::GetGloveLocation(const FVector& ReferencePosition, const FQu OutGloveRotation = MoveTemp(OutGloveRotationContainer.Quat); } +void USGSenseGlove::GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + const ESGPositionalTrackingHardware TrackingHardware, const ESGFinger MountedOn, + FVector& OutGlovePosition, FRotator& OutGloveRotation) const +{ + SyncImplObject(); + + FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()}; + FSGIC_FVector ReferencePositionContainer{ReferencePosition}; + FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()}; + FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware}; + FSGIC_ESGFinger MountedOnContainer{MountedOn}; + FSGIC_FVector OutGlovePositionContainer; + FSGIC_FQuat OutGloveRotationContainer; + + SGCoreImpl_FSGSenseGloveImpl_GetGloveLocation_ReferencePosition_ReferenceRotation_TrackingHardware_MountedOn_OutGlovePosition_OutGloveRotation( + &InstanceContainer, + &ReferencePositionContainer, &ReferenceRotationContainer, + &TrackingHardwareContainer, &MountedOnContainer, + &OutGlovePositionContainer, &OutGloveRotationContainer); + + OutGlovePosition = MoveTemp(OutGlovePositionContainer.Vector); + OutGloveRotation = OutGloveRotationContainer.Quat.Rotator(); +} + void USGSenseGlove::GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, const ESGPositionalTrackingHardware TrackingHardware, FVector& OutWristPosition, FQuat& OutWristRotation) const @@ -784,6 +898,28 @@ void USGSenseGlove::GetWristLocation(const FVector& ReferencePosition, const FQu OutWristRotation = MoveTemp(OutWristRotationContainer.Quat); } +void USGSenseGlove::GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + const ESGPositionalTrackingHardware TrackingHardware, + FVector& OutWristPosition, FRotator& OutWristRotation) const +{ + SyncImplObject(); + + FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()}; + FSGIC_FVector ReferencePositionContainer{ReferencePosition}; + FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()}; + FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware}; + FSGIC_FVector OutWristPositionContainer; + FSGIC_FQuat OutWristRotationContainer; + SGCoreImpl_FSGSenseGloveImpl_GetWristLocation_ReferencePosition_ReferenceRotation_TrackingHardware_OutWristPosition_OutWristRotation( + &InstanceContainer, + &ReferencePositionContainer, &ReferenceRotationContainer, + &TrackingHardwareContainer, + &OutWristPositionContainer, &OutWristRotationContainer); + + OutWristPosition = MoveTemp(OutWristPositionContainer.Vector); + OutWristRotation = OutWristRotationContainer.Quat.Rotator(); +} + void USGSenseGlove::GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, const ESGPositionalTrackingHardware TrackingHardware, const FVector& GloveWristPositionOffset, @@ -811,6 +947,33 @@ void USGSenseGlove::GetWristLocation(const FVector& ReferencePosition, const FQu OutWristRotation = MoveTemp(OutWristRotationContainer.Quat); } +void USGSenseGlove::GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + const ESGPositionalTrackingHardware TrackingHardware, + const FVector& GloveWristPositionOffset, + const FRotator& GloveWristRotationOffset, + FVector& OutWristPosition, FRotator& OutWristRotation) const +{ + SyncImplObject(); + + FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()}; + FSGIC_FVector ReferencePositionContainer{ReferencePosition}; + FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()}; + FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware}; + FSGIC_FVector GloveWristPositionOffsetContainer{GloveWristPositionOffset}; + FSGIC_FQuat GloveWristRotationOffsetContainer{GloveWristRotationOffset.Quaternion()}; + FSGIC_FVector OutWristPositionContainer; + FSGIC_FQuat OutWristRotationContainer; + SGCoreImpl_FSGSenseGloveImpl_GetWristLocation_ReferencePosition_ReferenceRotation_TrackingHardware_GloveWristPositionOffset_GloveWristRotationOffset_OutWristPosition_OutWristRotation( + &InstanceContainer, + &ReferencePositionContainer, &ReferenceRotationContainer, + &TrackingHardwareContainer, + &GloveWristPositionOffsetContainer, &GloveWristRotationOffsetContainer, + &OutWristPositionContainer, &OutWristRotationContainer); + + OutWristPosition = MoveTemp(OutWristPositionContainer.Vector); + OutWristRotation = OutWristRotationContainer.Quat.Rotator(); +} + FString USGSenseGlove::ToString() const { SyncImplObject(); diff --git a/Source/SenseGloveCore/Private/SGCore/SGSenseGloveInfo.cpp b/Source/SenseGloveCore/Private/SGCore/SGSenseGloveInfo.cpp index 8dd36717..645a8d85 100644 --- a/Source/SenseGloveCore/Private/SGCore/SGSenseGloveInfo.cpp +++ b/Source/SenseGloveCore/Private/SGCore/SGSenseGloveInfo.cpp @@ -101,9 +101,9 @@ USGSenseGloveInfo* USGSenseGloveInfo::NewSenseGloveInfo(UObject* Outer) } USGSenseGloveInfo* USGSenseGloveInfo::NewSenseGloveInfo(UObject* Outer, const FString& DeviceId, - const FString& HardwareVersion, int32 FirmwareVersion, - int32 SubFirmwareVersion, bool bRightHanded, - int32 NumberOfSensors, const FQuat& ImuCorrection, + const FString& HardwareVersion, const int32 FirmwareVersion, + const int32 SubFirmwareVersion, const bool bRightHanded, + const int32 NumberOfSensors, const FQuat& ImuCorrection, const TArray& StartPositions, const TArray& StartRotations, const TArray>& GloveLengths, @@ -128,9 +128,36 @@ USGSenseGloveInfo* USGSenseGloveInfo::NewSenseGloveInfo(UObject* Outer, const FS } USGSenseGloveInfo* USGSenseGloveInfo::NewSenseGloveInfo(UObject* Outer, const FString& DeviceId, - const FString& HardwareVersion, int32 FirmwareVersion, - int32 SubFirmwareVersion, bool bRightHanded, - int32 NumberOfSensors, const FQuat& ImuCorrection, + const FString& HardwareVersion, const int32 FirmwareVersion, + const int32 SubFirmwareVersion, const bool bRightHanded, + const int32 NumberOfSensors, const FRotator& ImuCorrection, + const TArray& StartPositions, + const TArray& StartRotations, + const TArray>& GloveLengths, + const TArray& Functions) +{ + FSGIC_FSGSenseGloveInfoImpl OutSenseGloveInfoImplContainer; + FSGIC_FString DeviceIdContainer{DeviceId}; + FSGIC_FString HardwareVersionContainer{HardwareVersion}; + FSGIC_FQuat ImuCorrectionContainer{ImuCorrection.Quaternion()}; + FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; + FSGIC_TArray_FQuat StartRotationsContainer{FSGArrayUtils::RotatorsToQuats(StartRotations)}; + FSGIC_TArray_TArray_FVector GloveLengthsContainer{GloveLengths}; + FSGIC_TArray_bool FunctionsContainer{Functions}; + SGCoreImpl_FSGSenseGloveInfoImpl_ctor_DeviceId_HardwareVersion_FirmwareVersion_SubFirmwareVersion_bRightHanded_NumberOfSensors_ImuCorrection_StartPositions_StartRotations_GloveLengths_Functions( + &OutSenseGloveInfoImplContainer, + &DeviceIdContainer, &HardwareVersionContainer, FirmwareVersion, SubFirmwareVersion, + bRightHanded, NumberOfSensors, &ImuCorrectionContainer, + &StartPositionsContainer, &StartRotationsContainer, + &GloveLengthsContainer, &FunctionsContainer); + + return NewSenseGloveInfo(Outer, MoveTemp(OutSenseGloveInfoImplContainer.SenseGloveInfoImpl)); +} + +USGSenseGloveInfo* USGSenseGloveInfo::NewSenseGloveInfo(UObject* Outer, const FString& DeviceId, + const FString& HardwareVersion, const int32 FirmwareVersion, + const int32 SubFirmwareVersion, const bool bRightHanded, + const int32 NumberOfSensors, const FQuat& ImuCorrection, const TArray& StartPositions, const TArray& StartRotations, const TArray& GloveLengths, @@ -156,6 +183,35 @@ USGSenseGloveInfo* USGSenseGloveInfo::NewSenseGloveInfo(UObject* Outer, const FS return NewSenseGloveInfo(Outer, MoveTemp(OutSenseGloveInfoImplContainer.SenseGloveInfoImpl)); } +USGSenseGloveInfo* USGSenseGloveInfo::NewSenseGloveInfo(UObject* Outer, const FString& DeviceId, + const FString& HardwareVersion, const int32 FirmwareVersion, + const int32 SubFirmwareVersion, const bool bRightHanded, + const int32 NumberOfSensors, const FRotator& ImuCorrection, + const TArray& StartPositions, + const TArray& StartRotations, + const TArray& GloveLengths, + const TArray& Functions) +{ + FSGIC_FSGSenseGloveInfoImpl OutSenseGloveInfoImplContainer; + FSGIC_FString DeviceIdContainer{DeviceId}; + FSGIC_FString HardwareVersionContainer{HardwareVersion}; + FSGIC_FQuat ImuCorrectionContainer{ImuCorrection.Quaternion()}; + FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; + FSGIC_TArray_FQuat StartRotationsContainer{FSGArrayUtils::RotatorsToQuats(StartRotations)}; + FSGIC_TArray_TArray_FVector GloveLengthsContainer{ + FSGArrayUtils::FromBPNestedArray(GloveLengths) + }; + FSGIC_TArray_bool FunctionsContainer{Functions}; + SGCoreImpl_FSGSenseGloveInfoImpl_ctor_DeviceId_HardwareVersion_FirmwareVersion_SubFirmwareVersion_bRightHanded_NumberOfSensors_ImuCorrection_StartPositions_StartRotations_GloveLengths_Functions( + &OutSenseGloveInfoImplContainer, + &DeviceIdContainer, &HardwareVersionContainer, FirmwareVersion, SubFirmwareVersion, + bRightHanded, NumberOfSensors, &ImuCorrectionContainer, + &StartPositionsContainer, &StartRotationsContainer, + &GloveLengthsContainer, &FunctionsContainer); + + return NewSenseGloveInfo(Outer, MoveTemp(OutSenseGloveInfoImplContainer.SenseGloveInfoImpl)); +} + bool USGSenseGloveInfo::Parse(UObject* Outer, const FString& ConstantsString, USGSenseGloveInfo*& OutGloveInfo, const bool bUpdateOldModels) { @@ -228,6 +284,38 @@ USGSenseGloveInfo::USGSenseGloveInfo( Pimpl->SyncUProperties(); } +USGSenseGloveInfo::USGSenseGloveInfo( + const FString& DeviceId, + const FString& HardwareVersion, const int32 FirmwareVersion, const int32 SubFirmwareVersion, + const bool bRightHanded, const int32 NumberOfSensors, const FRotator& ImuCorrection, + const TArray& StartPositions, const TArray& StartRotations, + const TArray>& GloveLengths, const TArray& Functions) + : +#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) + Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) +#else + Pimpl(TUniquePtr(new FImpl{this})) +#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */ +{ + FSGIC_FSGSenseGloveInfoImpl OutSenseGloveInfoImplContainer; + FSGIC_FString DeviceIdContainer{DeviceId}; + FSGIC_FString HardwareVersionContainer{HardwareVersion}; + FSGIC_FQuat ImuCorrectionContainer{ImuCorrection.Quaternion()}; + FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; + FSGIC_TArray_FQuat StartRotationsContainer{FSGArrayUtils::RotatorsToQuats(StartRotations)}; + FSGIC_TArray_TArray_FVector GloveLengthsContainer{GloveLengths}; + FSGIC_TArray_bool FunctionsContainer{Functions}; + SGCoreImpl_FSGSenseGloveInfoImpl_ctor_DeviceId_HardwareVersion_FirmwareVersion_SubFirmwareVersion_bRightHanded_NumberOfSensors_ImuCorrection_StartPositions_StartRotations_GloveLengths_Functions( + &OutSenseGloveInfoImplContainer, + &DeviceIdContainer, &HardwareVersionContainer, FirmwareVersion, SubFirmwareVersion, + bRightHanded, NumberOfSensors, &ImuCorrectionContainer, + &StartPositionsContainer, &StartRotationsContainer, + &GloveLengthsContainer, &FunctionsContainer); + + Pimpl->SenseGloveInfoImpl = MoveTemp(OutSenseGloveInfoImplContainer.SenseGloveInfoImpl); + Pimpl->SyncUProperties(); +} + USGSenseGloveInfo::USGSenseGloveInfo( const FString& DeviceId, const FString& HardwareVersion, const int32 FirmwareVersion, const int32 SubFirmwareVersion, @@ -256,6 +344,34 @@ USGSenseGloveInfo::USGSenseGloveInfo( Pimpl->SyncUProperties(); } +USGSenseGloveInfo::USGSenseGloveInfo( + const FString& DeviceId, + const FString& HardwareVersion, const int32 FirmwareVersion, const int32 SubFirmwareVersion, + const bool bRightHanded, const int32 NumberOfSensors, const FRotator& ImuCorrection, + const TArray& StartPositions, const TArray& StartRotations, + const TArray& GloveLengths, const TArray& Functions) +{ + FSGIC_FSGSenseGloveInfoImpl OutSenseGloveInfoImplContainer; + FSGIC_FString DeviceIdContainer{DeviceId}; + FSGIC_FString HardwareVersionContainer{HardwareVersion}; + FSGIC_FQuat ImuCorrectionContainer{ImuCorrection.Quaternion()}; + FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; + FSGIC_TArray_FQuat StartRotationsContainer{FSGArrayUtils::RotatorsToQuats(StartRotations)}; + FSGIC_TArray_TArray_FVector GloveLengthsContainer{ + FSGArrayUtils::FromBPNestedArray(GloveLengths) + }; + FSGIC_TArray_bool FunctionsContainer{Functions}; + SGCoreImpl_FSGSenseGloveInfoImpl_ctor_DeviceId_HardwareVersion_FirmwareVersion_SubFirmwareVersion_bRightHanded_NumberOfSensors_ImuCorrection_StartPositions_StartRotations_GloveLengths_Functions( + &OutSenseGloveInfoImplContainer, + &DeviceIdContainer, &HardwareVersionContainer, FirmwareVersion, SubFirmwareVersion, + bRightHanded, NumberOfSensors, &ImuCorrectionContainer, + &StartPositionsContainer, &StartRotationsContainer, + &GloveLengthsContainer, &FunctionsContainer); + + Pimpl->SenseGloveInfoImpl = MoveTemp(OutSenseGloveInfoImplContainer.SenseGloveInfoImpl); + Pimpl->SyncUProperties(); +} + USGSenseGloveInfo::USGSenseGloveInfo(const FSGSenseGloveInfoImpl& SenseGloveInfoImpl) : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) @@ -330,7 +446,7 @@ int32 USGSenseGloveInfo::GetNumberOfSensors() const return SGCoreImpl_FSGSenseGloveInfoImpl_GetNumberOfSensors(&InstanceContainer); } -FQuat USGSenseGloveInfo::GetImuCorrection() const +FQuat USGSenseGloveInfo::GetImuCorrectionQ() const { FSGIC_FSGSenseGloveInfoImpl InstanceContainer{ToSenseGloveInfoImpl()}; FSGIC_FQuat OutCorrectionContainer; @@ -338,6 +454,14 @@ FQuat USGSenseGloveInfo::GetImuCorrection() const return MoveTemp(OutCorrectionContainer.Quat); } +FRotator USGSenseGloveInfo::GetImuCorrection() const +{ + FSGIC_FSGSenseGloveInfoImpl InstanceContainer{ToSenseGloveInfoImpl()}; + FSGIC_FQuat OutCorrectionContainer; + SGCoreImpl_FSGSenseGloveInfoImpl_GetImuCorrection(&InstanceContainer, &OutCorrectionContainer); + return OutCorrectionContainer.Quat.Rotator(); +} + TArray USGSenseGloveInfo::GetStartPositions() const { FSGIC_FSGSenseGloveInfoImpl InstanceContainer{ToSenseGloveInfoImpl()}; @@ -346,7 +470,7 @@ TArray USGSenseGloveInfo::GetStartPositions() const return MoveTemp(OutPositionsContainer.Array); } -TArray USGSenseGloveInfo::GetStartRotations() const +TArray USGSenseGloveInfo::GetStartRotationsQ() const { FSGIC_FSGSenseGloveInfoImpl InstanceContainer{ToSenseGloveInfoImpl()}; FSGIC_TArray_FQuat OutRotationsContainer; @@ -354,6 +478,14 @@ TArray USGSenseGloveInfo::GetStartRotations() const return MoveTemp(OutRotationsContainer.Array); } +TArray USGSenseGloveInfo::GetStartRotations() const +{ + FSGIC_FSGSenseGloveInfoImpl InstanceContainer{ToSenseGloveInfoImpl()}; + FSGIC_TArray_FQuat OutRotationsContainer; + SGCoreImpl_FSGSenseGloveInfoImpl_GetStartRotations(&InstanceContainer, &OutRotationsContainer); + return FSGArrayUtils::QuatsToRotators(OutRotationsContainer.Array); +} + TArray> USGSenseGloveInfo::GetGloveLengths() const { FSGIC_FSGSenseGloveInfoImpl InstanceContainer{ToSenseGloveInfoImpl()}; @@ -381,7 +513,7 @@ FVector USGSenseGloveInfo::GetStartPosition(const ESGFinger Finger) const return MoveTemp(OutPositionContainer.Vector); } -FQuat USGSenseGloveInfo::GetStartRotation(const ESGFinger Finger) const +FQuat USGSenseGloveInfo::GetStartRotationQ(const ESGFinger Finger) const { Pimpl->SyncImplObject(); @@ -392,6 +524,17 @@ FQuat USGSenseGloveInfo::GetStartRotation(const ESGFinger Finger) const return MoveTemp(OutRotationContainer.Quat); } +FRotator USGSenseGloveInfo::GetStartRotation(const ESGFinger Finger) const +{ + Pimpl->SyncImplObject(); + + FSGIC_FSGSenseGloveInfoImpl InstanceContainer{ToSenseGloveInfoImpl()}; + FSGIC_FQuat OutRotationContainer; + FSGIC_ESGFinger FingerContainer{Finger}; + SGCoreImpl_FSGSenseGloveInfoImpl_GetStartRotation(&InstanceContainer, &OutRotationContainer, &FingerContainer); + return OutRotationContainer.Quat.Rotator(); +} + TArray USGSenseGloveInfo::GetGloveLengths(const ESGFinger Finger) const { Pimpl->SyncImplObject(); diff --git a/Source/SenseGloveCore/Private/SGCore/SGSenseGlovePose.cpp b/Source/SenseGloveCore/Private/SGCore/SGSenseGlovePose.cpp index 10ef505b..82b8354d 100644 --- a/Source/SenseGloveCore/Private/SGCore/SGSenseGlovePose.cpp +++ b/Source/SenseGloveCore/Private/SGCore/SGSenseGlovePose.cpp @@ -115,6 +115,22 @@ USGSenseGlovePose* USGSenseGlovePose::NewSenseGlovePose(UObject* Outer, const bo return NewSenseGlovePose(Outer, MoveTemp(OutSenseGlovePoseImplContainer.SenseGlovePoseImpl)); } +USGSenseGlovePose* USGSenseGlovePose::NewSenseGlovePose(UObject* Outer, const bool bRightHanded, + const TArray>& JointPositions, + const TArray>& JointRotations, + const TArray>& GloveAngles) +{ + FSGIC_FSGSenseGlovePoseImpl OutSenseGlovePoseImplContainer; + FSGIC_TArray_TArray_FVector JointPositionsContainer{JointPositions}; + FSGIC_TArray_TArray_FQuat JointRotationsContainer{FSGArrayUtils::RotatorsToQuats(JointRotations)}; + FSGIC_TArray_TArray_FVector GloveAnglesContainer{GloveAngles}; + SGCoreImpl_FSGSenseGlovePoseImpl_ctor_bRightHanded_JointPositions_JointRotations_GloveAngles( + &OutSenseGlovePoseImplContainer, bRightHanded, &JointPositionsContainer, + &JointRotationsContainer, &GloveAnglesContainer); + + return NewSenseGlovePose(Outer, MoveTemp(OutSenseGlovePoseImplContainer.SenseGlovePoseImpl)); +} + USGSenseGlovePose* USGSenseGlovePose::NewSenseGlovePose(UObject* Outer, const bool bRightHanded, const TArray& JointPositions, const TArray& JointRotations, @@ -137,6 +153,28 @@ USGSenseGlovePose* USGSenseGlovePose::NewSenseGlovePose(UObject* Outer, const bo return NewSenseGlovePose(Outer, MoveTemp(OutSenseGlovePoseImplContainer.SenseGlovePoseImpl)); } +USGSenseGlovePose* USGSenseGlovePose::NewSenseGlovePose(UObject* Outer, const bool bRightHanded, + const TArray& JointPositions, + const TArray& JointRotations, + const TArray& GloveAngles) +{ + FSGIC_FSGSenseGlovePoseImpl OutSenseGlovePoseImplContainer; + FSGIC_TArray_TArray_FVector JointPositionsContainer{ + FSGArrayUtils::FromBPNestedArray(JointPositions) + }; + FSGIC_TArray_TArray_FQuat JointRotationsContainer{ + FSGArrayUtils::RotatorsToQuats(JointRotations) + }; + FSGIC_TArray_TArray_FVector GloveAnglesContainer{ + FSGArrayUtils::FromBPNestedArray(GloveAngles) + }; + SGCoreImpl_FSGSenseGlovePoseImpl_ctor_bRightHanded_JointPositions_JointRotations_GloveAngles( + &OutSenseGlovePoseImplContainer, bRightHanded, &JointPositionsContainer, + &JointRotationsContainer, &GloveAnglesContainer); + + return NewSenseGlovePose(Outer, MoveTemp(OutSenseGlovePoseImplContainer.SenseGlovePoseImpl)); +} + USGSenseGlovePose* USGSenseGlovePose::IdlePose(UObject* Outer, const USGSenseGloveInfo* GloveInfo) { FSGIC_FSGSenseGlovePoseImpl OutSenseGlovePoseImplContainer; @@ -193,6 +231,29 @@ USGSenseGlovePose::USGSenseGlovePose(const bool bRightHanded, Pimpl->SyncUProperties(); } +USGSenseGlovePose::USGSenseGlovePose(const bool bRightHanded, + const TArray>& JointPositions, + const TArray>& JointRotations, + const TArray>& GloveAngles) + : +#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) + Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) +#else + Pimpl(TUniquePtr(new FImpl{this})) +#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */ +{ + FSGIC_FSGSenseGlovePoseImpl OutSenseGlovePoseImplContainer; + FSGIC_TArray_TArray_FVector JointPositionsContainer{JointPositions}; + FSGIC_TArray_TArray_FQuat JointRotationsContainer{FSGArrayUtils::RotatorsToQuats(JointRotations)}; + FSGIC_TArray_TArray_FVector GloveAnglesContainer{GloveAngles}; + SGCoreImpl_FSGSenseGlovePoseImpl_ctor_bRightHanded_JointPositions_JointRotations_GloveAngles( + &OutSenseGlovePoseImplContainer, bRightHanded, &JointPositionsContainer, + &JointRotationsContainer, &GloveAnglesContainer); + + Pimpl->SenseGlovePoseImpl = MoveTemp(OutSenseGlovePoseImplContainer.SenseGlovePoseImpl); + Pimpl->SyncUProperties(); +} + USGSenseGlovePose::USGSenseGlovePose(const bool bRightHanded, const TArray& JointPositions, const TArray& JointRotations, @@ -216,6 +277,29 @@ USGSenseGlovePose::USGSenseGlovePose(const bool bRightHanded, Pimpl->SyncUProperties(); } +USGSenseGlovePose::USGSenseGlovePose(const bool bRightHanded, + const TArray& JointPositions, + const TArray& JointRotations, + const TArray& GloveAngles) +{ + FSGIC_FSGSenseGlovePoseImpl OutSenseGlovePoseImplContainer; + FSGIC_TArray_TArray_FVector JointPositionsContainer{ + FSGArrayUtils::FromBPNestedArray(JointPositions) + }; + FSGIC_TArray_TArray_FQuat JointRotationsContainer{ + FSGArrayUtils::RotatorsToQuats(JointRotations) + }; + FSGIC_TArray_TArray_FVector GloveAnglesContainer{ + FSGArrayUtils::FromBPNestedArray(GloveAngles) + }; + SGCoreImpl_FSGSenseGlovePoseImpl_ctor_bRightHanded_JointPositions_JointRotations_GloveAngles( + &OutSenseGlovePoseImplContainer, bRightHanded, &JointPositionsContainer, + &JointRotationsContainer, &GloveAnglesContainer); + + Pimpl->SenseGlovePoseImpl = MoveTemp(OutSenseGlovePoseImplContainer.SenseGlovePoseImpl); + Pimpl->SyncUProperties(); +} + USGSenseGlovePose::USGSenseGlovePose(const FSGSenseGlovePoseImpl& SenseGlovePoseImpl) : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) @@ -258,7 +342,7 @@ TArray> USGSenseGlovePose::GetJointPositions() const return MoveTemp(OutPositionsContainer.Array); } -TArray> USGSenseGlovePose::GetJointRotations() const +TArray> USGSenseGlovePose::GetJointRotationsQ() const { FSGIC_FSGSenseGlovePoseImpl InstanceContainer{ToSenseGlovePoseImpl()}; FSGIC_TArray_TArray_FQuat OutRotationsContainer; @@ -266,6 +350,14 @@ TArray> USGSenseGlovePose::GetJointRotations() const return MoveTemp(OutRotationsContainer.Array); } +TArray> USGSenseGlovePose::GetJointRotations() const +{ + FSGIC_FSGSenseGlovePoseImpl InstanceContainer{ToSenseGlovePoseImpl()}; + FSGIC_TArray_TArray_FQuat OutRotationsContainer; + SGCoreImpl_FSGSenseGlovePoseImpl_GetJointRotations(&InstanceContainer, &OutRotationsContainer); + return FSGArrayUtils::QuatsToRotators(OutRotationsContainer.Array); +} + TArray> USGSenseGlovePose::GetGloveAngles() const { FSGIC_FSGSenseGlovePoseImpl InstanceContainer{ToSenseGlovePoseImpl()}; @@ -284,7 +376,7 @@ TArray USGSenseGlovePose::GetThimblePositions() const return MoveTemp(OutPositionsContainer.Array); } -TArray USGSenseGlovePose::GetThimbleRotations() const +TArray USGSenseGlovePose::GetThimbleRotationsQ() const { Pimpl->SyncImplObject(); @@ -294,6 +386,16 @@ TArray USGSenseGlovePose::GetThimbleRotations() const return MoveTemp(OutRotationsContainer.Array); } +TArray USGSenseGlovePose::GetThimbleRotations() const +{ + Pimpl->SyncImplObject(); + + FSGIC_FSGSenseGlovePoseImpl InstanceContainer{ToSenseGlovePoseImpl()}; + FSGIC_TArray_FQuat OutRotationsContainer; + SGCoreImpl_FSGSenseGlovePoseImpl_GetThimbleRotations(&InstanceContainer, &OutRotationsContainer); + return FSGArrayUtils::QuatsToRotators(OutRotationsContainer.Array); +} + TArray USGSenseGlovePose::GetTotalGloveAngles() const { Pimpl->SyncImplObject(); diff --git a/Source/SenseGloveCore/Private/SGCore/SGSenseGloveSensorData.cpp b/Source/SenseGloveCore/Private/SGCore/SGSenseGloveSensorData.cpp index 8612a7e2..21ba0748 100644 --- a/Source/SenseGloveCore/Private/SGCore/SGSenseGloveSensorData.cpp +++ b/Source/SenseGloveCore/Private/SGCore/SGSenseGloveSensorData.cpp @@ -112,6 +112,19 @@ USGSenseGloveSensorData* USGSenseGloveSensorData::NewSenseGloveSensorData( return NewSenseGloveSensorData(Outer, MoveTemp(OutSenseGloveSensorDataImplContainer.SenseGloveSensorDataImpl)); } +USGSenseGloveSensorData* USGSenseGloveSensorData::NewSenseGloveSensorData( + UObject* Outer, const TArray>& SensorAngles, + const FRotator& ImuRotation, const int32 ParsedValues, const bool bImuParsed) +{ + FSGIC_FSGSenseGloveSensorDataImpl OutSenseGloveSensorDataImplContainer; + FSGIC_TArray_TArray_float SensorAnglesContainer{SensorAngles}; + FSGIC_FQuat ImuRotationContainer{ImuRotation.Quaternion()}; + SGCoreImpl_FSGSenseGloveSensorDataImpl_ctor_SensorAngles_ImuRotation_ParsedValues_bImuParsed( + &OutSenseGloveSensorDataImplContainer, &SensorAnglesContainer, &ImuRotationContainer, ParsedValues, bImuParsed); + + return NewSenseGloveSensorData(Outer, MoveTemp(OutSenseGloveSensorDataImplContainer.SenseGloveSensorDataImpl)); +} + USGSenseGloveSensorData* USGSenseGloveSensorData::NewSenseGloveSensorData( UObject* Outer, const TArray& SensorAngles, const FQuat& ImuRotation, const int32 ParsedValues, const bool bImuParsed) @@ -127,6 +140,21 @@ USGSenseGloveSensorData* USGSenseGloveSensorData::NewSenseGloveSensorData( return NewSenseGloveSensorData(Outer, MoveTemp(OutSenseGloveSensorDataImplContainer.SenseGloveSensorDataImpl)); } +USGSenseGloveSensorData* USGSenseGloveSensorData::NewSenseGloveSensorData( + UObject* Outer, const TArray& SensorAngles, + const FRotator& ImuRotation, const int32 ParsedValues, const bool bImuParsed) +{ + FSGIC_FSGSenseGloveSensorDataImpl OutSenseGloveSensorDataImplContainer; + FSGIC_TArray_TArray_float SensorAnglesContainer{ + FSGArrayUtils::FromBPNestedArray(SensorAngles) + }; + FSGIC_FQuat ImuRotationContainer{ImuRotation.Quaternion()}; + SGCoreImpl_FSGSenseGloveSensorDataImpl_ctor_SensorAngles_ImuRotation_ParsedValues_bImuParsed( + &OutSenseGloveSensorDataImplContainer, &SensorAnglesContainer, &ImuRotationContainer, ParsedValues, bImuParsed); + + return NewSenseGloveSensorData(Outer, MoveTemp(OutSenseGloveSensorDataImplContainer.SenseGloveSensorDataImpl)); +} + USGSenseGloveSensorData* USGSenseGloveSensorData::Empty(UObject* Outer) { FSGIC_FSGSenseGloveSensorDataImpl OutSenseGloveSensorDataImplContainer; @@ -191,6 +219,25 @@ USGSenseGloveSensorData::USGSenseGloveSensorData(const TArray>& Se Pimpl->SyncUProperties(); } +USGSenseGloveSensorData::USGSenseGloveSensorData(const TArray>& SensorAngles, const FRotator& ImuRotation, + const int32 ParsedValues, const bool bImuParsed) + : +#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) + Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) +#else + Pimpl(TUniquePtr(new FImpl{this})) +#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */ +{ + FSGIC_FSGSenseGloveSensorDataImpl OutSenseGloveSensorDataImplContainer; + FSGIC_TArray_TArray_float SensorAnglesContainer{SensorAngles}; + FSGIC_FQuat ImuRotationContainer{ImuRotation.Quaternion()}; + SGCoreImpl_FSGSenseGloveSensorDataImpl_ctor_SensorAngles_ImuRotation_ParsedValues_bImuParsed( + &OutSenseGloveSensorDataImplContainer, &SensorAnglesContainer, &ImuRotationContainer, ParsedValues, bImuParsed); + + Pimpl->SenseGloveSensorDataImpl = MoveTemp(OutSenseGloveSensorDataImplContainer.SenseGloveSensorDataImpl); + Pimpl->SyncUProperties(); +} + USGSenseGloveSensorData::USGSenseGloveSensorData(const TArray& SensorAngles, const FQuat& ImuRotation, const int32 ParsedValues, const bool bImuParsed) { @@ -206,6 +253,21 @@ USGSenseGloveSensorData::USGSenseGloveSensorData(const TArray& Se Pimpl->SyncUProperties(); } +USGSenseGloveSensorData::USGSenseGloveSensorData(const TArray& SensorAngles, const FRotator& ImuRotation, + const int32 ParsedValues, const bool bImuParsed) +{ + FSGIC_FSGSenseGloveSensorDataImpl OutSenseGloveSensorDataImplContainer; + FSGIC_TArray_TArray_float SensorAnglesContainer{ + FSGArrayUtils::FromBPNestedArray(SensorAngles) + }; + FSGIC_FQuat ImuRotationContainer{ImuRotation.Quaternion()}; + SGCoreImpl_FSGSenseGloveSensorDataImpl_ctor_SensorAngles_ImuRotation_ParsedValues_bImuParsed( + &OutSenseGloveSensorDataImplContainer, &SensorAnglesContainer, &ImuRotationContainer, ParsedValues, bImuParsed); + + Pimpl->SenseGloveSensorDataImpl = MoveTemp(OutSenseGloveSensorDataImplContainer.SenseGloveSensorDataImpl); + Pimpl->SyncUProperties(); +} + USGSenseGloveSensorData::USGSenseGloveSensorData(const FSGSenseGloveSensorDataImpl& SenseGloveSensorDataImpl) : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) @@ -242,7 +304,7 @@ TArray> USGSenseGloveSensorData::GetSensorAngles() const return MoveTemp(OutAnglesContainer.Array); } -FQuat USGSenseGloveSensorData::GetImuRotation() const +FQuat USGSenseGloveSensorData::GetImuRotationQ() const { FSGIC_FSGSenseGloveSensorDataImpl InstanceContainer{ToSenseGloveSensorDataImpl()}; FSGIC_FQuat OutRotationContainer; @@ -250,6 +312,14 @@ FQuat USGSenseGloveSensorData::GetImuRotation() const return MoveTemp(OutRotationContainer.Quat); } +FRotator USGSenseGloveSensorData::GetImuRotation() const +{ + FSGIC_FSGSenseGloveSensorDataImpl InstanceContainer{ToSenseGloveSensorDataImpl()}; + FSGIC_FQuat OutRotationContainer; + SGCoreImpl_FSGSenseGloveSensorDataImpl_GetImuRotation(&InstanceContainer, &OutRotationContainer); + return OutRotationContainer.Quat.Rotator(); +} + int32 USGSenseGloveSensorData::GetParsedValues() const { FSGIC_FSGSenseGloveSensorDataImpl InstanceContainer{ToSenseGloveSensorDataImpl()}; diff --git a/Source/SenseGloveCore/Private/SGCore/SGSenseGloveVars.cpp b/Source/SenseGloveCore/Private/SGCore/SGSenseGloveVars.cpp index 7731c0cd..18dd334c 100644 --- a/Source/SenseGloveCore/Private/SGCore/SGSenseGloveVars.cpp +++ b/Source/SenseGloveCore/Private/SGCore/SGSenseGloveVars.cpp @@ -72,7 +72,7 @@ TArray FSGSenseGloveVars::GetStartPositions(const FString& HardwareVers return MoveTemp(OutPositionsContainer.Array); } -TArray FSGSenseGloveVars::GetStartRotations(const FString& HardwareVersion, const bool bRightHanded) +TArray FSGSenseGloveVars::GetStartRotationsQ(const FString& HardwareVersion, const bool bRightHanded) { FSGIC_TArray_FQuat OutRotationsContainer; FSGIC_FString HardwareVersionContainer{HardwareVersion}; @@ -80,6 +80,14 @@ TArray FSGSenseGloveVars::GetStartRotations(const FString& HardwareVersio return MoveTemp(OutRotationsContainer.Array); } +TArray FSGSenseGloveVars::GetStartRotations(const FString& HardwareVersion, const bool bRightHanded) +{ + FSGIC_TArray_FQuat OutRotationsContainer; + FSGIC_FString HardwareVersionContainer{HardwareVersion}; + SGCoreImpl_FSGSenseGloveVarsImpl_GetStartRotations(&OutRotationsContainer, &HardwareVersionContainer, bRightHanded); + return FSGArrayUtils::QuatsToRotators(OutRotationsContainer.Array); +} + TArray> FSGSenseGloveVars::GetGloveLengths(const FString& HardwareVersion) { FSGIC_TArray_TArray_FVector OutLengthsContainer; @@ -100,8 +108,8 @@ int32 FSGSenseGloveVars::GetSensors(const FString& HardwareVersion) return SGCoreImpl_FSGSenseGloveVarsImpl_GetSensors(&HardwareVersionContainer); } -FQuat FSGSenseGloveVars::GetImuCorrection(const FString& HardwareVersion, const int32 FirmwareVersion, - const int32 SubFirmwareVersion) +FQuat FSGSenseGloveVars::GetImuCorrectionQ(const FString& HardwareVersion, + const int32 FirmwareVersion, const int32 SubFirmwareVersion) { FSGIC_FQuat OutCorrectionContainer; FSGIC_FString HardwareVersionContainer{HardwareVersion}; @@ -110,8 +118,18 @@ FQuat FSGSenseGloveVars::GetImuCorrection(const FString& HardwareVersion, const return MoveTemp(OutCorrectionContainer.Quat); } -TArray FSGSenseGloveVars::GetFunctions(const FString& HardwareVersion, const int32 FirmwareVersion, - const int32 SubFirmwareVersion) +FRotator FSGSenseGloveVars::GetImuCorrection(const FString& HardwareVersion, + const int32 FirmwareVersion, const int32 SubFirmwareVersion) +{ + FSGIC_FQuat OutCorrectionContainer; + FSGIC_FString HardwareVersionContainer{HardwareVersion}; + SGCoreImpl_FSGSenseGloveVarsImpl_GetImuCorrection(&OutCorrectionContainer, + &HardwareVersionContainer, FirmwareVersion, SubFirmwareVersion); + return OutCorrectionContainer.Quat.Rotator(); +} + +TArray FSGSenseGloveVars::GetFunctions(const FString& HardwareVersion, + const int32 FirmwareVersion, const int32 SubFirmwareVersion) { FSGIC_TArray_bool OutFunctionsContainer; FSGIC_FString HardwareVersionContainer{HardwareVersion}; diff --git a/Source/SenseGloveCore/Private/SGCore/SGTracking.cpp b/Source/SenseGloveCore/Private/SGCore/SGTracking.cpp index 60f220e9..28636256 100644 --- a/Source/SenseGloveCore/Private/SGCore/SGTracking.cpp +++ b/Source/SenseGloveCore/Private/SGCore/SGTracking.cpp @@ -43,6 +43,7 @@ #include "SGInterop/SGIC_FVector.h" #include "SGInterop/SGIC_TArray_FQuat.h" #include "SGInterop/SGIC_TArray_FVector.h" +#include "SGUtils/SGArrayUtils.h" void FSGTracking::CalculateLocation(const FVector& TrackedPosition, const FQuat& TrackedRotation, const FVector& PositionOffset, const FQuat& RotationOffset, @@ -64,6 +65,26 @@ void FSGTracking::CalculateLocation(const FVector& TrackedPosition, const FQuat& OutNewRotation = MoveTemp(OutNewRotationContainer.Quat); } +void FSGTracking::CalculateLocation(const FVector& TrackedPosition, const FRotator& TrackedRotation, + const FVector& PositionOffset, const FRotator& RotationOffset, + FVector& OutNewPosition, FRotator& OutNewRotation) +{ + FSGIC_FVector TrackedPositionContainer{TrackedPosition}; + FSGIC_FQuat TrackedRotationContainer{TrackedRotation.Quaternion()}; + FSGIC_FVector PositionOffsetContainer{PositionOffset}; + FSGIC_FQuat RotationOffsetContainer{RotationOffset.Quaternion()}; + FSGIC_FVector OutNewPositionContainer; + FSGIC_FQuat OutNewRotationContainer; + + SGCoreImpl_FSGTrackingImpl_CalculateLocation( + &TrackedPositionContainer, &TrackedRotationContainer, + &PositionOffsetContainer, &RotationOffsetContainer, + &OutNewPositionContainer, &OutNewRotationContainer); + + OutNewPosition = MoveTemp(OutNewPositionContainer.Vector); + OutNewRotation = OutNewRotationContainer.Quat.Rotator(); +} + TArray FSGTracking::GetSenseGloveFingerToGlovePositionOrigin() { FSGIC_TArray_FVector OutOriginContainer; @@ -71,13 +92,20 @@ TArray FSGTracking::GetSenseGloveFingerToGlovePositionOrigin() return MoveTemp(OutOriginContainer.Array); } -TArray FSGTracking::GetSenseGloveFingerToGloveRotationOrigin() +TArray FSGTracking::GetSenseGloveFingerToGloveRotationOriginQ() { FSGIC_TArray_FQuat OutOriginContainer; SGCoreImpl_FSGTrackingImpl_GetSenseGloveFingerToGloveRotationOrigin(&OutOriginContainer); return MoveTemp(OutOriginContainer.Array); } +TArray FSGTracking::GetSenseGloveFingerToGloveRotationOrigin() +{ + FSGIC_TArray_FQuat OutOriginContainer; + SGCoreImpl_FSGTrackingImpl_GetSenseGloveFingerToGloveRotationOrigin(&OutOriginContainer); + return FSGArrayUtils::QuatsToRotators(OutOriginContainer.Array); +} + FVector FSGTracking::GetSenseGloveWristPositionOffset() { FSGIC_FVector OutOffsetContainer; @@ -85,13 +113,20 @@ FVector FSGTracking::GetSenseGloveWristPositionOffset() return MoveTemp(OutOffsetContainer.Vector); } -FQuat FSGTracking::GetSenseGloveWristRotationOffset() +FQuat FSGTracking::GetSenseGloveWristRotationOffsetQ() { FSGIC_FQuat OutOffsetContainer; SGCoreImpl_FSGTrackingImpl_GetSenseGloveWristRotationOffset(&OutOffsetContainer); return MoveTemp(OutOffsetContainer.Quat); } +FRotator FSGTracking::GetSenseGloveWristRotationOffset() +{ + FSGIC_FQuat OutOffsetContainer; + SGCoreImpl_FSGTrackingImpl_GetSenseGloveWristRotationOffset(&OutOffsetContainer); + return OutOffsetContainer.Quat.Rotator(); +} + void FSGTracking::GetSenseGloveMountOffset(const bool bRightHanded, const ESGFinger ToFinger, FVector& OutIPosition, FQuat& OutIRotation) { @@ -106,6 +141,20 @@ void FSGTracking::GetSenseGloveMountOffset(const bool bRightHanded, const ESGFin OutIRotation = MoveTemp(OutIRotationContainer.Quat); } +void FSGTracking::GetSenseGloveMountOffset(const bool bRightHanded, const ESGFinger ToFinger, + FVector& OutIPosition, FRotator& OutIRotation) +{ + FSGIC_ESGFinger ToFingerContainer{ToFinger}; + FSGIC_FVector OutIPositionContainer; + FSGIC_FQuat OutIRotationContainer; + + SGCoreImpl_FSGTrackingImpl_GetSenseGloveMountOffset(bRightHanded, &ToFingerContainer, + &OutIPositionContainer, &OutIRotationContainer); + + OutIPosition = MoveTemp(OutIPositionContainer.Vector); + OutIRotation = OutIRotationContainer.Quat.Rotator(); +} + void FSGTracking::GetSenseGloveTrackerMountOffset(const ESGPositionalTrackingHardware Hardware, const bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset) { @@ -121,6 +170,21 @@ void FSGTracking::GetSenseGloveTrackerMountOffset(const ESGPositionalTrackingHar OutRotationOffset = MoveTemp(OutRotationOffsetContainer.Quat); } +void FSGTracking::GetSenseGloveTrackerMountOffset(const ESGPositionalTrackingHardware Hardware, const bool bRightHanded, + FVector& OutPositionOffset, FRotator& OutRotationOffset) +{ + FSGIC_ESGPositionalTrackingHardware HardwareContainer; + FSGIC_FVector OutPositionOffsetContainer; + FSGIC_FQuat OutRotationOffsetContainer; + + SGCoreImpl_FSGTrackingImpl_GetSenseGloveTrackerMountOffset(&HardwareContainer, bRightHanded, + &OutPositionOffsetContainer, + &OutRotationOffsetContainer); + + OutPositionOffset = MoveTemp(OutPositionOffsetContainer.Vector); + OutRotationOffset = OutRotationOffsetContainer.Quat.Rotator(); +} + FVector FSGTracking::GetSenseGloveViveToAttachPosition() { FSGIC_FVector OutPositionContainer; @@ -128,13 +192,20 @@ FVector FSGTracking::GetSenseGloveViveToAttachPosition() return MoveTemp(OutPositionContainer.Vector); } -FQuat FSGTracking::GetSenseGloveViveToAttachRotation() +FQuat FSGTracking::GetSenseGloveViveToAttachRotationQ() { FSGIC_FQuat OutRotationContainer; SGCoreImpl_FSGTrackingImpl_GetSenseGloveViveToAttachRotation(&OutRotationContainer); return MoveTemp(OutRotationContainer.Quat); } +FRotator FSGTracking::GetSenseGloveViveToAttachRotation() +{ + FSGIC_FQuat OutRotationContainer; + SGCoreImpl_FSGTrackingImpl_GetSenseGloveViveToAttachRotation(&OutRotationContainer); + return OutRotationContainer.Quat.Rotator(); +} + FVector FSGTracking::GetSenseGloveOculusTouchToAttachPosition() { FSGIC_FVector OutPositionContainer; @@ -142,13 +213,20 @@ FVector FSGTracking::GetSenseGloveOculusTouchToAttachPosition() return MoveTemp(OutPositionContainer.Vector); } -FQuat FSGTracking::GetSenseGloveOculusTouchToAttachRotation() +FQuat FSGTracking::GetSenseGloveOculusTouchToAttachRotationQ() { FSGIC_FQuat OutRotationContainer; SGCoreImpl_FSGTrackingImpl_GetSenseGloveOculusTouchToAttachRotation(&OutRotationContainer); return MoveTemp(OutRotationContainer.Quat); } +FRotator FSGTracking::GetSenseGloveOculusTouchToAttachRotation() +{ + FSGIC_FQuat OutRotationContainer; + SGCoreImpl_FSGTrackingImpl_GetSenseGloveOculusTouchToAttachRotation(&OutRotationContainer); + return OutRotationContainer.Quat.Rotator(); +} + FVector FSGTracking::GetNovaToWristPositionOffset() { FSGIC_FVector OutOffsetContainer; @@ -156,13 +234,20 @@ FVector FSGTracking::GetNovaToWristPositionOffset() return MoveTemp(OutOffsetContainer.Vector); } -FQuat FSGTracking::GetNovaToWristRotationOffset() +FQuat FSGTracking::GetNovaToWristRotationOffsetQ() { FSGIC_FQuat OutOffsetContainer; SGCoreImpl_FSGTrackingImpl_GetNovaToWristRotationOffset(&OutOffsetContainer); return MoveTemp(OutOffsetContainer.Quat); } +FRotator FSGTracking::GetNovaToWristRotationOffset() +{ + FSGIC_FQuat OutOffsetContainer; + SGCoreImpl_FSGTrackingImpl_GetNovaToWristRotationOffset(&OutOffsetContainer); + return OutOffsetContainer.Quat.Rotator(); +} + void FSGTracking::GetNovaGloveWristOffset(const bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset) { FSGIC_FVector OutPositionOffsetContainer; @@ -175,6 +260,19 @@ void FSGTracking::GetNovaGloveWristOffset(const bool bRightHanded, FVector& OutP OutRotationOffset = MoveTemp(OutRotationOffsetContainer.Quat); } +void FSGTracking::GetNovaGloveWristOffset(const bool bRightHanded, + FVector& OutPositionOffset, FRotator& OutRotationOffset) +{ + FSGIC_FVector OutPositionOffsetContainer; + FSGIC_FQuat OutRotationOffsetContainer; + + SGCoreImpl_FSGTrackingImpl_GetNovaGloveWristOffset(bRightHanded, + &OutPositionOffsetContainer, &OutRotationOffsetContainer); + + OutPositionOffset = MoveTemp(OutPositionOffsetContainer.Vector); + OutRotationOffset = OutRotationOffsetContainer.Quat.Rotator(); +} + FVector FSGTracking::GetRightNovaViveToAttachPosition() { FSGIC_FVector OutPositionContainer; @@ -182,13 +280,20 @@ FVector FSGTracking::GetRightNovaViveToAttachPosition() return MoveTemp(OutPositionContainer.Vector); } -FQuat FSGTracking::GetRightNovaViveToAttachRotation() +FQuat FSGTracking::GetRightNovaViveToAttachRotationQ() { FSGIC_FQuat OutRotationContainer; SGCoreImpl_FSGTrackingImpl_GetRightNovaViveToAttachRotation(&OutRotationContainer); return MoveTemp(OutRotationContainer.Quat); } +FRotator FSGTracking::GetRightNovaViveToAttachRotation() +{ + FSGIC_FQuat OutRotationContainer; + SGCoreImpl_FSGTrackingImpl_GetRightNovaViveToAttachRotation(&OutRotationContainer); + return OutRotationContainer.Quat.Rotator(); +} + FVector FSGTracking::GetLeftNovaViveToAttachPosition() { FSGIC_FVector OutPositionContainer; @@ -196,13 +301,20 @@ FVector FSGTracking::GetLeftNovaViveToAttachPosition() return MoveTemp(OutPositionContainer.Vector); } -FQuat FSGTracking::GetLeftNovaViveToAttachRotation() +FQuat FSGTracking::GetLeftNovaViveToAttachRotationQ() { FSGIC_FQuat OutRotationContainer; SGCoreImpl_FSGTrackingImpl_GetLeftNovaViveToAttachRotation(&OutRotationContainer); return MoveTemp(OutRotationContainer.Quat); } +FRotator FSGTracking::GetLeftNovaViveToAttachRotation() +{ + FSGIC_FQuat OutRotationContainer; + SGCoreImpl_FSGTrackingImpl_GetLeftNovaViveToAttachRotation(&OutRotationContainer); + return OutRotationContainer.Quat.Rotator(); +} + FVector FSGTracking::GetRightNovaQuest2ToAttachPosition() { FSGIC_FVector OutPositionContainer; @@ -210,13 +322,20 @@ FVector FSGTracking::GetRightNovaQuest2ToAttachPosition() return MoveTemp(OutPositionContainer.Vector); } -FQuat FSGTracking::GetRightNovaQuest2ToAttachRotation() +FQuat FSGTracking::GetRightNovaQuest2ToAttachRotationQ() { FSGIC_FQuat OutRotationContainer; SGCoreImpl_FSGTrackingImpl_GetRightNovaQuest2ToAttachRotation(&OutRotationContainer); return MoveTemp(OutRotationContainer.Quat); } +FRotator FSGTracking::GetRightNovaQuest2ToAttachRotation() +{ + FSGIC_FQuat OutRotationContainer; + SGCoreImpl_FSGTrackingImpl_GetRightNovaQuest2ToAttachRotation(&OutRotationContainer); + return OutRotationContainer.Quat.Rotator(); +} + FVector FSGTracking::GetLeftNovaQuest2ToAttachPosition() { FSGIC_FVector OutPositionContainer; @@ -224,13 +343,20 @@ FVector FSGTracking::GetLeftNovaQuest2ToAttachPosition() return MoveTemp(OutPositionContainer.Vector); } -FQuat FSGTracking::GetLeftNovaQuest2ToAttachRotation() +FQuat FSGTracking::GetLeftNovaQuest2ToAttachRotationQ() { FSGIC_FQuat OutRotationContainer; SGCoreImpl_FSGTrackingImpl_GetLeftNovaQuest2ToAttachRotation(&OutRotationContainer); return MoveTemp(OutRotationContainer.Quat); } +FRotator FSGTracking::GetLeftNovaQuest2ToAttachRotation() +{ + FSGIC_FQuat OutRotationContainer; + SGCoreImpl_FSGTrackingImpl_GetLeftNovaQuest2ToAttachRotation(&OutRotationContainer); + return OutRotationContainer.Quat.Rotator(); +} + FVector FSGTracking::GetRightNovaPico2ToAttachPosition() { FSGIC_FVector OutPositionContainer; @@ -238,20 +364,34 @@ FVector FSGTracking::GetRightNovaPico2ToAttachPosition() return MoveTemp(OutPositionContainer.Vector); } -FQuat FSGTracking::GetRightNovaPico2ToAttachRotation() +FQuat FSGTracking::GetRightNovaPico2ToAttachRotationQ() { FSGIC_FQuat OutRotationContainer; SGCoreImpl_FSGTrackingImpl_GetRightNovaPico2ToAttachRotation(&OutRotationContainer); return MoveTemp(OutRotationContainer.Quat); } -FQuat FSGTracking::GetLeftNovaPico2ToAttachRotation() +FRotator FSGTracking::GetRightNovaPico2ToAttachRotation() +{ + FSGIC_FQuat OutRotationContainer; + SGCoreImpl_FSGTrackingImpl_GetRightNovaPico2ToAttachRotation(&OutRotationContainer); + return OutRotationContainer.Quat.Rotator(); +} + +FQuat FSGTracking::GetLeftNovaPico2ToAttachRotationQ() { FSGIC_FQuat OutRotationContainer; SGCoreImpl_FSGTrackingImpl_GetLeftNovaPico2ToAttachRotation(&OutRotationContainer); return MoveTemp(OutRotationContainer.Quat); } +FRotator FSGTracking::GetLeftNovaPico2ToAttachRotation() +{ + FSGIC_FQuat OutRotationContainer; + SGCoreImpl_FSGTrackingImpl_GetLeftNovaPico2ToAttachRotation(&OutRotationContainer); + return OutRotationContainer.Quat.Rotator(); +} + void FSGTracking::GetNovaGloveTrackerOffset(const ESGPositionalTrackingHardware Hardware, const bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset) { @@ -266,6 +406,20 @@ void FSGTracking::GetNovaGloveTrackerOffset(const ESGPositionalTrackingHardware OutRotationOffset = MoveTemp(OutRotationOffsetContainer.Quat); } +void FSGTracking::GetNovaGloveTrackerOffset(const ESGPositionalTrackingHardware Hardware, const bool bRightHanded, + FVector& OutPositionOffset, FRotator& OutRotationOffset) +{ + FSGIC_ESGPositionalTrackingHardware HardwareContainer{Hardware}; + FSGIC_FVector OutPositionOffsetContainer; + FSGIC_FQuat OutRotationOffsetContainer; + + SGCoreImpl_FSGTrackingImpl_GetNovaGloveTrackerOffset(&HardwareContainer, bRightHanded, + &OutPositionOffsetContainer, &OutRotationOffsetContainer); + + OutPositionOffset = MoveTemp(OutPositionOffsetContainer.Vector); + OutRotationOffset = OutRotationOffsetContainer.Quat.Rotator(); +} + FString FSGTracking::ToString(const ESGPositionalTrackingHardware Hardware) { FSGIC_FString OutStringContainer; diff --git a/Source/SenseGloveCore/Public/SGCore/SGBasicHandModel.h b/Source/SenseGloveCore/Public/SGCore/SGBasicHandModel.h index 10e0f3d1..00ba8cba 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGBasicHandModel.h +++ b/Source/SenseGloveCore/Public/SGCore/SGBasicHandModel.h @@ -77,11 +77,21 @@ public: bool bRightHanded, const TArray>& Lengths, const TArray& StartPositions, const TArray& StartRotations); + static USGBasicHandModel* NewBasicHandModel( + UObject* Outer, + bool bRightHanded, const TArray>& Lengths, + const TArray& StartPositions, const TArray& StartRotations); + static USGBasicHandModel* NewBasicHandModel( UObject* Outer, bool bRightHanded, const TArray& Lengths, const TArray& StartPositions, const TArray& StartRotations); + static USGBasicHandModel* NewBasicHandModel( + UObject* Outer, + bool bRightHanded, const TArray& Lengths, + const TArray& StartPositions, const TArray& StartRotations); + public: static USGBasicHandModel* Default(UObject* Outer, bool bRightHanded); @@ -117,9 +127,15 @@ public: USGBasicHandModel(bool bRightHanded, const TArray>& Lengths, const TArray& StartPositions, const TArray& StartRotations); + USGBasicHandModel(bool bRightHanded, const TArray>& Lengths, + const TArray& StartPositions, const TArray& StartRotations); + USGBasicHandModel(bool bRightHanded, const TArray& Lengths, const TArray& StartPositions, const TArray& StartRotations); + USGBasicHandModel(bool bRightHanded, const TArray& Lengths, + const TArray& StartPositions, const TArray& StartRotations); + public: /** * The cast from underlying type constructor. @@ -169,16 +185,22 @@ public: void SetStartJointPosition(ESGFinger Finger, const FVector& Position); void SetStartJointPosition(uint8 Finger, const FVector& Position); - TArray GetStartJointRotations() const; + TArray GetStartJointRotationsQ() const; + + TArray GetStartJointRotations() const; FVector GetJointPosition(ESGFinger Finger) const; void SetJointPosition(const FVector& NewPosition, ESGFinger Finger); - FQuat GetJointRotation(ESGFinger Finger) const; + FQuat GetJointRotationQ(ESGFinger Finger) const; + + FRotator GetJointRotation(ESGFinger Finger) const; void SetJointRotation(const FQuat& NewRotation, ESGFinger Finger); + void SetJointRotation(const FRotator& NewRotation, ESGFinger Finger); + TArray GetTotalLengths() const; float GetTotalLength(ESGFinger Finger) const; diff --git a/Source/SenseGloveCore/Public/SGCore/SGHandInterpolator.h b/Source/SenseGloveCore/Public/SGCore/SGHandInterpolator.h index bae8456b..257a0af3 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGHandInterpolator.h +++ b/Source/SenseGloveCore/Public/SGCore/SGHandInterpolator.h @@ -76,10 +76,18 @@ public: UObject* Outer, const TArray>& JointInterpolations, const FQuat& CmcStartRotation); + static USGHandInterpolator* NewHandInterpolator( + UObject* Outer, + const TArray>& JointInterpolations, const FRotator& CmcStartRotation); + static USGHandInterpolator* NewHandInterpolator( UObject* Outer, const TArray& JointInterpolations, const FQuat& CmcStartRotation); + static USGHandInterpolator* NewHandInterpolator( + UObject* Outer, + const TArray& JointInterpolations, const FRotator& CmcStartRotation); + public: static USGHandInterpolator* Default(UObject* Outer, const bool bRightHanded); @@ -116,9 +124,15 @@ public: USGHandInterpolator(const TArray>& JointInterpolations, const FQuat& CmcStartRotation); + USGHandInterpolator(const TArray>& JointInterpolations, + const FRotator& CmcStartRotation); + USGHandInterpolator(const TArray& JointInterpolations, const FQuat& CmcStartRotation); + USGHandInterpolator(const TArray& JointInterpolations, + const FRotator& CmcStartRotation); + public: /** * The cast from underlying type constructor. @@ -146,7 +160,9 @@ public: public: TArray> GetJointInterpolations(UObject* Outer) const; - FQuat GetCmcStartRotation() const; + FQuat GetCmcStartRotationQ() const; + + FRotator GetCmcStartRotation() const; public: float CalculateAngle(ESGFinger Finger, int32 Movement, float Value) const; diff --git a/Source/SenseGloveCore/Public/SGCore/SGHandPose.h b/Source/SenseGloveCore/Public/SGCore/SGHandPose.h index 94de3e68..a4cb7030 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGHandPose.h +++ b/Source/SenseGloveCore/Public/SGCore/SGHandPose.h @@ -45,6 +45,7 @@ #include "SGCore/SGBasicHandModel.h" #include "SGCore/SGQuatArray.h" +#include "SGCore/SGRotatorArray.h" #include "SGCore/SGVectorArray.h" #include "SGUtils/SGArrayUtils.h" @@ -69,11 +70,22 @@ public: bool bRightHanded, const TArray>& JointPositions, const TArray>& JointRotations, const TArray>& HandAngles); + static USGHandPose* NewHandPose( + UObject* Outer, + bool bRightHanded, + const TArray>& JointPositions, const TArray>& JointRotations, + const TArray>& HandAngles); + static USGHandPose* NewHandPose( UObject* Outer, bool bRightHanded, const TArray& JointPositions, const TArray& JointRotations, const TArray& HandAngles); + static USGHandPose* NewHandPose( + UObject* Outer, + bool bRightHanded, const TArray& JointPositions, const TArray& JointRotations, + const TArray& HandAngles); + public: static USGHandPose* Deserialize(UObject* Outer, const FString& SerializedString); @@ -117,10 +129,18 @@ public: const TArray>& JointPositions, const TArray>& JointRotations, const TArray>& HandAngles); + USGHandPose(bool bRightHanded, + const TArray>& JointPositions, const TArray>& JointRotations, + const TArray>& HandAngles); + USGHandPose(bool bRightHanded, const TArray& JointPositions, const TArray& JointRotations, const TArray& HandAngles); + USGHandPose(bool bRightHanded, + const TArray& JointPositions, const TArray& JointRotations, + const TArray& HandAngles); + public: /** * The cast from underlying type constructor. @@ -150,7 +170,9 @@ public: TArray> GetJointPositions() const; - TArray> GetJointRotations() const; + TArray> GetJointRotationsQ() const; + + TArray> GetJointRotations() const; TArray> GetHandAngles() const; diff --git a/Source/SenseGloveCore/Public/SGCore/SGHapticGlove.h b/Source/SenseGloveCore/Public/SGCore/SGHapticGlove.h index 840eb74e..2efdd573 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGHapticGlove.h +++ b/Source/SenseGloveCore/Public/SGCore/SGHapticGlove.h @@ -169,9 +169,11 @@ public: virtual bool GetImuRotation(FQuat& OutImu); + virtual bool GetImuRotation(FRotator& OutImu); + virtual bool GetHandPose( UObject* Outer, - const USGBasicHandModel* HandGeometry, const USGHandProfile* HandProfile,USGHandPose*& OutHandPose); + const USGBasicHandModel* HandGeometry, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose); virtual bool GetHandPose(UObject* Outer, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose); @@ -218,7 +220,15 @@ public: ESGPositionalTrackingHardware TrackingHardware, FVector& OutWristPosition, FQuat& OutWristRotation) const; + virtual void GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, + FVector& OutWristPosition, FRotator& OutWristRotation) const; + virtual void GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, FVector& OutGlovePosition, FQuat& OutGloveRotation) const; + + virtual void GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, + FVector& OutGlovePosition, FRotator& OutGloveRotation) const; }; \ No newline at end of file diff --git a/Source/SenseGloveCore/Public/SGCore/SGJointKinematics.h b/Source/SenseGloveCore/Public/SGCore/SGJointKinematics.h index 5ecf8932..2247fc46 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGJointKinematics.h +++ b/Source/SenseGloveCore/Public/SGCore/SGJointKinematics.h @@ -55,7 +55,16 @@ public: const TArray& JointLengths, const TArray& JointAngles, TArray& OutNewPositions, TArray& OutNewRotations); + static bool ForwardKinematics( + const FVector& StartPosition, const FRotator& StartRotation, + const TArray& JointLengths, const TArray& JointAngles, + TArray& OutNewPositions, TArray& OutNewRotations); + static bool ForwardKinematics( const USGBasicHandModel* Profile, ESGFinger Finger, const TArray& JointAngles, TArray& OutNewPositions, TArray& OutNewRotations); + + static bool ForwardKinematics( + const USGBasicHandModel* Profile, ESGFinger Finger, const TArray& JointAngles, + TArray& OutNewPositions, TArray& OutNewRotations); }; \ No newline at end of file diff --git a/Source/SenseGloveCore/Public/SGCore/SGNovaGlove.h b/Source/SenseGloveCore/Public/SGCore/SGNovaGlove.h index 3991efa3..2e094482 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGNovaGlove.h +++ b/Source/SenseGloveCore/Public/SGCore/SGNovaGlove.h @@ -102,10 +102,18 @@ public: ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, FVector& OutGlovePosition, FQuat& OutGloveRotation); + static void CalculateGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, + FVector& OutGlovePosition, FRotator& OutGloveRotation); + static void CalculateWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, FVector& OutWristPosition, FQuat& OutWristRotation); + static void CalculateWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, + FVector& OutWristPosition, FRotator& OutWristRotation); + public: static FString ToBytes(const USGThumperCommand* ThumperCommand); @@ -207,6 +215,8 @@ public: virtual bool GetImuRotation(FQuat& OutImu) override; + virtual bool GetImuRotation(FRotator& OutImu) override; + /// HACK /// 'FSGNovaGlove::GetHandPose' hides overloaded virtual functions [-Werror,-Woverloaded-virtual] /// tell the compiler we want both the GetHandPose from FSGHapticGlove and FSGNovaGlove @@ -243,10 +253,18 @@ public: ESGPositionalTrackingHardware TrackingHardware, FVector& OutGlovePosition, FQuat& OutGloveRotation) const override; + virtual void GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, + FVector& OutGlovePosition, FRotator& OutGloveRotation) const override; + virtual void GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, FVector& OutWristPosition, FQuat& OutWristRotation) const override; + virtual void GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, + FVector& OutWristPosition, FRotator& OutWristRotation) const override; + public: virtual FString ToString() const override; }; \ No newline at end of file diff --git a/Source/SenseGloveCore/Public/SGCore/SGNovaGloveSensorData.h b/Source/SenseGloveCore/Public/SGCore/SGNovaGloveSensorData.h index 7fbad775..d8fadd9f 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGNovaGloveSensorData.h +++ b/Source/SenseGloveCore/Public/SGCore/SGNovaGloveSensorData.h @@ -65,6 +65,10 @@ public: UObject* Outer, const TArray& Values, int32 ParsedValues, const FQuat& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging); + static USGNovaGloveSensorData* NewNovaGloveSensorData( + UObject* Outer, const TArray& Values, int32 ParsedValues, + const FRotator& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging); + public: static USGNovaGloveSensorData* Empty(UObject* Outer); @@ -89,6 +93,9 @@ public: USGNovaGloveSensorData(const TArray& Values, int32 ParsedValues, const FQuat& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging); + USGNovaGloveSensorData(const TArray& Values, int32 ParsedValues, + const FRotator& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging); + public: /** * The cast from underlying type constructor. @@ -116,7 +123,9 @@ public: public: TArray GetSensorValues() const; - FQuat GetImuRotation() const; + FQuat GetImuRotationQ() const; + + FRotator GetImuRotation() const; int32 GetParsedValues() const; diff --git a/Source/SenseGloveCore/Public/SGCore/SGRotatorArray.h b/Source/SenseGloveCore/Public/SGCore/SGRotatorArray.h new file mode 100644 index 00000000..3060388a --- /dev/null +++ b/Source/SenseGloveCore/Public/SGCore/SGRotatorArray.h @@ -0,0 +1,50 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @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 "Math/Rotator.h" + +#include "SGRotatorArray.generated.h" + +USTRUCT(BlueprintType) +struct SENSEGLOVECORE_API FSGRotatorArray +{ + GENERATED_BODY() + +public: + UPROPERTY(EditAnywhere, BlueprintReadWrite) + TArray RotatorArray; +}; \ No newline at end of file diff --git a/Source/SenseGloveCore/Public/SGCore/SGSenseGlove.h b/Source/SenseGloveCore/Public/SGCore/SGSenseGlove.h index 3c82f6a8..00b18d45 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGSenseGlove.h +++ b/Source/SenseGloveCore/Public/SGCore/SGSenseGlove.h @@ -112,6 +112,11 @@ public: bool bRightHanded, ESGFinger MountedOn, FVector& OutGlovePosition, FQuat& OutGloveRotation); + static void CalculateGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, + bool bRightHanded, ESGFinger MountedOn, + FVector& OutGlovePosition, FRotator& OutGloveRotation); + static void CalculateWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, ESGFinger MountedOn, @@ -119,6 +124,13 @@ public: const FQuat& GloveWristRotationOffset, FVector& OutWristPosition, FQuat& OutWristRotation); + static void CalculateWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, + bool bRightHanded, ESGFinger MountedOn, + const FVector& GloveWristPositionOffset, + const FRotator& GloveWristRotationOffset, + FVector& OutWristPosition, FRotator& OutWristRotation); + private: struct FImpl; @@ -211,6 +223,8 @@ public: virtual bool GetImuRotation(FQuat& OutImu) override; + virtual bool GetImuRotation(FRotator& OutImu) override; + bool GetGlovePose(UObject* Outer, USGSenseGlovePose*& OutGlovePose); bool GetGlovePose(UObject* Outer, const USGSenseGloveSensorData* SensorData, USGSenseGlovePose*& OutGlovePose); @@ -251,20 +265,38 @@ public: ESGPositionalTrackingHardware TrackingHardware, FVector& OutGlovePosition, FQuat& OutGloveRotation) const override; + virtual void GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, + FVector& OutGlovePosition, FRotator& OutGloveRotation) const override; + void GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, ESGFinger MountedOn, FVector& OutGlovePosition, FQuat& OutGloveRotation) const; + void GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, ESGFinger MountedOn, + FVector& OutGlovePosition, FRotator& OutGloveRotation) const; + virtual void GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, FVector& OutWristPosition, FQuat& OutWristRotation) const override; + virtual void GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, + FVector& OutWristPosition, FRotator& OutWristRotation) const override; + void GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, const FVector& GloveWristPositionOffset, const FQuat& GloveWristRotationOffset, FVector& OutWristPosition, FQuat& OutWristRotation) const; + void GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, + const FVector& GloveWristPositionOffset, + const FRotator& GloveWristRotationOffset, + FVector& OutWristPosition, FRotator& OutWristRotation) const; + public: virtual FString ToString() const override; }; \ No newline at end of file diff --git a/Source/SenseGloveCore/Public/SGCore/SGSenseGloveInfo.h b/Source/SenseGloveCore/Public/SGCore/SGSenseGloveInfo.h index fb1b4189..f8c08488 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGSenseGloveInfo.h +++ b/Source/SenseGloveCore/Public/SGCore/SGSenseGloveInfo.h @@ -68,6 +68,13 @@ public: const TArray& StartPositions, const TArray& StartRotations, const TArray>& GloveLengths, const TArray& Functions); + static USGSenseGloveInfo* NewSenseGloveInfo( + UObject* Outer, const FString& DeviceId, + const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, + bool bRightHanded, int32 NumberOfSensors, const FRotator& ImuCorrection, + const TArray& StartPositions, const TArray& StartRotations, + const TArray>& GloveLengths, const TArray& Functions); + static USGSenseGloveInfo* NewSenseGloveInfo( UObject* Outer, const FString& DeviceId, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, @@ -75,6 +82,13 @@ public: const TArray& StartPositions, const TArray& StartRotations, const TArray& GloveLengths, const TArray& Functions); + static USGSenseGloveInfo* NewSenseGloveInfo( + UObject* Outer, const FString& DeviceId, + const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, + bool bRightHanded, int32 NumberOfSensors, const FRotator& ImuCorrection, + const TArray& StartPositions, const TArray& StartRotations, + const TArray& GloveLengths, const TArray& Functions); + public: static bool Parse(UObject* Outer, const FString& ConstantsString, USGSenseGloveInfo*& OutGloveInfo, bool bUpdateOldModels = true); @@ -101,12 +115,24 @@ public: const TArray& StartPositions, const TArray& StartRotations, const TArray>& GloveLengths, const TArray& Functions); + USGSenseGloveInfo(const FString& DeviceId, + const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, + bool bRightHanded, int32 NumberOfSensors, const FRotator& ImuCorrection, + const TArray& StartPositions, const TArray& StartRotations, + const TArray>& GloveLengths, const TArray& Functions); + USGSenseGloveInfo(const FString& DeviceId, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, bool bRightHanded, int32 NumberOfSensors, const FQuat& ImuCorrection, const TArray& StartPositions, const TArray& StartRotations, const TArray& GloveLengths, const TArray& Functions); + USGSenseGloveInfo(const FString& DeviceId, + const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, + bool bRightHanded, int32 NumberOfSensors, const FRotator& ImuCorrection, + const TArray& StartPositions, const TArray& StartRotations, + const TArray& GloveLengths, const TArray& Functions); + public: /** * The cast from underlying type constructor. @@ -150,11 +176,15 @@ public: int32 GetNumberOfSensors() const; - FQuat GetImuCorrection() const; + FQuat GetImuCorrectionQ() const; + + FRotator GetImuCorrection() const; TArray GetStartPositions() const; - TArray GetStartRotations() const; + TArray GetStartRotationsQ() const; + + TArray GetStartRotations() const; TArray> GetGloveLengths() const; @@ -163,7 +193,9 @@ public: public: FVector GetStartPosition(ESGFinger Finger) const; - FQuat GetStartRotation(ESGFinger Finger) const; + FQuat GetStartRotationQ(ESGFinger Finger) const; + + FRotator GetStartRotation(ESGFinger Finger) const; TArray GetGloveLengths(ESGFinger Finger) const; diff --git a/Source/SenseGloveCore/Public/SGCore/SGSenseGlovePose.h b/Source/SenseGloveCore/Public/SGCore/SGSenseGlovePose.h index 5222751a..5bf66616 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGSenseGlovePose.h +++ b/Source/SenseGloveCore/Public/SGCore/SGSenseGlovePose.h @@ -47,6 +47,7 @@ #include "SGCore/SGSenseGloveInfo.h" #include "SGCore/SGSenseGloveHandProfile.h" #include "SGCore/SGQuatArray.h" +#include "SGCore/SGRotatorArray.h" #include "SGCore/SGVectorArray.h" #include "SGUtils/SGArrayUtils.h" @@ -71,11 +72,21 @@ public: const TArray>& JointRotations, const TArray>& GloveAngles); + static USGSenseGlovePose* NewSenseGlovePose(UObject* Outer, bool bRightHanded, + const TArray>& JointPositions, + const TArray>& JointRotations, + const TArray>& GloveAngles); + static USGSenseGlovePose* NewSenseGlovePose(UObject* Outer, bool bRightHanded, const TArray& JointPositions, const TArray& JointRotations, const TArray& GloveAngles); + static USGSenseGlovePose* NewSenseGlovePose(UObject* Outer, bool bRightHanded, + const TArray& JointPositions, + const TArray& JointRotations, + const TArray& GloveAngles); + public: static USGSenseGlovePose* IdlePose(UObject* Outer, const USGSenseGloveInfo* GloveInfo); @@ -100,11 +111,21 @@ public: const TArray>& JointRotations, const TArray>& GloveAngles); + USGSenseGlovePose(bool bRightHanded, + const TArray>& JointPositions, + const TArray>& JointRotations, + const TArray>& GloveAngles); + USGSenseGlovePose(bool bRightHanded, const TArray& JointPositions, const TArray& JointRotations, const TArray& GloveAngles); + USGSenseGlovePose(bool bRightHanded, + const TArray& JointPositions, + const TArray& JointRotations, + const TArray& GloveAngles); + public: /** * The cast from underlying type constructor. @@ -134,14 +155,18 @@ public: TArray> GetJointPositions() const; - TArray> GetJointRotations() const; + TArray> GetJointRotationsQ() const; + + TArray> GetJointRotations() const; TArray> GetGloveAngles() const; public: TArray GetThimblePositions() const; - TArray GetThimbleRotations() const; + TArray GetThimbleRotationsQ() const; + + TArray GetThimbleRotations() const; TArray GetTotalGloveAngles() const; diff --git a/Source/SenseGloveCore/Public/SGCore/SGSenseGloveSensorData.h b/Source/SenseGloveCore/Public/SGCore/SGSenseGloveSensorData.h index 807bd949..7961029f 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGSenseGloveSensorData.h +++ b/Source/SenseGloveCore/Public/SGCore/SGSenseGloveSensorData.h @@ -66,10 +66,18 @@ public: UObject* Outer, const TArray>& SensorAngles, const FQuat& ImuRotation, int32 ParsedValues, bool bImuParsed); + static USGSenseGloveSensorData* NewSenseGloveSensorData( + UObject* Outer, const TArray>& SensorAngles, + const FRotator& ImuRotation, int32 ParsedValues, bool bImuParsed); + static USGSenseGloveSensorData* NewSenseGloveSensorData( UObject* Outer, const TArray& SensorAngles, const FQuat& ImuRotation, int32 ParsedValues, bool bImuParsed); + static USGSenseGloveSensorData* NewSenseGloveSensorData( + UObject* Outer, const TArray& SensorAngles, + const FRotator& ImuRotation, int32 ParsedValues, bool bImuParsed); + public: static USGSenseGloveSensorData* Empty(UObject* Outer); @@ -94,9 +102,15 @@ public: USGSenseGloveSensorData(const TArray>& SensorAngles, const FQuat& ImuRotation, int32 ParsedValues, bool bImuParsed); + USGSenseGloveSensorData(const TArray>& SensorAngles, + const FRotator& ImuRotation, int32 ParsedValues, bool bImuParsed); + USGSenseGloveSensorData(const TArray& SensorAngles, const FQuat& ImuRotation, int32 ParsedValues, bool bImuParsed); + USGSenseGloveSensorData(const TArray& SensorAngles, + const FRotator& ImuRotation, int32 ParsedValues, bool bImuParsed); + public: /** * The cast from underlying type constructor. @@ -124,7 +138,9 @@ public: public: TArray> GetSensorAngles() const; - FQuat GetImuRotation() const; + FQuat GetImuRotationQ() const; + + FRotator GetImuRotation() const; int32 GetParsedValues() const; diff --git a/Source/SenseGloveCore/Public/SGCore/SGSenseGloveVars.h b/Source/SenseGloveCore/Public/SGCore/SGSenseGloveVars.h index 41fd9c8b..d442d18d 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGSenseGloveVars.h +++ b/Source/SenseGloveCore/Public/SGCore/SGSenseGloveVars.h @@ -57,13 +57,17 @@ public: static TArray GetStartPositions(const FString& HardwareVersion, bool bRightHanded); - static TArray GetStartRotations(const FString& HardwareVersion, bool bRightHanded); + static TArray GetStartRotationsQ(const FString& HardwareVersion, bool bRightHanded); + + static TArray GetStartRotations(const FString& HardwareVersion, bool bRightHanded); static TArray> GetGloveLengths(const FString& HardwareVersion); static int32 GetSensors(const FString& HardwareVersion); - static FQuat GetImuCorrection(const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion); + static FQuat GetImuCorrectionQ(const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion); + + static FRotator GetImuCorrection(const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion); static TArray GetFunctions(const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion); diff --git a/Source/SenseGloveCore/Public/SGCore/SGTracking.h b/Source/SenseGloveCore/Public/SGCore/SGTracking.h index 20920e8d..a57fbc24 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGTracking.h +++ b/Source/SenseGloveCore/Public/SGCore/SGTracking.h @@ -55,58 +55,96 @@ public: const FVector& PositionOffset, const FQuat& RotationOffset, FVector& OutNewPosition, FQuat& OutNewRotation); + static void CalculateLocation( + const FVector& TrackedPosition, const FRotator& TrackedRotation, + const FVector& PositionOffset, const FRotator& RotationOffset, + FVector& OutNewPosition, FRotator& OutNewRotation); + static TArray GetSenseGloveFingerToGlovePositionOrigin(); - static TArray GetSenseGloveFingerToGloveRotationOrigin(); + static TArray GetSenseGloveFingerToGloveRotationOriginQ(); + + static TArray GetSenseGloveFingerToGloveRotationOrigin(); static FVector GetSenseGloveWristPositionOffset(); - static FQuat GetSenseGloveWristRotationOffset(); + static FQuat GetSenseGloveWristRotationOffsetQ(); + + static FRotator GetSenseGloveWristRotationOffset(); static void GetSenseGloveMountOffset(bool bRightHanded, ESGFinger ToFinger, FVector& OutIPosition, FQuat& OutIRotation); + static void GetSenseGloveMountOffset(bool bRightHanded, ESGFinger ToFinger, + FVector& OutIPosition, FRotator& OutIRotation); + static void GetSenseGloveTrackerMountOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset); + static void GetSenseGloveTrackerMountOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded, + FVector& OutPositionOffset, FRotator& OutRotationOffset); + static FVector GetSenseGloveViveToAttachPosition(); - static FQuat GetSenseGloveViveToAttachRotation(); + static FQuat GetSenseGloveViveToAttachRotationQ(); + + static FRotator GetSenseGloveViveToAttachRotation(); static FVector GetSenseGloveOculusTouchToAttachPosition(); - static FQuat GetSenseGloveOculusTouchToAttachRotation(); + static FQuat GetSenseGloveOculusTouchToAttachRotationQ(); + + static FRotator GetSenseGloveOculusTouchToAttachRotation(); static FVector GetNovaToWristPositionOffset(); - static FQuat GetNovaToWristRotationOffset(); + static FQuat GetNovaToWristRotationOffsetQ(); + + static FRotator GetNovaToWristRotationOffset(); static void GetNovaGloveWristOffset(bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset); + static void GetNovaGloveWristOffset(bool bRightHanded, FVector& OutPositionOffset, FRotator& OutRotationOffset); + static FVector GetRightNovaViveToAttachPosition(); - static FQuat GetRightNovaViveToAttachRotation(); + static FQuat GetRightNovaViveToAttachRotationQ(); + + static FRotator GetRightNovaViveToAttachRotation(); static FVector GetLeftNovaViveToAttachPosition(); - static FQuat GetLeftNovaViveToAttachRotation(); + static FQuat GetLeftNovaViveToAttachRotationQ(); + + static FRotator GetLeftNovaViveToAttachRotation(); static FVector GetRightNovaQuest2ToAttachPosition(); - static FQuat GetRightNovaQuest2ToAttachRotation(); + static FQuat GetRightNovaQuest2ToAttachRotationQ(); + + static FRotator GetRightNovaQuest2ToAttachRotation(); static FVector GetLeftNovaQuest2ToAttachPosition(); - static FQuat GetLeftNovaQuest2ToAttachRotation(); + static FQuat GetLeftNovaQuest2ToAttachRotationQ(); + + static FRotator GetLeftNovaQuest2ToAttachRotation(); static FVector GetRightNovaPico2ToAttachPosition(); - static FQuat GetRightNovaPico2ToAttachRotation(); + static FQuat GetRightNovaPico2ToAttachRotationQ(); - static FQuat GetLeftNovaPico2ToAttachRotation(); + static FRotator GetRightNovaPico2ToAttachRotation(); + + static FQuat GetLeftNovaPico2ToAttachRotationQ(); + + static FRotator GetLeftNovaPico2ToAttachRotation(); static void GetNovaGloveTrackerOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset); + static void GetNovaGloveTrackerOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded, + FVector& OutPositionOffset, FRotator& OutRotationOffset); + static FString ToString(ESGPositionalTrackingHardware Hardware); }; \ No newline at end of file diff --git a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGBasicHandModelKismetLibrary.cpp b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGBasicHandModelKismetLibrary.cpp index 823e6abc..2091fb4d 100644 --- a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGBasicHandModelKismetLibrary.cpp +++ b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGBasicHandModelKismetLibrary.cpp @@ -51,7 +51,7 @@ USGBasicHandModel* USGBasicHandModelKismetLibrary::MakeBasicHandModel_bRightHand } USGBasicHandModel* USGBasicHandModelKismetLibrary:: -MakeBasicHandModel_bRightHanded_Lengths_StartPositions_StartRotations( +MakeBasicHandModel_bRightHanded_Lengths_StartPositions_TArrayFQuatStartRotations( UObject* WorldContextObject, const bool bRightHanded, const TArray& Lengths, const TArray& StartPositions, const TArray& StartRotations) @@ -60,6 +60,16 @@ MakeBasicHandModel_bRightHanded_Lengths_StartPositions_StartRotations( StartPositions, StartRotations); } +USGBasicHandModel* USGBasicHandModelKismetLibrary:: +MakeBasicHandModel_bRightHanded_Lengths_StartPositions_TArrayFRotatorStartRotations( + UObject* WorldContextObject, + const bool bRightHanded, const TArray& Lengths, + const TArray& StartPositions, const TArray& StartRotations) +{ + return USGBasicHandModel::NewBasicHandModel(WorldContextObject, bRightHanded, Lengths, + StartPositions, StartRotations); +} + USGBasicHandModel* USGBasicHandModelKismetLibrary::Default(UObject* WorldContextObject, const bool bRightHanded) { return USGBasicHandModel::Default(WorldContextObject, bRightHanded); @@ -142,7 +152,14 @@ void USGBasicHandModelKismetLibrary::SetStartJointPosition_uint8Finger(USGBasicH BasicHandModel->SetStartJointPosition(Finger, Position); } -TArray USGBasicHandModelKismetLibrary::GetStartJointRotations(const USGBasicHandModel* BasicHandModel) +TArray USGBasicHandModelKismetLibrary::GetStartJointRotations_TArrayFQuat( + const USGBasicHandModel* BasicHandModel) +{ + return BasicHandModel->GetStartJointRotationsQ(); +} + +TArray USGBasicHandModelKismetLibrary::GetStartJointRotations_TArrayFRotator( + const USGBasicHandModel* BasicHandModel) { return BasicHandModel->GetStartJointRotations(); } @@ -159,13 +176,26 @@ void USGBasicHandModelKismetLibrary::SetJointPosition(USGBasicHandModel* BasicHa return BasicHandModel->SetJointPosition(NewPosition, Finger); } -FQuat USGBasicHandModelKismetLibrary::GetJointRotation(const USGBasicHandModel* BasicHandModel, const ESGFinger Finger) +FQuat USGBasicHandModelKismetLibrary::GetJointRotation_FQuat(const USGBasicHandModel* BasicHandModel, + const ESGFinger Finger) +{ + return BasicHandModel->GetJointRotationQ(Finger); +} + +FRotator USGBasicHandModelKismetLibrary::GetJointRotation_FRotator(const USGBasicHandModel* BasicHandModel, + const ESGFinger Finger) { return BasicHandModel->GetJointRotation(Finger); } -void USGBasicHandModelKismetLibrary::SetJointRotation(USGBasicHandModel* BasicHandModel, const FQuat& NewRotation, - const ESGFinger Finger) +void USGBasicHandModelKismetLibrary::SetJointRotation_FQuatNewRotation_Finger( + USGBasicHandModel* BasicHandModel, const FQuat& NewRotation, const ESGFinger Finger) +{ + return BasicHandModel->SetJointRotation(NewRotation, Finger); +} + +void USGBasicHandModelKismetLibrary::SetJointRotation_FRotatorNewRotation_Finger( + USGBasicHandModel* BasicHandModel, const FRotator& NewRotation, const ESGFinger Finger) { return BasicHandModel->SetJointRotation(NewRotation, Finger); } diff --git a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGHandInterpolatorKismetLibrary.cpp b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGHandInterpolatorKismetLibrary.cpp index 508703e7..9a0263c1 100644 --- a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGHandInterpolatorKismetLibrary.cpp +++ b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGHandInterpolatorKismetLibrary.cpp @@ -49,13 +49,21 @@ USGHandInterpolator* USGHandInterpolatorKismetLibrary::MakeHandInterpolator_Join return USGHandInterpolator::NewHandInterpolator(WorldContextObject, JointInterpolations); } -USGHandInterpolator* USGHandInterpolatorKismetLibrary::MakeHandInterpolator_JointInterpolations_CmcStartRotation( +USGHandInterpolator* USGHandInterpolatorKismetLibrary::MakeHandInterpolator_JointInterpolations_FQuatCmcStartRotation( UObject* WorldContextObject, const TArray& JointInterpolations, const FQuat& CmcStartRotation) { return USGHandInterpolator::NewHandInterpolator(WorldContextObject, JointInterpolations, CmcStartRotation); } +USGHandInterpolator* +USGHandInterpolatorKismetLibrary::MakeHandInterpolator_JointInterpolations_FRotatorCmcStartRotation( + UObject* WorldContextObject, + const TArray& JointInterpolations, const FRotator& CmcStartRotation) +{ + return USGHandInterpolator::NewHandInterpolator(WorldContextObject, JointInterpolations, CmcStartRotation); +} + USGHandInterpolator* USGHandInterpolatorKismetLibrary::Default(UObject* WorldContextObject, const bool bRightHanded) { return USGHandInterpolator::Default(WorldContextObject, bRightHanded); @@ -93,7 +101,13 @@ TArray USGHandInterpolatorKismetLibrary::GetJointInter HandInterpolator->GetJointInterpolations(WorldContextObject)); } -FQuat USGHandInterpolatorKismetLibrary::GetCmcStartRotation(const USGHandInterpolator* HandInterpolator) const +FQuat USGHandInterpolatorKismetLibrary::GetCmcStartRotation_FQuat(const USGHandInterpolator* HandInterpolator) const +{ + return HandInterpolator->GetCmcStartRotationQ(); +} + +FRotator USGHandInterpolatorKismetLibrary::GetCmcStartRotation_FRotator( + const USGHandInterpolator* HandInterpolator) const { return HandInterpolator->GetCmcStartRotation(); } diff --git a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGHandPoseKismetLibrary.cpp b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGHandPoseKismetLibrary.cpp index 2d70e5cb..c191b73b 100644 --- a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGHandPoseKismetLibrary.cpp +++ b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGHandPoseKismetLibrary.cpp @@ -44,7 +44,7 @@ USGHandPose* USGHandPoseKismetLibrary::MakeHandPose(UObject* WorldContextObject) return USGHandPose::NewHandPose(WorldContextObject); } -USGHandPose* USGHandPoseKismetLibrary::MakeHandPose_bRightHanded_JointPositions_JointRotations_HandAngles( +USGHandPose* USGHandPoseKismetLibrary::MakeHandPose_bRightHanded_JointPositions_FSGQuatArrayJointRotations_HandAngles( UObject* WorldContextObject, const bool bRightHanded, const TArray& JointPositions, const TArray& JointRotations, const TArray& HandAngles) @@ -52,6 +52,16 @@ USGHandPose* USGHandPoseKismetLibrary::MakeHandPose_bRightHanded_JointPositions_ return USGHandPose::NewHandPose(WorldContextObject, bRightHanded, JointPositions, JointRotations, HandAngles); } +USGHandPose* USGHandPoseKismetLibrary:: +MakeHandPose_bRightHanded_JointPositions_FSGRotatorArrayJointRotations_HandAngles( + UObject* WorldContextObject, + const bool bRightHanded, + const TArray& JointPositions, const TArray& JointRotations, + const TArray& HandAngles) +{ + return USGHandPose::NewHandPose(WorldContextObject, bRightHanded, JointPositions, JointRotations, HandAngles); +} + USGHandPose* USGHandPoseKismetLibrary::Deserialize(UObject* WorldContextObject, const FString& SerializedString) { return USGHandPose::Deserialize(WorldContextObject, SerializedString); @@ -132,9 +142,14 @@ TArray USGHandPoseKismetLibrary::GetJointPositions(const USGHand return FSGArrayUtils::ToBPNestedArray(HandPose->GetJointPositions()); } -TArray USGHandPoseKismetLibrary::GetJointRotations(const USGHandPose* HandPose) +TArray USGHandPoseKismetLibrary::GetJointRotationsQ(const USGHandPose* HandPose) { - return FSGArrayUtils::ToBPNestedArray(HandPose->GetJointRotations()); + return FSGArrayUtils::ToBPNestedArray(HandPose->GetJointRotationsQ()); +} + +TArray USGHandPoseKismetLibrary::GetJointRotations(const USGHandPose* HandPose) +{ + return FSGArrayUtils::ToBPNestedArray(HandPose->GetJointRotations()); } TArray USGHandPoseKismetLibrary::GetHandAngles(const USGHandPose* HandPose) diff --git a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGHapticGloveKismetLibrary.cpp b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGHapticGloveKismetLibrary.cpp index 2289ecef..181867e6 100644 --- a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGHapticGloveKismetLibrary.cpp +++ b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGHapticGloveKismetLibrary.cpp @@ -89,7 +89,12 @@ bool USGHapticGloveKismetLibrary::IsRight(const USGHapticGlove* HapticGlove) return HapticGlove->IsRight(); } -bool USGHapticGloveKismetLibrary::GetImuRotation(USGHapticGlove* HapticGlove, FQuat& OutImu) +bool USGHapticGloveKismetLibrary::GetImuRotation_FQuatOutImu(USGHapticGlove* HapticGlove, FQuat& OutImu) +{ + return HapticGlove->GetImuRotation(OutImu); +} + +bool USGHapticGloveKismetLibrary::GetImuRotation_FRotatorOutImu(USGHapticGlove* HapticGlove, FRotator& OutImu) { return HapticGlove->GetImuRotation(OutImu); } @@ -205,21 +210,48 @@ void USGHapticGloveKismetLibrary::ApplyCalibration( HapticGlove->ApplyCalibration(WorldContextObject, OutProfile); } -void USGHapticGloveKismetLibrary::GetWristLocation(const USGHapticGlove* HapticGlove, - const FVector& ReferencePosition, const FQuat& ReferenceRotation, - ESGPositionalTrackingHardware TrackingHardware, - FVector& OutWristPosition, FQuat& OutWristRotation) +void USGHapticGloveKismetLibrary:: +GetWristLocation_ReferencePosition_ReferenceRotation_TrackingHardware_OutWristPosition_OutWristLocation( + const USGHapticGlove* HapticGlove, + const FVector& ReferencePosition, const FQuat& ReferenceRotation, + const ESGPositionalTrackingHardware TrackingHardware, + FVector& OutWristPosition, FQuat& OutWristRotation) { HapticGlove->GetWristLocation(ReferencePosition, ReferenceRotation, TrackingHardware, OutWristPosition, OutWristRotation); } -void USGHapticGloveKismetLibrary::GetGloveLocation(const USGHapticGlove* HapticGlove, const FVector& ReferencePosition, - const FQuat& ReferenceRotation, - ESGPositionalTrackingHardware TrackingHardware, - FVector& OutGlovePosition, - FQuat& OutGloveRotation) +void USGHapticGloveKismetLibrary:: +GetWristLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_OutWristPosition_FRotatorOutWristLocation( + const USGHapticGlove* HapticGlove, + const FVector& ReferencePosition, const FRotator& ReferenceRotation, + const ESGPositionalTrackingHardware TrackingHardware, + FVector& OutWristPosition, FRotator& OutWristRotation) +{ + HapticGlove->GetWristLocation(ReferencePosition, ReferenceRotation, + TrackingHardware, + OutWristPosition, OutWristRotation); +} + +void USGHapticGloveKismetLibrary:: +GetGloveLocation_ReferencePosition_ReferenceRotation_TrackingHardware_OutGlovePosition_OutGloveRotation( + const USGHapticGlove* HapticGlove, + const FVector& ReferencePosition, const FQuat& ReferenceRotation, + const ESGPositionalTrackingHardware TrackingHardware, + FVector& OutGlovePosition, FQuat& OutGloveRotation) +{ + HapticGlove->GetGloveLocation(ReferencePosition, ReferenceRotation, + TrackingHardware, + OutGlovePosition, OutGloveRotation); +} + +void USGHapticGloveKismetLibrary:: +GetGloveLocation_FRotatorReferencePosition_ReferenceRotation_TrackingHardware_OutGlovePosition_FRotatorOutGloveRotation( + const USGHapticGlove* HapticGlove, + const FVector& ReferencePosition, const FRotator& ReferenceRotation, + const ESGPositionalTrackingHardware TrackingHardware, + FVector& OutGlovePosition, FRotator& OutGloveRotation) { HapticGlove->GetGloveLocation(ReferencePosition, ReferenceRotation, TrackingHardware, diff --git a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGJointKinematicsKismetLibrary.cpp b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGJointKinematicsKismetLibrary.cpp index 8158f298..9202884d 100644 --- a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGJointKinematicsKismetLibrary.cpp +++ b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGJointKinematicsKismetLibrary.cpp @@ -38,7 +38,7 @@ #include "SGCore/SGJointKinematics.h" bool USGJointKinematicsKismetLibrary:: -ForwardKinematics_StartPosition_StartRotation_JointLengths_JointAngles_OutNewPositions_OutNewRotations( +ForwardKinematics_StartPosition_FQuatStartRotation_JointLengths_JointAngles_OutNewPositions_TArrayFQuatOutNewRotations( const FVector& StartPosition, const FQuat& StartRotation, const TArray& JointLengths, const TArray& JointAngles, TArray& OutNewPositions, TArray& OutNewRotations) { @@ -46,9 +46,27 @@ ForwardKinematics_StartPosition_StartRotation_JointLengths_JointAngles_OutNewPos OutNewPositions, OutNewRotations); } -bool USGJointKinematicsKismetLibrary::ForwardKinematics_Profile_Finger_JointAngles_OutNewPositions_OutNewRotations( - const USGBasicHandModel* Profile, ESGFinger Finger, const TArray& JointAngles, +bool USGJointKinematicsKismetLibrary:: +ForwardKinematics_StartPosition_FRotatorStartRotation_JointLengths_JointAngles_OutNewPositions_TArrayFRotatorOutNewRotations( + const FVector& StartPosition, const FRotator& StartRotation, const TArray& JointLengths, + const TArray& JointAngles, TArray& OutNewPositions, TArray& OutNewRotations) +{ + return FSGJointKinematics::ForwardKinematics(StartPosition, StartRotation, JointLengths, JointAngles, + OutNewPositions, OutNewRotations); +} + +bool +USGJointKinematicsKismetLibrary::ForwardKinematics_Profile_Finger_JointAngles_OutNewPositions_TArrayFQuatOutNewRotations( + const USGBasicHandModel* Profile, const ESGFinger Finger, const TArray& JointAngles, TArray& OutNewPositions, TArray& OutNewRotations) { return FSGJointKinematics::ForwardKinematics(Profile, Finger, JointAngles, OutNewPositions, OutNewRotations); +} + +bool +USGJointKinematicsKismetLibrary::ForwardKinematics_Profile_Finger_JointAngles_OutNewPositions_TArrayFRotatorOutNewRotations( + const USGBasicHandModel* Profile, const ESGFinger Finger, const TArray& JointAngles, + TArray& OutNewPositions, TArray& OutNewRotations) +{ + return FSGJointKinematics::ForwardKinematics(Profile, Finger, JointAngles, OutNewPositions, OutNewRotations); } \ No newline at end of file diff --git a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGNovaGloveKismetLibrary.cpp b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGNovaGloveKismetLibrary.cpp index 6309722d..9b3f1382 100644 --- a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGNovaGloveKismetLibrary.cpp +++ b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGNovaGloveKismetLibrary.cpp @@ -94,7 +94,8 @@ void USGNovaGloveKismetLibrary::CalibrateInterpolation( USGNovaGlove::CalibrateInterpolation(WorldContextObject, MinValues, MaxValues, OutProfile); } -void USGNovaGloveKismetLibrary::CalculateGloveLocation( +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) @@ -104,11 +105,33 @@ void USGNovaGloveKismetLibrary::CalculateGloveLocation( OutGlovePosition, OutGloveRotation); } -void USGNovaGloveKismetLibrary::CalculateWristLocation(const FVector& ReferencePosition, - const FQuat& ReferenceRotation, - const ESGPositionalTrackingHardware TrackingHardware, - const bool bRightHanded, - FVector& OutWristPosition, FQuat& OutWristRotation) +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, @@ -176,7 +199,12 @@ bool USGNovaGloveKismetLibrary::GetSensorData( return NovaGlove->GetSensorData(WorldContextObject, OutSensorData); } -bool USGNovaGloveKismetLibrary::GetImuRotation(USGNovaGlove* NovaGlove, FQuat& OutImu) +bool USGNovaGloveKismetLibrary::GetImuRotation_FQuatOutImu(USGNovaGlove* NovaGlove, FQuat& OutImu) +{ + return NovaGlove->GetImuRotation(OutImu); +} + +bool USGNovaGloveKismetLibrary::GetImuRotation_FRotatorOutImu(USGNovaGlove* NovaGlove, FRotator& OutImu) { return NovaGlove->GetImuRotation(OutImu); } @@ -248,7 +276,7 @@ void USGNovaGloveKismetLibrary::ApplyCalibration_NovaGloveHandProfile( } void USGNovaGloveKismetLibrary:: -GetGloveLocation_ReferencePosition_ReferenceRotation_TrackingHardware_OutGlovePosition_OutGloveRotation( +GetGloveLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_OutGlovePosition_FQuatOutGloveRotation( const USGNovaGlove* NovaGlove, const FVector& ReferencePosition, const FQuat& ReferenceRotation, const ESGPositionalTrackingHardware TrackingHardware, @@ -260,7 +288,19 @@ GetGloveLocation_ReferencePosition_ReferenceRotation_TrackingHardware_OutGlovePo } void USGNovaGloveKismetLibrary:: -GetWristLocation_GetWristLocation_ReferencePosition_ReferenceRotation_TrackingHardware_OutWristPosition_OutWristRotation( +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, @@ -271,6 +311,18 @@ GetWristLocation_GetWristLocation_ReferencePosition_ReferenceRotation_TrackingHa 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(); diff --git a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGNovaGloveSensorDataKismetLibrary.cpp b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGNovaGloveSensorDataKismetLibrary.cpp index 93835303..06fbb1a1 100644 --- a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGNovaGloveSensorDataKismetLibrary.cpp +++ b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGNovaGloveSensorDataKismetLibrary.cpp @@ -43,7 +43,7 @@ USGNovaGloveSensorData* USGNovaGloveSensorDataKismetLibrary::MakeNovaGloveSensor } USGNovaGloveSensorData* USGNovaGloveSensorDataKismetLibrary:: -MakeNovaGloveSensorData_Values_ParsedValues_ImuRotation_bImuParsed_BatteryLevel_bCharging( +MakeNovaGloveSensorData_Values_ParsedValues_FQuatImuRotation_bImuParsed_BatteryLevel_bCharging( UObject* WorldContextObject, const TArray& Values, const int32 ParsedValues, const FQuat& ImuRotation, const bool bImuParsed, const float BatteryLevel, const bool bCharging) { @@ -51,6 +51,15 @@ MakeNovaGloveSensorData_Values_ParsedValues_ImuRotation_bImuParsed_BatteryLevel_ WorldContextObject, Values, ParsedValues, ImuRotation, bImuParsed, BatteryLevel, bCharging); } +USGNovaGloveSensorData* USGNovaGloveSensorDataKismetLibrary:: +MakeNovaGloveSensorData_Values_ParsedValues_FRotatorImuRotation_bImuParsed_BatteryLevel_bCharging( + UObject* WorldContextObject, const TArray& Values, const int32 ParsedValues, + const FRotator& ImuRotation, const bool bImuParsed, const float BatteryLevel, const bool bCharging) +{ + return USGNovaGloveSensorData::NewNovaGloveSensorData( + WorldContextObject, Values, ParsedValues, ImuRotation, bImuParsed, BatteryLevel, bCharging); +} + USGNovaGloveSensorData* USGNovaGloveSensorDataKismetLibrary::Empty(UObject* WorldContextObject) { return USGNovaGloveSensorData::Empty(WorldContextObject); @@ -74,7 +83,12 @@ TArray USGNovaGloveSensorDataKismetLibrary::GetSensorValues( return NovaGloveSensorData->GetSensorValues(); } -FQuat USGNovaGloveSensorDataKismetLibrary::GetImuRotation(const USGNovaGloveSensorData* NovaGloveSensorData) +FQuat USGNovaGloveSensorDataKismetLibrary::GetImuRotation_FQuat(const USGNovaGloveSensorData* NovaGloveSensorData) +{ + return NovaGloveSensorData->GetImuRotationQ(); +} + +FRotator USGNovaGloveSensorDataKismetLibrary::GetImuRotation_FRotator(const USGNovaGloveSensorData* NovaGloveSensorData) { return NovaGloveSensorData->GetImuRotation(); } diff --git a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGloveInfoKismetLibrary.cpp b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGloveInfoKismetLibrary.cpp index d12db5e3..10fb6302 100644 --- a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGloveInfoKismetLibrary.cpp +++ b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGloveInfoKismetLibrary.cpp @@ -44,7 +44,7 @@ USGSenseGloveInfo* USGSenseGloveInfoKismetLibrary::MakeSenseGloveInfo(UObject* W } USGSenseGloveInfo* -USGSenseGloveInfoKismetLibrary::MakeSenseGloveInfo_DeviceId_HardwareVersion_FirmwareVersion_SubFirmwareVersion_bRightHanded_NumberOfSensors_ImuCorrection_StartPosition_StartRotation_GloveLengths_Functions( +USGSenseGloveInfoKismetLibrary::MakeSenseGloveInfo_DeviceId_HardwareVersion_FirmwareVersion_SubFirmwareVersion_bRightHanded_NumberOfSensors_FQuatImuCorrection_StartPositions_TArrayFQuatStartRotations_GloveLengths_Functions( UObject* WorldContextObject, const FString& DeviceId, const FString& HardwareVersion, const int32 FirmwareVersion, const int32 SubFirmwareVersion, const bool bRightHanded, const int32 NumberOfSensors, const FQuat& ImuCorrection, @@ -58,6 +58,21 @@ USGSenseGloveInfoKismetLibrary::MakeSenseGloveInfo_DeviceId_HardwareVersion_Firm GloveLengths, Functions); } +USGSenseGloveInfo* +USGSenseGloveInfoKismetLibrary::MakeSenseGloveInfo_DeviceId_HardwareVersion_FirmwareVersion_SubFirmwareVersion_bRightHanded_NumberOfSensors_FRotatorImuCorrection_StartPositions_TArrayFRotatorStartRotations_GloveLengths_Functions( + UObject* WorldContextObject, const FString& DeviceId, + const FString& HardwareVersion, const int32 FirmwareVersion, const int32 SubFirmwareVersion, + const bool bRightHanded, const int32 NumberOfSensors, const FRotator& ImuCorrection, + const TArray& StartPositions, const TArray& StartRotations, + const TArray& GloveLengths, const TArray& Functions) +{ + return USGSenseGloveInfo::NewSenseGloveInfo(WorldContextObject, DeviceId, + HardwareVersion, FirmwareVersion, SubFirmwareVersion, + bRightHanded, NumberOfSensors, ImuCorrection, + StartPositions, StartRotations, + GloveLengths, Functions); +} + bool USGSenseGloveInfoKismetLibrary::Parse(UObject* WorldContextObject, const FString& ConstantsString, USGSenseGloveInfo*& OutGloveInfo, const bool bUpdateOldModels) @@ -101,7 +116,12 @@ int32 USGSenseGloveInfoKismetLibrary::GetNumberOfSensors(const USGSenseGloveInfo return SenseGloveInfo->GetNumberOfSensors(); } -FQuat USGSenseGloveInfoKismetLibrary::GetImuCorrection(const USGSenseGloveInfo* SenseGloveInfo) +FQuat USGSenseGloveInfoKismetLibrary::GetImuCorrection_FQuat(const USGSenseGloveInfo* SenseGloveInfo) +{ + return SenseGloveInfo->GetImuCorrectionQ(); +} + +FRotator USGSenseGloveInfoKismetLibrary::GetImuCorrection_FRotator(const USGSenseGloveInfo* SenseGloveInfo) { return SenseGloveInfo->GetImuCorrection(); } @@ -111,7 +131,13 @@ TArray USGSenseGloveInfoKismetLibrary::GetStartPositions(const USGSense return SenseGloveInfo->GetStartPositions(); } -TArray USGSenseGloveInfoKismetLibrary::GetStartRotations(const USGSenseGloveInfo* SenseGloveInfo) +TArray USGSenseGloveInfoKismetLibrary::GetStartRotations_TArrayFQuat(const USGSenseGloveInfo* SenseGloveInfo) +{ + return SenseGloveInfo->GetStartRotationsQ(); +} + +TArray USGSenseGloveInfoKismetLibrary::GetStartRotations_TArrayFRotator( + const USGSenseGloveInfo* SenseGloveInfo) { return SenseGloveInfo->GetStartRotations(); } @@ -132,7 +158,14 @@ FVector USGSenseGloveInfoKismetLibrary::GetStartPosition(const USGSenseGloveInfo return SenseGloveInfo->GetStartPosition(Finger); } -FQuat USGSenseGloveInfoKismetLibrary::GetStartRotation(const USGSenseGloveInfo* SenseGloveInfo, const ESGFinger Finger) +FQuat USGSenseGloveInfoKismetLibrary::GetStartRotation_FQuat(const USGSenseGloveInfo* SenseGloveInfo, + const ESGFinger Finger) +{ + return SenseGloveInfo->GetStartRotationQ(Finger); +} + +FRotator USGSenseGloveInfoKismetLibrary::GetStartRotation_FRotator(const USGSenseGloveInfo* SenseGloveInfo, + const ESGFinger Finger) { return SenseGloveInfo->GetStartRotation(Finger); } diff --git a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGloveKismetLibrary.cpp b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGloveKismetLibrary.cpp index f4814b74..ca125ade 100644 --- a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGloveKismetLibrary.cpp +++ b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGloveKismetLibrary.cpp @@ -108,7 +108,8 @@ void USGSenseGloveKismetLibrary::CalibrateInterpolation( USGSenseGlove::CalibrateInterpolation(WorldContextObject, MinValues, MaxValues, bRightHanded, OutProfile); } -void USGSenseGloveKismetLibrary::CalculateGloveLocation( +void USGSenseGloveKismetLibrary:: +CalculateGloveLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_bRightHanded_MountedOn_OutGlovePosition_FQuatOutGloveRotation( const FVector& ReferencePosition, const FQuat& ReferenceRotation, const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded, const ESGFinger MountedOn, FVector& OutGlovePosition, FQuat& OutGloveRotation) @@ -118,13 +119,36 @@ void USGSenseGloveKismetLibrary::CalculateGloveLocation( OutGlovePosition, OutGloveRotation); } -void USGSenseGloveKismetLibrary::CalculateWristLocation(const FVector& ReferencePosition, - const FQuat& ReferenceRotation, - ESGPositionalTrackingHardware TrackingHardware, - const bool bRightHanded, const ESGFinger MountedOn, - const FVector& GloveWristPositionOffset, - const FQuat& GloveWristRotationOffset, - FVector& OutWristPosition, FQuat& OutWristRotation) +void USGSenseGloveKismetLibrary:: +CalculateGloveLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_bRightHanded_MountedOn_OutGlovePosition_FRotatorOutGloveRotation( + 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_ReferencePosition_FQuatReferenceRotation_TrackingHardware_bRightHanded_MountedOn_GloveWristPositionOffset_FQuatGloveWristRotationOffset_OutWristPosition_FQuatOutWristRotation( + 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_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_bRightHanded_MountedOn_GloveWristPositionOffset_FRotatorGloveWristRotationOffset_OutWristPosition_FRotatorOutWristRotation( + 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, @@ -174,7 +198,12 @@ bool USGSenseGloveKismetLibrary::GetSensorData(UObject* WorldContextObject, cons return SenseGlove->GetSensorData(WorldContextObject, OutSensorData); } -bool USGSenseGloveKismetLibrary::GetImuRotation(USGSenseGlove* SenseGlove, FQuat& OutImu) +bool USGSenseGloveKismetLibrary::GetImuRotation_FQuatOutImu(USGSenseGlove* SenseGlove, FQuat& OutImu) +{ + return SenseGlove->GetImuRotation(OutImu); +} + +bool USGSenseGloveKismetLibrary::GetImuRotation_FRotatorOutImu(USGSenseGlove* SenseGlove, FRotator& OutImu) { return SenseGlove->GetImuRotation(OutImu); } @@ -258,7 +287,7 @@ void USGSenseGloveKismetLibrary::ApplyCalibration_SenseGloveHandProfile( } void USGSenseGloveKismetLibrary:: -GetGloveLocation_ReferencePosition_ReferenceRotation_TrackingHardware_OutGlovePosition_OutGloveRotation( +GetGloveLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_OutGlovePosition_FQuatOutGloveRotation( const USGSenseGlove* SenseGlove, const FVector& ReferencePosition, const FQuat& ReferenceRotation, const ESGPositionalTrackingHardware TrackingHardware, @@ -270,7 +299,19 @@ GetGloveLocation_ReferencePosition_ReferenceRotation_TrackingHardware_OutGlovePo } void USGSenseGloveKismetLibrary:: -GetGloveLocation_ReferencePosition_ReferenceRotation_TrackingHardware_MountedOn_OutGlovePosition_OutGloveRotation( +GetGloveLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_OutGlovePosition_FRotatorOutGloveRotation( + 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_ReferencePosition_FQuatReferenceRotation_TrackingHardware_MountedOn_OutGlovePosition_FQuatOutGloveRotation( const USGSenseGlove* SenseGlove, const FVector& ReferencePosition, const FQuat& ReferenceRotation, const ESGPositionalTrackingHardware TrackingHardware, const ESGFinger MountedOn, @@ -282,7 +323,19 @@ GetGloveLocation_ReferencePosition_ReferenceRotation_TrackingHardware_MountedOn_ } void USGSenseGloveKismetLibrary:: -GetWristLocation_GetWristLocation_ReferencePosition_ReferenceRotation_TrackingHardware_OutWristPosition_OutWristRotation( +GetGloveLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_MountedOn_OutGlovePosition_FRotatorOutGloveRotation( + 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_ReferencePosition_FQuatReferenceRotation_TrackingHardware_OutWristPosition_FQuatOutWristRotation( const USGSenseGlove* SenseGlove, const FVector& ReferencePosition, const FQuat& ReferenceRotation, const ESGPositionalTrackingHardware TrackingHardware, @@ -294,7 +347,19 @@ GetWristLocation_GetWristLocation_ReferencePosition_ReferenceRotation_TrackingHa } void USGSenseGloveKismetLibrary:: -GetWristLocation_GetWristLocation_ReferencePosition_ReferenceRotation_TrackingHardware_GloveWristPositionOffset_GloveWristRotationOffset_OutWristPosition_OutWristRotation( +GetWristLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_OutWristPosition_FRotatorOutWristRotation( + 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_ReferencePosition_FQuatReferenceRotation_TrackingHardware_GloveWristPositionOffset_FQuatGloveWristRotationOffset_OutWristPosition_FQuatOutWristRotation( const USGSenseGlove* SenseGlove, const FVector& ReferencePosition, const FQuat& ReferenceRotation, const ESGPositionalTrackingHardware TrackingHardware, @@ -307,6 +372,20 @@ GetWristLocation_GetWristLocation_ReferencePosition_ReferenceRotation_TrackingHa OutWristPosition, OutWristRotation); } +void USGSenseGloveKismetLibrary:: +GetWristLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_GloveWristPositionOffset_FRotatorGloveWristRotationOffset_OutWristPosition_FRotatorOutWristRotation( + 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(); diff --git a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGlovePoseKismetLibrary.cpp b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGlovePoseKismetLibrary.cpp index eb3a56fb..8cfa5513 100644 --- a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGlovePoseKismetLibrary.cpp +++ b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGlovePoseKismetLibrary.cpp @@ -44,7 +44,7 @@ USGSenseGlovePose* USGSenseGlovePoseKismetLibrary::MakeSenseGlovePose(UObject* W } USGSenseGlovePose* -USGSenseGlovePoseKismetLibrary::MakeSenseGlovePose_bRightHanded_JointPositions_JointRotations_GloveAngles( +USGSenseGlovePoseKismetLibrary::MakeSenseGlovePose_bRightHanded_JointPositions_TArrayFSGQuatArrayJointRotations_GloveAngles( UObject* WorldContextObject, const bool bRightHanded, const TArray& JointPositions, const TArray& JointRotations, const TArray& GloveAngles) @@ -53,6 +53,16 @@ USGSenseGlovePoseKismetLibrary::MakeSenseGlovePose_bRightHanded_JointPositions_J JointPositions, JointRotations, GloveAngles); } +USGSenseGlovePose* +USGSenseGlovePoseKismetLibrary::MakeSenseGlovePose_bRightHanded_JointPositions_TArrayFSGRotatorArrayJointRotations_GloveAngles( + UObject* WorldContextObject, const bool bRightHanded, + const TArray& JointPositions, const TArray& JointRotations, + const TArray& GloveAngles) +{ + return USGSenseGlovePose::NewSenseGlovePose(WorldContextObject, bRightHanded, + JointPositions, JointRotations, GloveAngles); +} + USGSenseGlovePose* USGSenseGlovePoseKismetLibrary::IdlePose(UObject* WorldContextObject, const USGSenseGloveInfo* GloveInfo) { @@ -75,9 +85,16 @@ TArray USGSenseGlovePoseKismetLibrary::GetJointPositions(const U return FSGArrayUtils::ToBPNestedArray(SenseGlovePose->GetJointPositions()); } -TArray USGSenseGlovePoseKismetLibrary::GetJointRotations(const USGSenseGlovePose* SenseGlovePose) +TArray USGSenseGlovePoseKismetLibrary::GetJointRotations_TArrayFSGQuatArray( + const USGSenseGlovePose* SenseGlovePose) { - return FSGArrayUtils::ToBPNestedArray(SenseGlovePose->GetJointRotations()); + return FSGArrayUtils::ToBPNestedArray(SenseGlovePose->GetJointRotationsQ()); +} + +TArray USGSenseGlovePoseKismetLibrary::GetJointRotations_TArrayFSGRotatorArray( + const USGSenseGlovePose* SenseGlovePose) +{ + return FSGArrayUtils::ToBPNestedArray(SenseGlovePose->GetJointRotations()); } TArray USGSenseGlovePoseKismetLibrary::GetGloveAngles(const USGSenseGlovePose* SenseGlovePose) @@ -90,7 +107,12 @@ TArray USGSenseGlovePoseKismetLibrary::GetThimblePositions(const USGSen return SenseGlovePose->GetThimblePositions(); } -TArray USGSenseGlovePoseKismetLibrary::GetThimbleRotations(const USGSenseGlovePose* SenseGlovePose) +TArray USGSenseGlovePoseKismetLibrary::GetThimbleRotations_FQuat(const USGSenseGlovePose* SenseGlovePose) +{ + return SenseGlovePose->GetThimbleRotationsQ(); +} + +TArray USGSenseGlovePoseKismetLibrary::GetThimbleRotations_FRotator(const USGSenseGlovePose* SenseGlovePose) { return SenseGlovePose->GetThimbleRotations(); } diff --git a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGloveSensorDataKismetLibrary.cpp b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGloveSensorDataKismetLibrary.cpp index 5de05f7e..e4836ba2 100644 --- a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGloveSensorDataKismetLibrary.cpp +++ b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGloveSensorDataKismetLibrary.cpp @@ -43,7 +43,7 @@ USGSenseGloveSensorData* USGSenseGloveSensorDataKismetLibrary::MakeSenseGloveSen } USGSenseGloveSensorData* -USGSenseGloveSensorDataKismetLibrary::MakeSenseGloveSensorData_SensorAngles_ImuRotation_ParsedValues_bImuParsed( +USGSenseGloveSensorDataKismetLibrary::MakeSenseGloveSensorData_SensorAngles_FQuatImuRotation_ParsedValues_bImuParsed( UObject* WorldContextObject, const TArray& SensorAngles, const FQuat& ImuRotation, const int32 ParsedValues, const bool bImuParsed) { @@ -51,6 +51,15 @@ USGSenseGloveSensorDataKismetLibrary::MakeSenseGloveSensorData_SensorAngles_ImuR ImuRotation, ParsedValues, bImuParsed); } +USGSenseGloveSensorData* +USGSenseGloveSensorDataKismetLibrary::MakeSenseGloveSensorData_SensorAngles_FRotatorImuRotation_ParsedValues_bImuParsed( + UObject* WorldContextObject, const TArray& SensorAngles, + const FRotator& ImuRotation, const int32 ParsedValues, const bool bImuParsed) +{ + return USGSenseGloveSensorData::NewSenseGloveSensorData(WorldContextObject, SensorAngles, + ImuRotation, ParsedValues, bImuParsed); +} + USGSenseGloveSensorData* USGSenseGloveSensorDataKismetLibrary::Empty(UObject* WorldContextObject) { return USGSenseGloveSensorData::Empty(WorldContextObject); @@ -75,7 +84,13 @@ TArray USGSenseGloveSensorDataKismetLibrary::GetSensorAngles( return FSGArrayUtils::ToBPNestedArray(SenseGloveSensorData->GetSensorAngles()); } -FQuat USGSenseGloveSensorDataKismetLibrary::GetImuRotation(const USGSenseGloveSensorData* SenseGloveSensorData) +FQuat USGSenseGloveSensorDataKismetLibrary::GetImuRotation_FQuat(const USGSenseGloveSensorData* SenseGloveSensorData) +{ + return SenseGloveSensorData->GetImuRotationQ(); +} + +FRotator USGSenseGloveSensorDataKismetLibrary::GetImuRotation_FRotator( + const USGSenseGloveSensorData* SenseGloveSensorData) { return SenseGloveSensorData->GetImuRotation(); } diff --git a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGloveVarsKismetLibrary.cpp b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGloveVarsKismetLibrary.cpp index ae88c87e..4c7e00dc 100644 --- a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGloveVarsKismetLibrary.cpp +++ b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGSenseGloveVarsKismetLibrary.cpp @@ -56,7 +56,14 @@ TArray USGSenseGloveVarsKismetLibrary::GetStartPositions(const FString& return FSGSenseGloveVars::GetStartPositions(HardwareVersion, bRightHanded); } -TArray USGSenseGloveVarsKismetLibrary::GetStartRotations(const FString& HardwareVersion, const bool bRightHanded) +TArray USGSenseGloveVarsKismetLibrary::GetStartRotations_TArrayFQuat( + const FString& HardwareVersion, const bool bRightHanded) +{ + return FSGSenseGloveVars::GetStartRotationsQ(HardwareVersion, bRightHanded); +} + +TArray USGSenseGloveVarsKismetLibrary::GetStartRotations_TArrayFRotator( + const FString& HardwareVersion, const bool bRightHanded) { return FSGSenseGloveVars::GetStartRotations(HardwareVersion, bRightHanded); } @@ -71,8 +78,16 @@ int32 USGSenseGloveVarsKismetLibrary::GetSensors(const FString& HardwareVersion) return FSGSenseGloveVars::GetSensors(HardwareVersion); } -FQuat USGSenseGloveVarsKismetLibrary::GetImuCorrection(const FString& HardwareVersion, - const int32 FirmwareVersion, const int32 SubFirmwareVersion) +FQuat USGSenseGloveVarsKismetLibrary::GetImuCorrection_FQuat(const FString& HardwareVersion, + const int32 FirmwareVersion, + const int32 SubFirmwareVersion) +{ + return FSGSenseGloveVars::GetImuCorrectionQ(HardwareVersion, FirmwareVersion, SubFirmwareVersion); +} + +FRotator USGSenseGloveVarsKismetLibrary::GetImuCorrection_FRotator(const FString& HardwareVersion, + const int32 FirmwareVersion, + const int32 SubFirmwareVersion) { return FSGSenseGloveVars::GetImuCorrection(HardwareVersion, FirmwareVersion, SubFirmwareVersion); } diff --git a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGTrackingKismetLibrary.cpp b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGTrackingKismetLibrary.cpp index bd41f64e..e7fb0c09 100644 --- a/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGTrackingKismetLibrary.cpp +++ b/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGTrackingKismetLibrary.cpp @@ -37,9 +37,21 @@ #include "SGCore/SGTracking.h" -void USGTrackingKismetLibrary::CalculateLocation(const FVector& TrackedPosition, const FQuat& TrackedRotation, - const FVector& PositionOffset, const FQuat& RotationOffset, - FVector& OutNewPosition, FQuat& OutNewRotation) +void +USGTrackingKismetLibrary::CalculateLocation_TrackedPosition_FQuatTrackedRotation_PositionOffset_FQuatRotationOffset_OutNewPosition_FQuatOutNewRotation( + const FVector& TrackedPosition, const FQuat& TrackedRotation, + const FVector& PositionOffset, const FQuat& RotationOffset, + FVector& OutNewPosition, FQuat& OutNewRotation) +{ + return FSGTracking::CalculateLocation(TrackedPosition, TrackedRotation, PositionOffset, RotationOffset, + OutNewPosition, OutNewRotation); +} + +void +USGTrackingKismetLibrary::CalculateLocation_TrackedPosition_FRotatorTrackedRotation_PositionOffset_FRotatorRotationOffset_OutNewPosition_FRotatorOutNewRotation( + const FVector& TrackedPosition, const FRotator& TrackedRotation, + const FVector& PositionOffset, const FRotator& RotationOffset, + FVector& OutNewPosition, FRotator& OutNewRotation) { return FSGTracking::CalculateLocation(TrackedPosition, TrackedRotation, PositionOffset, RotationOffset, OutNewPosition, OutNewRotation); @@ -50,7 +62,12 @@ TArray USGTrackingKismetLibrary::GetSenseGloveFingerToGlovePositionOrig return FSGTracking::GetSenseGloveFingerToGlovePositionOrigin(); } -TArray USGTrackingKismetLibrary::GetSenseGloveFingerToGloveRotationOrigin() +TArray USGTrackingKismetLibrary::GetSenseGloveFingerToGloveRotationOrigin_TArrayFQuat() +{ + return FSGTracking::GetSenseGloveFingerToGloveRotationOriginQ(); +} + +TArray USGTrackingKismetLibrary::GetSenseGloveFingerToGloveRotationOrigin_TArrayFRotator() { return FSGTracking::GetSenseGloveFingerToGloveRotationOrigin(); } @@ -60,18 +77,32 @@ FVector USGTrackingKismetLibrary::GetSenseGloveWristPositionOffset() return FSGTracking::GetSenseGloveWristPositionOffset(); } -FQuat USGTrackingKismetLibrary::GetSenseGloveWristRotationOffset() +FQuat USGTrackingKismetLibrary::GetSenseGloveWristRotationOffset_FQuat() +{ + return FSGTracking::GetSenseGloveWristRotationOffsetQ(); +} + +FRotator USGTrackingKismetLibrary::GetSenseGloveWristRotationOffset_FRotator() { return FSGTracking::GetSenseGloveWristRotationOffset(); } -void USGTrackingKismetLibrary::GetSenseGloveMountOffset(const bool bRightHanded, const ESGFinger ToFinger, - FVector& OutIPosition, FQuat& OutIRotation) +void USGTrackingKismetLibrary::GetSenseGloveMountOffset_bRightHanded_ToFinger_OutIPosition_FQuatOutIRotation( + const bool bRightHanded, const ESGFinger ToFinger, + FVector& OutIPosition, FQuat& OutIRotation) { return FSGTracking::GetSenseGloveMountOffset(bRightHanded, ToFinger, OutIPosition, OutIRotation); } -void USGTrackingKismetLibrary::GetSenseGloveTrackerMountOffset( +void USGTrackingKismetLibrary::GetSenseGloveMountOffset_bRightHanded_ToFinger_OutIPosition_FRotatorOutIRotation( + const bool bRightHanded, const ESGFinger ToFinger, + FVector& OutIPosition, FRotator& OutIRotation) +{ + return FSGTracking::GetSenseGloveMountOffset(bRightHanded, ToFinger, OutIPosition, OutIRotation); +} + +void +USGTrackingKismetLibrary::GetSenseGloveTrackerMountOffset_Hardware_bRightHanded_OutPositionOffset_FQuatOutRotationOffset( const ESGPositionalTrackingHardware Hardware, const bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset) { @@ -79,12 +110,26 @@ void USGTrackingKismetLibrary::GetSenseGloveTrackerMountOffset( OutPositionOffset, OutRotationOffset); } +void +USGTrackingKismetLibrary::GetSenseGloveTrackerMountOffset_Hardware_bRightHanded_OutPositionOffset_FRotatorOutRotationOffset( + const ESGPositionalTrackingHardware Hardware, const bool bRightHanded, + FVector& OutPositionOffset, FRotator& OutRotationOffset) +{ + return FSGTracking::GetSenseGloveTrackerMountOffset(Hardware, bRightHanded, + OutPositionOffset, OutRotationOffset); +} + FVector USGTrackingKismetLibrary::GetSenseGloveViveToAttachPosition() { return FSGTracking::GetSenseGloveViveToAttachPosition(); } -FQuat USGTrackingKismetLibrary::GetSenseGloveViveToAttachRotation() +FQuat USGTrackingKismetLibrary::GetSenseGloveViveToAttachRotation_FQuat() +{ + return FSGTracking::GetSenseGloveViveToAttachRotationQ(); +} + +FRotator USGTrackingKismetLibrary::GetSenseGloveViveToAttachRotation_FRotator() { return FSGTracking::GetSenseGloveViveToAttachRotation(); } @@ -94,7 +139,12 @@ FVector USGTrackingKismetLibrary::GetSenseGloveOculusTouchToAttachPosition() return FSGTracking::GetSenseGloveOculusTouchToAttachPosition(); } -FQuat USGTrackingKismetLibrary::GetSenseGloveOculusTouchToAttachRotation() +FQuat USGTrackingKismetLibrary::GetSenseGloveOculusTouchToAttachRotation_FQuat() +{ + return FSGTracking::GetSenseGloveOculusTouchToAttachRotationQ(); +} + +FRotator USGTrackingKismetLibrary::GetSenseGloveOculusTouchToAttachRotation_FRotator() { return FSGTracking::GetSenseGloveOculusTouchToAttachRotation(); } @@ -104,13 +154,24 @@ FVector USGTrackingKismetLibrary::GetNovaToWristPositionOffset() return FSGTracking::GetNovaToWristPositionOffset(); } -FQuat USGTrackingKismetLibrary::GetNovaToWristRotationOffset() +FQuat USGTrackingKismetLibrary::GetNovaToWristRotationOffset_FQuat() +{ + return FSGTracking::GetNovaToWristRotationOffsetQ(); +} + +FRotator USGTrackingKismetLibrary::GetNovaToWristRotationOffset_FRotator() { return FSGTracking::GetNovaToWristRotationOffset(); } -void USGTrackingKismetLibrary::GetNovaGloveWristOffset(const bool bRightHanded, - FVector& OutPositionOffset, FQuat& OutRotationOffset) +void USGTrackingKismetLibrary::GetNovaGloveWristOffset_bRightHanded_OutPositionOffset_FQuatOutRotationOffset( + const bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset) +{ + return FSGTracking::GetNovaGloveWristOffset(bRightHanded, OutPositionOffset, OutRotationOffset); +} + +void USGTrackingKismetLibrary::GetNovaGloveWristOffset_bRightHanded_OutPositionOffset_FRotatorOutRotationOffset( + const bool bRightHanded, FVector& OutPositionOffset, FRotator& OutRotationOffset) { return FSGTracking::GetNovaGloveWristOffset(bRightHanded, OutPositionOffset, OutRotationOffset); } @@ -120,7 +181,12 @@ FVector USGTrackingKismetLibrary::GetRightNovaViveToAttachPosition() return FSGTracking::GetRightNovaViveToAttachPosition(); } -FQuat USGTrackingKismetLibrary::GetRightNovaViveToAttachRotation() +FQuat USGTrackingKismetLibrary::GetRightNovaViveToAttachRotation_FQuat() +{ + return FSGTracking::GetRightNovaViveToAttachRotationQ(); +} + +FRotator USGTrackingKismetLibrary::GetRightNovaViveToAttachRotation_FRotator() { return FSGTracking::GetRightNovaViveToAttachRotation(); } @@ -130,7 +196,12 @@ FVector USGTrackingKismetLibrary::GetLeftNovaViveToAttachPosition() return FSGTracking::GetLeftNovaViveToAttachPosition(); } -FQuat USGTrackingKismetLibrary::GetLeftNovaViveToAttachRotation() +FQuat USGTrackingKismetLibrary::GetLeftNovaViveToAttachRotation_FQuat() +{ + return FSGTracking::GetLeftNovaViveToAttachRotationQ(); +} + +FRotator USGTrackingKismetLibrary::GetLeftNovaViveToAttachRotation_FRotator() { return FSGTracking::GetLeftNovaViveToAttachRotation(); } @@ -140,7 +211,12 @@ FVector USGTrackingKismetLibrary::GetRightNovaQuest2ToAttachPosition() return FSGTracking::GetRightNovaQuest2ToAttachPosition(); } -FQuat USGTrackingKismetLibrary::GetRightNovaQuest2ToAttachRotation() +FQuat USGTrackingKismetLibrary::GetRightNovaQuest2ToAttachRotation_FQuat() +{ + return FSGTracking::GetRightNovaQuest2ToAttachRotationQ(); +} + +FRotator USGTrackingKismetLibrary::GetRightNovaQuest2ToAttachRotation_FRotator() { return FSGTracking::GetRightNovaQuest2ToAttachRotation(); } @@ -150,7 +226,12 @@ FVector USGTrackingKismetLibrary::GetLeftNovaQuest2ToAttachPosition() return FSGTracking::GetLeftNovaQuest2ToAttachPosition(); } -FQuat USGTrackingKismetLibrary::GetLeftNovaQuest2ToAttachRotation() +FQuat USGTrackingKismetLibrary::GetLeftNovaQuest2ToAttachRotation_FQuat() +{ + return FSGTracking::GetLeftNovaQuest2ToAttachRotationQ(); +} + +FRotator USGTrackingKismetLibrary::GetLeftNovaQuest2ToAttachRotation_FRotator() { return FSGTracking::GetLeftNovaQuest2ToAttachRotation(); } @@ -160,23 +241,41 @@ FVector USGTrackingKismetLibrary::GetRightNovaPico2ToAttachPosition() return FSGTracking::GetRightNovaPico2ToAttachPosition(); } -FQuat USGTrackingKismetLibrary::GetRightNovaPico2ToAttachRotation() +FQuat USGTrackingKismetLibrary::GetRightNovaPico2ToAttachRotation_FQuat() +{ + return FSGTracking::GetRightNovaPico2ToAttachRotationQ(); +} + +FRotator USGTrackingKismetLibrary::GetRightNovaPico2ToAttachRotation_FRotator() { return FSGTracking::GetRightNovaPico2ToAttachRotation(); } -FQuat USGTrackingKismetLibrary::GetLeftNovaPico2ToAttachRotation() +FQuat USGTrackingKismetLibrary::GetLeftNovaPico2ToAttachRotation_FQuat() +{ + return FSGTracking::GetLeftNovaPico2ToAttachRotationQ(); +} + +FRotator USGTrackingKismetLibrary::GetLeftNovaPico2ToAttachRotation_FRotator() { return FSGTracking::GetLeftNovaPico2ToAttachRotation(); } -void USGTrackingKismetLibrary::GetNovaGloveTrackerOffset( +void USGTrackingKismetLibrary::GetNovaGloveTrackerOffset_Hardware_bRightHanded_OutPositionOffset_FQuatOutRotationOffset( const ESGPositionalTrackingHardware Hardware, const bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset) { return FSGTracking::GetNovaGloveTrackerOffset(Hardware, bRightHanded, OutPositionOffset, OutRotationOffset); } +void +USGTrackingKismetLibrary::GetNovaGloveTrackerOffset_Hardware_bRightHanded_OutPositionOffset_FRotatorOutRotationOffset( + const ESGPositionalTrackingHardware Hardware, const bool bRightHanded, + FVector& OutPositionOffset, FRotator& OutRotationOffset) +{ + return FSGTracking::GetNovaGloveTrackerOffset(Hardware, bRightHanded, OutPositionOffset, OutRotationOffset); +} + FString USGTrackingKismetLibrary::ToString(const ESGPositionalTrackingHardware Hardware) { return FSGTracking::ToString(Hardware); diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGBasicHandModelKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGBasicHandModelKismetLibrary.h index 5ab469aa..9d99d156 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGBasicHandModelKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGBasicHandModelKismetLibrary.h @@ -63,11 +63,19 @@ public: UFUNCTION(BlueprintCallable, DisplayName="Make Basic Hand Model", Category="SenseGlove | Core | Kinematics | Basic Hand Model", meta=(WorldContext="WorldContextObject")) - static USGBasicHandModel* MakeBasicHandModel_bRightHanded_Lengths_StartPositions_StartRotations( + static USGBasicHandModel* MakeBasicHandModel_bRightHanded_Lengths_StartPositions_TArrayFQuatStartRotations( UObject* WorldContextObject, bool bRightHanded, const TArray& Lengths, const TArray& StartPositions, const TArray& StartRotations); + UFUNCTION(BlueprintCallable, DisplayName="Make Basic Hand Model", + Category="SenseGlove | Core | Kinematics | Basic Hand Model", + meta=(WorldContext="WorldContextObject")) + static USGBasicHandModel* MakeBasicHandModel_bRightHanded_Lengths_StartPositions_TArrayFRotatorStartRotations( + UObject* WorldContextObject, + bool bRightHanded, const TArray& Lengths, + const TArray& StartPositions, const TArray& StartRotations); + UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model", meta=(WorldContext="WorldContextObject")) static USGBasicHandModel* Default(UObject* WorldContextObject, bool bRightHanded); @@ -125,8 +133,13 @@ public: static void SetStartJointPosition_uint8Finger(UPARAM(ref) USGBasicHandModel* BasicHandModel, uint8 Finger, const FVector& Position); - UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model") - static TArray GetStartJointRotations(const USGBasicHandModel* BasicHandModel); + UFUNCTION(BlueprintPure, DisplayName="Get Start Joint Rotations", + Category="SenseGlove | Core | Kinematics | Basic Hand Model") + static TArray GetStartJointRotations_TArrayFQuat(const USGBasicHandModel* BasicHandModel); + + UFUNCTION(BlueprintPure, DisplayName="Get Start Joint Rotations", + Category="SenseGlove | Core | Kinematics | Basic Hand Model") + static TArray GetStartJointRotations_TArrayFRotator(const USGBasicHandModel* BasicHandModel); UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model") static FVector GetJointPosition(const USGBasicHandModel* BasicHandModel, ESGFinger Finger); @@ -135,12 +148,23 @@ public: static void SetJointPosition(UPARAM(ref) USGBasicHandModel* BasicHandModel, const FVector& NewPosition, ESGFinger Finger); - UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model") - static FQuat GetJointRotation(const USGBasicHandModel* BasicHandModel, ESGFinger Finger); + UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotation", + Category="SenseGlove | Core | Kinematics | Basic Hand Model") + static FQuat GetJointRotation_FQuat(const USGBasicHandModel* BasicHandModel, ESGFinger Finger); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model") - static void SetJointRotation(UPARAM(ref) USGBasicHandModel* BasicHandModel, const FQuat& NewRotation, - ESGFinger Finger); + UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotation", + Category="SenseGlove | Core | Kinematics | Basic Hand Model") + static FRotator GetJointRotation_FRotator(const USGBasicHandModel* BasicHandModel, ESGFinger Finger); + + UFUNCTION(BlueprintCallable, DisplayName="Set Joint Rotation", + Category="SenseGlove | Core | Kinematics | Basic Hand Model") + static void SetJointRotation_FQuatNewRotation_Finger( + UPARAM(ref) USGBasicHandModel* BasicHandModel, const FQuat& NewRotation, ESGFinger Finger); + + UFUNCTION(BlueprintCallable, DisplayName="Set Joint Rotation", + Category="SenseGlove | Core | Kinematics | Basic Hand Model") + static void SetJointRotation_FRotatorNewRotation_Finger( + UPARAM(ref) USGBasicHandModel* BasicHandModel, const FRotator& NewRotation, ESGFinger Finger); UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model") static TArray GetTotalLengths(const USGBasicHandModel* BasicHandModel); diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHandInterpolatorKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHandInterpolatorKismetLibrary.h index 4610a14b..cbbd8183 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHandInterpolatorKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHandInterpolatorKismetLibrary.h @@ -62,10 +62,16 @@ public: UFUNCTION(BlueprintCallable, DisplayName="Make Hand Interpolator", Category="SenseGlove | Core | Kinematics | Hand Interpolator", meta=(WorldContext="WorldContextObject")) - static USGHandInterpolator* MakeHandInterpolator_JointInterpolations_CmcStartRotation( + static USGHandInterpolator* MakeHandInterpolator_JointInterpolations_FQuatCmcStartRotation( UObject* WorldContextObject, const TArray& JointInterpolations, const FQuat& CmcStartRotation); + UFUNCTION(BlueprintCallable, DisplayName="Make Hand Interpolator", + Category="SenseGlove | Core | Kinematics | Hand Interpolator", meta=(WorldContext="WorldContextObject")) + static USGHandInterpolator* MakeHandInterpolator_JointInterpolations_FRotatorCmcStartRotation( + UObject* WorldContextObject, + const TArray& JointInterpolations, const FRotator& CmcStartRotation); + UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Hand Interpolator", meta=(WorldContext="WorldContextObject")) static USGHandInterpolator* Default(UObject* WorldContextObject, bool bRightHanded); @@ -91,8 +97,13 @@ public: TArray GetJointInterpolations( UObject* WorldContextObject, const USGHandInterpolator* HandInterpolator) const; - UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Hand Interpolator") - FQuat GetCmcStartRotation(const USGHandInterpolator* HandInterpolator) const; + UFUNCTION(BlueprintPure, DisplayName="Get Cmc Start Rotation", + Category="SenseGlove | Core | Kinematics | Hand Interpolator") + FQuat GetCmcStartRotation_FQuat(const USGHandInterpolator* HandInterpolator) const; + + UFUNCTION(BlueprintPure, DisplayName="Get Cmc Start Rotation", + Category="SenseGlove | Core | Kinematics | Hand Interpolator") + FRotator GetCmcStartRotation_FRotator(const USGHandInterpolator* HandInterpolator) const; UFUNCTION(BlueprintPure, DisplayName="CalculateAngle", Category="SenseGlove | Core | Kinematics | Hand Interpolator") diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHandPoseKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHandPoseKismetLibrary.h index 47d545c9..3b9d419b 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHandPoseKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHandPoseKismetLibrary.h @@ -36,6 +36,7 @@ #pragma once #include "SGCore/SGQuatArray.h" +#include "SGCore/SGRotatorArray.h" #include "SGCore/SGVectorArray.h" #include "SGKismet/SGBlueprintFunctionLibrary.h" #include "SGTypes/SGCoreTypes.h" @@ -56,11 +57,18 @@ public: UFUNCTION(BlueprintCallable, DisplayName="Make Hand Pose", Category="SenseGlove | Core | Hand Pose", meta=(WorldContext="WorldContextObject")) - static USGHandPose* MakeHandPose_bRightHanded_JointPositions_JointRotations_HandAngles( + static USGHandPose* MakeHandPose_bRightHanded_JointPositions_FSGQuatArrayJointRotations_HandAngles( UObject* WorldContextObject, bool bRightHanded, const TArray& JointPositions, const TArray& JointRotations, const TArray& HandAngles); + UFUNCTION(BlueprintCallable, DisplayName="Make Hand Pose", Category="SenseGlove | Core | Hand Pose", + meta=(WorldContext="WorldContextObject")) + static USGHandPose* MakeHandPose_bRightHanded_JointPositions_FSGRotatorArrayJointRotations_HandAngles( + UObject* WorldContextObject, + bool bRightHanded, const TArray& JointPositions, const TArray& JointRotations, + const TArray& HandAngles); + UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Hand Pose", meta=(WorldContext="WorldContextObject")) static USGHandPose* Deserialize(UObject* WorldContextObject, const FString& SerializedString); @@ -122,8 +130,11 @@ public: UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose") static TArray GetJointPositions(const USGHandPose* HandPose); - UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose") - static TArray GetJointRotations(const USGHandPose* HandPose); + UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotations", Category="SenseGlove | Core | Hand Pose") + static TArray GetJointRotationsQ(const USGHandPose* HandPose); + + UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotations", Category="SenseGlove | Core | Hand Pose") + static TArray GetJointRotations(const USGHandPose* HandPose); UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose") static TArray GetHandAngles(const USGHandPose* HandPose); @@ -132,8 +143,8 @@ public: static bool Equals(const USGHandPose* A, const USGHandPose* B); UFUNCTION(BlueprintPure, DisplayName="Get Normalized Flexion", Category="SenseGlove | Core | Hand Pose") - static float GetNormalizedFlexion_Finger_bClamp01(const USGHandPose* HandPose, ESGFinger Finger, - bool bClamp01 = true); + static float GetNormalizedFlexion_Finger_bClamp01(const USGHandPose* HandPose, + ESGFinger Finger, bool bClamp01 = true); UFUNCTION(BlueprintPure, DisplayName="Get Normalized Flexion", Category="SenseGlove | Core | Hand Pose") static TArray GetNormalizedFlexion_bClamp01(const USGHandPose* HandPose, bool bClamp01 = true); diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHapticGloveKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHapticGloveKismetLibrary.h index f23714c9..786bf69d 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHapticGloveKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHapticGloveKismetLibrary.h @@ -84,8 +84,11 @@ public: UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptic Glove") static bool IsRight(const USGHapticGlove* HapticGlove); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptic Glove") - static bool GetImuRotation(UPARAM(ref) USGHapticGlove* HapticGlove, FQuat& OutImu); + UFUNCTION(BlueprintCallable, DisplayName="Get Imu Rotation", Category="SenseGlove | Core | Haptic Glove") + static bool GetImuRotation_FQuatOutImu(UPARAM(ref) USGHapticGlove* HapticGlove, FQuat& OutImu); + + UFUNCTION(BlueprintCallable, DisplayName="Get Imu Rotation", Category="SenseGlove | Core | Haptic Glove") + static bool GetImuRotation_FRotatorOutImu(UPARAM(ref) USGHapticGlove* HapticGlove, FRotator& OutImu); UFUNCTION(BlueprintCallable, DisplayName="Get Hand Pose", Category="SenseGlove | Core | Haptic Glove", meta=(WorldContext="WorldContextObject")) @@ -171,15 +174,33 @@ public: static void ApplyCalibration(UObject* WorldContextObject, const USGHapticGlove* HapticGlove, USGHandProfile*& OutProfile); - UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptic Glove") - static void GetWristLocation(const USGHapticGlove* HapticGlove, - const FVector& ReferencePosition, const FQuat& ReferenceRotation, - ESGPositionalTrackingHardware TrackingHardware, - FVector& OutWristPosition, FQuat& OutWristRotation); + UFUNCTION(BlueprintPure, DisplayName="Get Wrist Location", Category="SenseGlove | Core | Haptic Glove") + static void GetWristLocation_ReferencePosition_ReferenceRotation_TrackingHardware_OutWristPosition_OutWristLocation( + const USGHapticGlove* HapticGlove, + const FVector& ReferencePosition, const FQuat& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, + FVector& OutWristPosition, FQuat& OutWristRotation); - UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptic Glove") - static void GetGloveLocation(const USGHapticGlove* HapticGlove, - const FVector& ReferencePosition, const FQuat& ReferenceRotation, - ESGPositionalTrackingHardware TrackingHardware, - FVector& OutGlovePosition, FQuat& OutGloveRotation); + UFUNCTION(BlueprintPure, DisplayName="Get Wrist Location", Category="SenseGlove | Core | Haptic Glove") + static void + GetWristLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_OutWristPosition_FRotatorOutWristLocation( + const USGHapticGlove* HapticGlove, + const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, + FVector& OutWristPosition, FRotator& OutWristRotation); + + UFUNCTION(BlueprintPure, DisplayName="Get Glove Location", Category="SenseGlove | Core | Haptic Glove") + static void GetGloveLocation_ReferencePosition_ReferenceRotation_TrackingHardware_OutGlovePosition_OutGloveRotation( + const USGHapticGlove* HapticGlove, + const FVector& ReferencePosition, const FQuat& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, + FVector& OutGlovePosition, FQuat& OutGloveRotation); + + UFUNCTION(BlueprintPure, DisplayName="Get Glove Location", Category="SenseGlove | Core | Haptic Glove") + static void + GetGloveLocation_FRotatorReferencePosition_ReferenceRotation_TrackingHardware_OutGlovePosition_FRotatorOutGloveRotation( + const USGHapticGlove* HapticGlove, + const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, + FVector& OutGlovePosition, FRotator& OutGloveRotation); }; \ No newline at end of file diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGJointKinematicsKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGJointKinematicsKismetLibrary.h index 725b9243..0cb58f0a 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGJointKinematicsKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGJointKinematicsKismetLibrary.h @@ -53,14 +53,27 @@ class SENSEGLOVECOREKISMET_API USGJointKinematicsKismetLibrary final : public US public: UFUNCTION(BlueprintCallable, DisplayName="Forward Kinematics", Category="SenseGlove | Core | Kinematics | Joint Kinematics") - static bool ForwardKinematics_StartPosition_StartRotation_JointLengths_JointAngles_OutNewPositions_OutNewRotations( + static bool ForwardKinematics_StartPosition_FQuatStartRotation_JointLengths_JointAngles_OutNewPositions_TArrayFQuatOutNewRotations( const FVector& StartPosition, const FQuat& StartRotation, const TArray& JointLengths, const TArray& JointAngles, TArray& OutNewPositions, TArray& OutNewRotations); UFUNCTION(BlueprintCallable, DisplayName="Forward Kinematics", Category="SenseGlove | Core | Kinematics | Joint Kinematics") - static bool ForwardKinematics_Profile_Finger_JointAngles_OutNewPositions_OutNewRotations( + static bool ForwardKinematics_StartPosition_FRotatorStartRotation_JointLengths_JointAngles_OutNewPositions_TArrayFRotatorOutNewRotations( + const FVector& StartPosition, const FRotator& StartRotation, + const TArray& JointLengths, const TArray& JointAngles, + TArray& OutNewPositions, TArray& OutNewRotations); + + UFUNCTION(BlueprintCallable, DisplayName="Forward Kinematics", + Category="SenseGlove | Core | Kinematics | Joint Kinematics") + static bool ForwardKinematics_Profile_Finger_JointAngles_OutNewPositions_TArrayFQuatOutNewRotations( const USGBasicHandModel* Profile, ESGFinger Finger, const TArray& JointAngles, TArray& OutNewPositions, TArray& OutNewRotations); + + UFUNCTION(BlueprintCallable, DisplayName="Forward Kinematics", + Category="SenseGlove | Core | Kinematics | Joint Kinematics") + static bool ForwardKinematics_Profile_Finger_JointAngles_OutNewPositions_TArrayFRotatorOutNewRotations( + const USGBasicHandModel* Profile, ESGFinger Finger, const TArray& JointAngles, + TArray& OutNewPositions, TArray& OutNewRotations); }; \ No newline at end of file diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveKismetLibrary.h index 08b191a9..c98b37a8 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveKismetLibrary.h @@ -96,15 +96,37 @@ public: const TArray& MinValues, const TArray& MaxValues, USGNovaGloveHandProfile*& OutProfile); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove") - static void CalculateGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, - ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, - FVector& OutGlovePosition, FQuat& OutGloveRotation); + UFUNCTION(BlueprintCallable, DisplayName="Calculate Glove Location", + Category="SenseGlove | Core | Nova | Nova Glove") + static void + CalculateGloveLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_bRightHanded_OutGlovePosition_FQuatOutGloveRotation( + const FVector& ReferencePosition, const FQuat& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, + FVector& OutGlovePosition, FQuat& OutGloveRotation); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove") - static void CalculateWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, - ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, - FVector& OutWristPosition, FQuat& OutWristRotation); + UFUNCTION(BlueprintCallable, DisplayName="Calculate Glove Location", + Category="SenseGlove | Core | Nova | Nova Glove") + static void + CalculateGloveLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_bRightHanded_OutGlovePosition_FRotatorOutGloveRotation( + const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, + FVector& OutGlovePosition, FRotator& OutGloveRotation); + + UFUNCTION(BlueprintCallable, DisplayName="Calculate Wrist Location", + Category="SenseGlove | Core | Nova | Nova Glove") + static void + CalculateWristLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_bRightHanded_OutWristPosition_FQuatOutWristRotation( + const FVector& ReferencePosition, const FQuat& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, + FVector& OutWristPosition, FQuat& OutWristRotation); + + UFUNCTION(BlueprintCallable, DisplayName="Calculate Wrist Location", + Category="SenseGlove | Core | Nova | Nova Glove") + static void + CalculateWristLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_bRightHanded_OutWristPosition_FRotatorOutWristRotation( + const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, + FVector& OutWristPosition, FRotator& OutWristRotation); UFUNCTION(BlueprintCallable, DisplayName="To Bytes", Category="SenseGlove | Core | Nova | Nova Glove") static FString ToBytes_ThumperCommand(const USGThumperCommand* ThumperCommand); @@ -144,8 +166,11 @@ public: static bool GetSensorData(UObject* WorldContextObject, UPARAM(ref) USGNovaGlove* NovaGlove, USGNovaGloveSensorData*& OutSensorData); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove") - static bool GetImuRotation(UPARAM(ref) USGNovaGlove* NovaGlove, FQuat& OutImu); + UFUNCTION(BlueprintCallable, DisplayName="Get Imu Rotation", Category="SenseGlove | Core | Nova | Nova Glove") + static bool GetImuRotation_FQuatOutImu(UPARAM(ref) USGNovaGlove* NovaGlove, FQuat& OutImu); + + UFUNCTION(BlueprintCallable, DisplayName="Get Imu Rotation", Category="SenseGlove | Core | Nova | Nova Glove") + static bool GetImuRotation_FRotatorOutImu(UPARAM(ref) USGNovaGlove* NovaGlove, FRotator& OutImu); UFUNCTION(BlueprintCallable, DisplayName="Get Hand Pose", Category="SenseGlove | Core | Nova | Nova Glove", meta=(WorldContext="WorldContextObject")) @@ -206,20 +231,37 @@ public: USGNovaGloveHandProfile*& OutProfile); UFUNCTION(BlueprintPure, DisplayName="Get Glove Location", Category="SenseGlove | Core | Nova | Nova Glove") - static void GetGloveLocation_ReferencePosition_ReferenceRotation_TrackingHardware_OutGlovePosition_OutGloveRotation( + static void + GetGloveLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_OutGlovePosition_FQuatOutGloveRotation( const USGNovaGlove* NovaGlove, const FVector& ReferencePosition, const FQuat& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, FVector& OutGlovePosition, FQuat& OutGloveRotation); + UFUNCTION(BlueprintPure, DisplayName="Get Glove Location", Category="SenseGlove | Core | Nova | Nova Glove") + static void + GetGloveLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_OutGlovePosition_FRotatorOutGloveRotation( + const USGNovaGlove* NovaGlove, + const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, + FVector& OutGlovePosition, FRotator& OutGloveRotation); + UFUNCTION(BlueprintPure, DisplayName="Get Wrist Location", Category="SenseGlove | Core | Nova | Nova Glove") static void - GetWristLocation_GetWristLocation_ReferencePosition_ReferenceRotation_TrackingHardware_OutWristPosition_OutWristRotation( + GetWristLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_OutWristPosition_FQuatOutWristRotation( const USGNovaGlove* NovaGlove, const FVector& ReferencePosition, const FQuat& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, FVector& OutWristPosition, FQuat& OutWristRotation); + UFUNCTION(BlueprintPure, DisplayName="Get Wrist Location", Category="SenseGlove | Core | Nova | Nova Glove") + static void + GetWristLocation_ReferencePosition_FRotatorReferenceRotation_TrackingHardware_OutWristPosition_FRotatorOutWristRotation( + const USGNovaGlove* NovaGlove, + const FVector& ReferencePosition, const FRotator& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, + FVector& OutWristPosition, FRotator& OutWristRotation); + UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove") static FString ToString(const USGNovaGlove* NovaGlove); }; \ No newline at end of file diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveSensorDataKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveSensorDataKismetLibrary.h index db2d4791..bf793025 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveSensorDataKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveSensorDataKismetLibrary.h @@ -55,10 +55,17 @@ public: UFUNCTION(BlueprintCallable, DisplayName="Make Nova Glove Sensor Data", Category="SenseGlove | Core | Nova | Nova Glove Sensor Data", meta=(WorldContext="WorldContextObject")) static USGNovaGloveSensorData* - MakeNovaGloveSensorData_Values_ParsedValues_ImuRotation_bImuParsed_BatteryLevel_bCharging( + MakeNovaGloveSensorData_Values_ParsedValues_FQuatImuRotation_bImuParsed_BatteryLevel_bCharging( UObject* WorldContextObject, const TArray& Values, int32 ParsedValues, const FQuat& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging); + UFUNCTION(BlueprintCallable, DisplayName="Make Nova Glove Sensor Data", + Category="SenseGlove | Core | Nova | Nova Glove Sensor Data", meta=(WorldContext="WorldContextObject")) + static USGNovaGloveSensorData* + MakeNovaGloveSensorData_Values_ParsedValues_FRotatorImuRotation_bImuParsed_BatteryLevel_bCharging( + UObject* WorldContextObject, const TArray& Values, int32 ParsedValues, + const FRotator& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging); + UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove Sensor Data", meta=(WorldContext="WorldContextObject")) static USGNovaGloveSensorData* Empty(UObject* WorldContextObject); @@ -75,8 +82,13 @@ public: UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Sensor Data") static TArray GetSensorValues(const USGNovaGloveSensorData* NovaGloveSensorData); - UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Sensor Data") - static FQuat GetImuRotation(const USGNovaGloveSensorData* NovaGloveSensorData); + UFUNCTION(BlueprintPure, DisplayName="Get Imu Rotation", + Category="SenseGlove | Core | Nova | Nova Glove Sensor Data") + static FQuat GetImuRotation_FQuat(const USGNovaGloveSensorData* NovaGloveSensorData); + + UFUNCTION(BlueprintPure, DisplayName="Get Imu Rotation", + Category="SenseGlove | Core | Nova | Nova Glove Sensor Data") + static FRotator GetImuRotation_FRotator(const USGNovaGloveSensorData* NovaGloveSensorData); UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Sensor Data") static int32 GetParsedValues(const USGNovaGloveSensorData* NovaGloveSensorData); diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveInfoKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveInfoKismetLibrary.h index 76a34d8c..8227f4cc 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveInfoKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveInfoKismetLibrary.h @@ -57,13 +57,23 @@ public: UFUNCTION(BlueprintCallable, DisplayName="Make Sense Glove Info", Category="SenseGlove | Core | SG | Sense Glove Info", meta=(WorldContext="WorldContextObject")) static USGSenseGloveInfo* - MakeSenseGloveInfo_DeviceId_HardwareVersion_FirmwareVersion_SubFirmwareVersion_bRightHanded_NumberOfSensors_ImuCorrection_StartPosition_StartRotation_GloveLengths_Functions( + MakeSenseGloveInfo_DeviceId_HardwareVersion_FirmwareVersion_SubFirmwareVersion_bRightHanded_NumberOfSensors_FQuatImuCorrection_StartPositions_TArrayFQuatStartRotations_GloveLengths_Functions( UObject* WorldContextObject, const FString& DeviceId, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, bool bRightHanded, int32 NumberOfSensors, const FQuat& ImuCorrection, const TArray& StartPositions, const TArray& StartRotations, const TArray& GloveLengths, const TArray& Functions); + UFUNCTION(BlueprintCallable, DisplayName="Make Sense Glove Info", + Category="SenseGlove | Core | SG | Sense Glove Info", meta=(WorldContext="WorldContextObject")) + static USGSenseGloveInfo* + MakeSenseGloveInfo_DeviceId_HardwareVersion_FirmwareVersion_SubFirmwareVersion_bRightHanded_NumberOfSensors_FRotatorImuCorrection_StartPositions_TArrayFRotatorStartRotations_GloveLengths_Functions( + UObject* WorldContextObject, const FString& DeviceId, + const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, + bool bRightHanded, int32 NumberOfSensors, const FRotator& ImuCorrection, + const TArray& StartPositions, const TArray& StartRotations, + const TArray& GloveLengths, const TArray& Functions); + UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Info", meta=(WorldContext="WorldContextObject")) static bool Parse(UObject* WorldContextObject, @@ -92,14 +102,20 @@ public: UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") static int32 GetNumberOfSensors(const USGSenseGloveInfo* SenseGloveInfo); - UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") - static FQuat GetImuCorrection(const USGSenseGloveInfo* SenseGloveInfo); + UFUNCTION(BlueprintPure, DisplayName="Get Imu Correction", Category="SenseGlove | Core | SG | Sense Glove Info") + static FQuat GetImuCorrection_FQuat(const USGSenseGloveInfo* SenseGloveInfo); + + UFUNCTION(BlueprintPure, DisplayName="Get Imu Correction", Category="SenseGlove | Core | SG | Sense Glove Info") + static FRotator GetImuCorrection_FRotator(const USGSenseGloveInfo* SenseGloveInfo); UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") static TArray GetStartPositions(const USGSenseGloveInfo* SenseGloveInfo); - UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") - static TArray GetStartRotations(const USGSenseGloveInfo* SenseGloveInfo); + UFUNCTION(BlueprintPure, DisplayName="Get Start Rotations", Category="SenseGlove | Core | SG | Sense Glove Info") + static TArray GetStartRotations_TArrayFQuat(const USGSenseGloveInfo* SenseGloveInfo); + + UFUNCTION(BlueprintPure, DisplayName="Get Start Rotations", Category="SenseGlove | Core | SG | Sense Glove Info") + static TArray GetStartRotations_TArrayFRotator(const USGSenseGloveInfo* SenseGloveInfo); UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") static TArray GetGloveLengths(const USGSenseGloveInfo* SenseGloveInfo); @@ -110,8 +126,11 @@ public: UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") static FVector GetStartPosition(const USGSenseGloveInfo* SenseGloveInfo, ESGFinger Finger); - UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") - static FQuat GetStartRotation(const USGSenseGloveInfo* SenseGloveInfo, ESGFinger Finger); + UFUNCTION(BlueprintPure, DisplayName="Get Start Rotation", Category="SenseGlove | Core | SG | Sense Glove Info") + static FQuat GetStartRotation_FQuat(const USGSenseGloveInfo* SenseGloveInfo, ESGFinger Finger); + + UFUNCTION(BlueprintPure, DisplayName="Get Start Rotation", Category="SenseGlove | Core | SG | Sense Glove Info") + static FRotator GetStartRotation_FRotator(const USGSenseGloveInfo* SenseGloveInfo, ESGFinger Finger); UFUNCTION(BlueprintPure, DisplayName="Get Glove Lengths", Category="SenseGlove | Core | SG | Sense Glove Info") static TArray GetGloveLengths_Finger(const USGSenseGloveInfo* SenseGloveInfo, ESGFinger Finger); diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveKismetLibrary.h index 1e60765d..e3a138ea 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveKismetLibrary.h @@ -107,19 +107,46 @@ public: const TArray& MinValues, const TArray& MaxValues, bool bRightHanded, USGSenseGloveHandProfile*& OutProfile); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove") - static void CalculateGloveLocation(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_FQuatReferenceRotation_TrackingHardware_bRightHanded_MountedOn_OutGlovePosition_FQuatOutGloveRotation( + const FVector& ReferencePosition, const FQuat& ReferenceRotation, + ESGPositionalTrackingHardware TrackingHardware, + bool bRightHanded, ESGFinger MountedOn, + FVector& OutGlovePosition, FQuat& OutGloveRotation); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove") - static void CalculateWristLocation(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 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); @@ -146,8 +173,11 @@ public: static bool GetSensorData(UObject* WorldContextObject, const USGSenseGlove* SenseGlove, USGSenseGloveSensorData*& OutSensorData); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove") - static bool GetImuRotation(UPARAM(ref) USGSenseGlove* SenseGlove, FQuat& OutImu); + 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")) @@ -220,7 +250,8 @@ public: USGSenseGloveHandProfile*& OutProfile); UFUNCTION(BlueprintPure, DisplayName="Get Glove Location", Category="SenseGlove | Core | SG | Sense Glove") - static void GetGloveLocation_ReferencePosition_ReferenceRotation_TrackingHardware_OutGlovePosition_OutGloveRotation( + static void + GetGloveLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_OutGlovePosition_FQuatOutGloveRotation( const USGSenseGlove* SenseGlove, const FVector& ReferencePosition, const FQuat& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, @@ -228,15 +259,31 @@ public: UFUNCTION(BlueprintPure, DisplayName="Get Glove Location", Category="SenseGlove | Core | SG | Sense Glove") static void - GetGloveLocation_ReferencePosition_ReferenceRotation_TrackingHardware_MountedOn_OutGlovePosition_OutGloveRotation( + 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_GetWristLocation_ReferencePosition_ReferenceRotation_TrackingHardware_OutWristPosition_OutWristRotation( + GetWristLocation_ReferencePosition_FQuatReferenceRotation_TrackingHardware_OutWristPosition_FQuatOutWristRotation( const USGSenseGlove* SenseGlove, const FVector& ReferencePosition, const FQuat& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, @@ -244,7 +291,15 @@ public: UFUNCTION(BlueprintPure, DisplayName="Get Wrist Location", Category="SenseGlove | Core | SG | Sense Glove") static void - GetWristLocation_GetWristLocation_ReferencePosition_ReferenceRotation_TrackingHardware_GloveWristPositionOffset_GloveWristRotationOffset_OutWristPosition_OutWristRotation( + 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, @@ -252,6 +307,16 @@ public: 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); }; \ No newline at end of file diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGlovePoseKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGlovePoseKismetLibrary.h index e0bfb141..ac8b85b5 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGlovePoseKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGlovePoseKismetLibrary.h @@ -36,6 +36,7 @@ #pragma once #include "SGCore/SGQuatArray.h" +#include "SGCore/SGRotatorArray.h" #include "SGCore/SGVectorArray.h" #include "SGKismet/SGBlueprintFunctionLibrary.h" @@ -57,12 +58,22 @@ public: UFUNCTION(BlueprintCallable, DisplayName="Make Sense Glove Pose", Category="SenseGlove | Core | SG | Sense Glove Pose", meta=(WorldContext="WorldContextObject")) - static USGSenseGlovePose* MakeSenseGlovePose_bRightHanded_JointPositions_JointRotations_GloveAngles( + static USGSenseGlovePose* + MakeSenseGlovePose_bRightHanded_JointPositions_TArrayFSGQuatArrayJointRotations_GloveAngles( UObject* WorldContextObject, bool bRightHanded, const TArray& JointPositions, const TArray& JointRotations, const TArray& GloveAngles); + UFUNCTION(BlueprintCallable, DisplayName="Make Sense Glove Pose", + Category="SenseGlove | Core | SG | Sense Glove Pose", meta=(WorldContext="WorldContextObject")) + static USGSenseGlovePose* + MakeSenseGlovePose_bRightHanded_JointPositions_TArrayFSGRotatorArrayJointRotations_GloveAngles( + UObject* WorldContextObject, bool bRightHanded, + const TArray& JointPositions, + const TArray& JointRotations, + const TArray& GloveAngles); + UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Pose", meta=(WorldContext="WorldContextObject")) static USGSenseGlovePose* IdlePose(UObject* WorldContextObject, const USGSenseGloveInfo* GloveInfo); @@ -77,8 +88,11 @@ public: UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Pose") static TArray GetJointPositions(const USGSenseGlovePose* SenseGlovePose); - UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Pose") - static TArray GetJointRotations(const USGSenseGlovePose* SenseGlovePose); + UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotations", Category="SenseGlove | Core | SG | Sense Glove Pose") + static TArray GetJointRotations_TArrayFSGQuatArray(const USGSenseGlovePose* SenseGlovePose); + + UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotations", Category="SenseGlove | Core | SG | Sense Glove Pose") + static TArray GetJointRotations_TArrayFSGRotatorArray(const USGSenseGlovePose* SenseGlovePose); UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Pose") static TArray GetGloveAngles(const USGSenseGlovePose* SenseGlovePose); @@ -86,8 +100,11 @@ public: UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Pose") static TArray GetThimblePositions(const USGSenseGlovePose* SenseGlovePose); - UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Pose") - static TArray GetThimbleRotations(const USGSenseGlovePose* SenseGlovePose); + UFUNCTION(BlueprintPure, DisplayName="Get Thimble Rotations", Category="SenseGlove | Core | SG | Sense Glove Pose") + static TArray GetThimbleRotations_FQuat(const USGSenseGlovePose* SenseGlovePose); + + UFUNCTION(BlueprintPure, DisplayName="Get Thimble Rotations", Category="SenseGlove | Core | SG | Sense Glove Pose") + static TArray GetThimbleRotations_FRotator(const USGSenseGlovePose* SenseGlovePose); UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Pose") static TArray GetTotalGloveAngles(const USGSenseGlovePose* SenseGlovePose); diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveSensorDataKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveSensorDataKismetLibrary.h index d3e01f01..66db287f 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveSensorDataKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveSensorDataKismetLibrary.h @@ -56,10 +56,16 @@ public: UFUNCTION(BlueprintCallable, DisplayName="Make Sense Glove Sensor Data", Category="SenseGlove | Core | SG | Sense Glove Sensor Data", meta=(WorldContext="WorldContextObject")) - static USGSenseGloveSensorData* MakeSenseGloveSensorData_SensorAngles_ImuRotation_ParsedValues_bImuParsed( + static USGSenseGloveSensorData* MakeSenseGloveSensorData_SensorAngles_FQuatImuRotation_ParsedValues_bImuParsed( UObject* WorldContextObject, const TArray& SensorAngles, const FQuat& ImuRotation, int32 ParsedValues, bool bImuParsed); + UFUNCTION(BlueprintCallable, DisplayName="Make Sense Glove Sensor Data", + Category="SenseGlove | Core | SG | Sense Glove Sensor Data", meta=(WorldContext="WorldContextObject")) + static USGSenseGloveSensorData* MakeSenseGloveSensorData_SensorAngles_FRotatorImuRotation_ParsedValues_bImuParsed( + UObject* WorldContextObject, const TArray& SensorAngles, + const FRotator& ImuRotation, int32 ParsedValues, bool bImuParsed); + UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Sensor Data", meta=(WorldContext="WorldContextObject")) static USGSenseGloveSensorData* Empty(UObject* WorldContextObject); @@ -76,8 +82,13 @@ public: UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Sensor Data") static TArray GetSensorAngles(const USGSenseGloveSensorData* SenseGloveSensorData); - UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Sensor Data") - static FQuat GetImuRotation(const USGSenseGloveSensorData* SenseGloveSensorData); + UFUNCTION(BlueprintPure, DisplayName="Get Imu Rotation", + Category="SenseGlove | Core | SG | Sense Glove Sensor Data") + static FQuat GetImuRotation_FQuat(const USGSenseGloveSensorData* SenseGloveSensorData); + + UFUNCTION(BlueprintPure, DisplayName="Get Imu Rotation", + Category="SenseGlove | Core | SG | Sense Glove Sensor Data") + static FRotator GetImuRotation_FRotator(const USGSenseGloveSensorData* SenseGloveSensorData); UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Sensor Data") static int32 GetParsedValues(const USGSenseGloveSensorData* SenseGloveSensorData); diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveVarsKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveVarsKismetLibrary.h index b0af3c0b..f2e6a507 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveVarsKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveVarsKismetLibrary.h @@ -49,7 +49,7 @@ class USGSenseGloveInfo; UCLASS(meta=(ScriptName = "SesneGloveVarsKismetLibrary")) -class SENSEGLOVECOREKISMET_API USGSenseGloveVarsKismetLibrary : public USGBlueprintFunctionLibrary +class SENSEGLOVECOREKISMET_API USGSenseGloveVarsKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() @@ -63,8 +63,13 @@ public: UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Vars") static TArray GetStartPositions(const FString& HardwareVersion, bool bRightHanded); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Vars") - static TArray GetStartRotations(const FString& HardwareVersion, bool bRightHanded); + UFUNCTION(BlueprintCallable, DisplayName="Get Start Rotations", + Category="SenseGlove | Core | SG | Sense Glove Vars") + static TArray GetStartRotations_TArrayFQuat(const FString& HardwareVersion, bool bRightHanded); + + UFUNCTION(BlueprintCallable, DisplayName="Get Start Rotations", + Category="SenseGlove | Core | SG | Sense Glove Vars") + static TArray GetStartRotations_TArrayFRotator(const FString& HardwareVersion, bool bRightHanded); UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Vars") static TArray GetGloveLengths(const FString& HardwareVersion); @@ -72,8 +77,13 @@ public: UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Vars") static int32 GetSensors(const FString& HardwareVersion); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Vars") - static FQuat GetImuCorrection(const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion); + UFUNCTION(BlueprintCallable, DisplayName="Get Imu Correction", Category="SenseGlove | Core | SG | Sense Glove Vars") + static FQuat GetImuCorrection_FQuat(const FString& HardwareVersion, + int32 FirmwareVersion, int32 SubFirmwareVersion); + + UFUNCTION(BlueprintCallable, DisplayName="Get Imu Correction", Category="SenseGlove | Core | SG | Sense Glove Vars") + static FRotator GetImuCorrection_FRotator(const FString& HardwareVersion, + int32 FirmwareVersion, int32 SubFirmwareVersion); UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Vars") static TArray GetFunctions(const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion); diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGTrackingKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGTrackingKismetLibrary.h index fc598ec2..25c5cdac 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGTrackingKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGTrackingKismetLibrary.h @@ -36,6 +36,9 @@ #pragma once #include "Containers/Array.h" +#include "Math/Quat.h" +#include "Math/Rotator.h" +#include "Math/Vector.h" #include "SGKismet/SGBlueprintFunctionLibrary.h" #include "SGTypes/SGCoreTypes.h" @@ -48,89 +51,177 @@ class SENSEGLOVECOREKISMET_API USGTrackingKismetLibrary final : public USGBluepr GENERATED_BODY() public: - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") - static void CalculateLocation( + UFUNCTION(BlueprintCallable, DisplayName="Calculate Location", Category="SenseGlove | Core | Tracking") + static void + CalculateLocation_TrackedPosition_FQuatTrackedRotation_PositionOffset_FQuatRotationOffset_OutNewPosition_FQuatOutNewRotation( const FVector& TrackedPosition, const FQuat& TrackedRotation, const FVector& PositionOffset, const FQuat& RotationOffset, FVector& OutNewPosition, FQuat& OutNewRotation); + UFUNCTION(BlueprintCallable, DisplayName="Calculate Location", Category="SenseGlove | Core | Tracking") + static void + CalculateLocation_TrackedPosition_FRotatorTrackedRotation_PositionOffset_FRotatorRotationOffset_OutNewPosition_FRotatorOutNewRotation( + const FVector& TrackedPosition, const FRotator& TrackedRotation, + const FVector& PositionOffset, const FRotator& RotationOffset, + FVector& OutNewPosition, FRotator& OutNewRotation); + UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static TArray GetSenseGloveFingerToGlovePositionOrigin(); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") - static TArray GetSenseGloveFingerToGloveRotationOrigin(); + UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Finger To Glove Rotation Origin", + Category="SenseGlove | Core | Tracking") + static TArray GetSenseGloveFingerToGloveRotationOrigin_TArrayFQuat(); + + UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Finger To Glove Rotation Origin", + Category="SenseGlove | Core | Tracking") + static TArray GetSenseGloveFingerToGloveRotationOrigin_TArrayFRotator(); UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetSenseGloveWristPositionOffset(); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") - static FQuat GetSenseGloveWristRotationOffset(); + UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Wrist Rotation Offset", + Category="SenseGlove | Core | Tracking") + static FQuat GetSenseGloveWristRotationOffset_FQuat(); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") - static void GetSenseGloveMountOffset(bool bRightHanded, ESGFinger ToFinger, - FVector& OutIPosition, FQuat& OutIRotation); + UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Wrist Rotation Offset", + Category="SenseGlove | Core | Tracking") + static FRotator GetSenseGloveWristRotationOffset_FRotator(); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") - static void GetSenseGloveTrackerMountOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded, - FVector& OutPositionOffset, FQuat& OutRotationOffset); + UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Mount Offset", Category="SenseGlove | Core | Tracking") + static void GetSenseGloveMountOffset_bRightHanded_ToFinger_OutIPosition_FQuatOutIRotation( + bool bRightHanded, ESGFinger ToFinger, + FVector& OutIPosition, FQuat& OutIRotation); + + UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Mount Offset", Category="SenseGlove | Core | Tracking") + static void GetSenseGloveMountOffset_bRightHanded_ToFinger_OutIPosition_FRotatorOutIRotation( + bool bRightHanded, ESGFinger ToFinger, + FVector& OutIPosition, FRotator& OutIRotation); + + UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Tracker Mouunt Offset", + Category="SenseGlove | Core | Tracking") + static void GetSenseGloveTrackerMountOffset_Hardware_bRightHanded_OutPositionOffset_FQuatOutRotationOffset( + ESGPositionalTrackingHardware Hardware, bool bRightHanded, + FVector& OutPositionOffset, FQuat& OutRotationOffset); + + UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Tracker Mouunt Offset", + Category="SenseGlove | Core | Tracking") + static void GetSenseGloveTrackerMountOffset_Hardware_bRightHanded_OutPositionOffset_FRotatorOutRotationOffset( + ESGPositionalTrackingHardware Hardware, bool bRightHanded, + FVector& OutPositionOffset, FRotator& OutRotationOffset); UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetSenseGloveViveToAttachPosition(); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") - static FQuat GetSenseGloveViveToAttachRotation(); + UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Vive To Attach Rotation", + Category="SenseGlove | Core | Tracking") + static FQuat GetSenseGloveViveToAttachRotation_FQuat(); + + UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Vive To Attach Rotation", + Category="SenseGlove | Core | Tracking") + static FRotator GetSenseGloveViveToAttachRotation_FRotator(); UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetSenseGloveOculusTouchToAttachPosition(); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") - static FQuat GetSenseGloveOculusTouchToAttachRotation(); + UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Oculus Touch To Attach Rotation", + Category="SenseGlove | Core | Tracking") + static FQuat GetSenseGloveOculusTouchToAttachRotation_FQuat(); + + UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Oculus Touch To Attach Rotation", + Category="SenseGlove | Core | Tracking") + static FRotator GetSenseGloveOculusTouchToAttachRotation_FRotator(); UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetNovaToWristPositionOffset(); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") - static FQuat GetNovaToWristRotationOffset(); + UFUNCTION(BlueprintCallable, DisplayName="Get Nove To Wrist Rotation Offset", + Category="SenseGlove | Core | Tracking") + static FQuat GetNovaToWristRotationOffset_FQuat(); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") - static void GetNovaGloveWristOffset(bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset); + UFUNCTION(BlueprintCallable, DisplayName="Get Nove To Wrist Rotation Offset", + Category="SenseGlove | Core | Tracking") + static FRotator GetNovaToWristRotationOffset_FRotator(); + + UFUNCTION(BlueprintCallable, DisplayName="Get Nova Glove Wrist Offset", Category="SenseGlove | Core | Tracking") + static void GetNovaGloveWristOffset_bRightHanded_OutPositionOffset_FQuatOutRotationOffset( + bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset); + + UFUNCTION(BlueprintCallable, DisplayName="Get Nova Glove Wrist Offset", Category="SenseGlove | Core | Tracking") + static void GetNovaGloveWristOffset_bRightHanded_OutPositionOffset_FRotatorOutRotationOffset( + bool bRightHanded, FVector& OutPositionOffset, FRotator& OutRotationOffset); UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetRightNovaViveToAttachPosition(); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") - static FQuat GetRightNovaViveToAttachRotation(); + UFUNCTION(BlueprintCallable, DisplayName="Get Right Nova Vive To Attach Rotation", + Category="SenseGlove | Core | Tracking") + static FQuat GetRightNovaViveToAttachRotation_FQuat(); + + UFUNCTION(BlueprintCallable, DisplayName="Get Right Nova Vive To Attach Rotation", + Category="SenseGlove | Core | Tracking") + static FRotator GetRightNovaViveToAttachRotation_FRotator(); UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetLeftNovaViveToAttachPosition(); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") - static FQuat GetLeftNovaViveToAttachRotation(); + UFUNCTION(BlueprintCallable, DisplayName="Get Left Nova Vive To Attach Rotation", + Category="SenseGlove | Core | Tracking") + static FQuat GetLeftNovaViveToAttachRotation_FQuat(); + + UFUNCTION(BlueprintCallable, DisplayName="Get Left Nova Vive To Attach Rotation", + Category="SenseGlove | Core | Tracking") + static FRotator GetLeftNovaViveToAttachRotation_FRotator(); UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetRightNovaQuest2ToAttachPosition(); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") - static FQuat GetRightNovaQuest2ToAttachRotation(); + UFUNCTION(BlueprintCallable, DisplayName="Get Right Nova Quest 2 To Attach Rotation", + Category="SenseGlove | Core | Tracking") + static FQuat GetRightNovaQuest2ToAttachRotation_FQuat(); + + UFUNCTION(BlueprintCallable, DisplayName="Get Right Nova Quest 2 To Attach Rotation", + Category="SenseGlove | Core | Tracking") + static FRotator GetRightNovaQuest2ToAttachRotation_FRotator(); UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetLeftNovaQuest2ToAttachPosition(); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") - static FQuat GetLeftNovaQuest2ToAttachRotation(); + UFUNCTION(BlueprintCallable, DisplayName="Get Left Nova Quest 2 To Attach Rotation", + Category="SenseGlove | Core | Tracking") + static FQuat GetLeftNovaQuest2ToAttachRotation_FQuat(); + + UFUNCTION(BlueprintCallable, DisplayName="Get Left Nova Quest 2 To Attach Rotation", + Category="SenseGlove | Core | Tracking") + static FRotator GetLeftNovaQuest2ToAttachRotation_FRotator(); UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetRightNovaPico2ToAttachPosition(); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") - static FQuat GetRightNovaPico2ToAttachRotation(); + UFUNCTION(BlueprintCallable, DisplayName="Get Right Nova Pico 2 To Attach Rotation", + Category="SenseGlove | Core | Tracking") + static FQuat GetRightNovaPico2ToAttachRotation_FQuat(); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") - static FQuat GetLeftNovaPico2ToAttachRotation(); + UFUNCTION(BlueprintCallable, DisplayName="Get Right Nova Pico 2 To Attach Rotation", + Category="SenseGlove | Core | Tracking") + static FRotator GetRightNovaPico2ToAttachRotation_FRotator(); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") - static void GetNovaGloveTrackerOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded, - FVector& OutPositionOffset, FQuat& OutRotationOffset); + UFUNCTION(BlueprintCallable, DisplayName="Get Left Nova Pico 2 To Attach Rotation", + Category="SenseGlove | Core | Tracking") + static FQuat GetLeftNovaPico2ToAttachRotation_FQuat(); + + UFUNCTION(BlueprintCallable, DisplayName="Get Left Nova Pico 2 To Attach Rotation", + Category="SenseGlove | Core | Tracking") + static FRotator GetLeftNovaPico2ToAttachRotation_FRotator(); + + UFUNCTION(BlueprintCallable, DisplayName="Get Nova Glove Tracker Offset", Category="SenseGlove | Core | Tracking") + static void GetNovaGloveTrackerOffset_Hardware_bRightHanded_OutPositionOffset_FQuatOutRotationOffset( + ESGPositionalTrackingHardware Hardware, bool bRightHanded, + FVector& OutPositionOffset, FQuat& OutRotationOffset); + + UFUNCTION(BlueprintCallable, DisplayName="Get Nova Glove Tracker Offset", Category="SenseGlove | Core | Tracking") + static void GetNovaGloveTrackerOffset_Hardware_bRightHanded_OutPositionOffset_FRotatorOutRotationOffset( + ESGPositionalTrackingHardware Hardware, bool bRightHanded, + FVector& OutPositionOffset, FRotator& OutRotationOffset); UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FString ToString(ESGPositionalTrackingHardware Hardware); diff --git a/Source/SenseGloveUtils/Private/SGUtils/SGArrayUtils.cpp b/Source/SenseGloveUtils/Private/SGUtils/SGArrayUtils.cpp index 4e05c1f1..c7d778c5 100644 --- a/Source/SenseGloveUtils/Private/SGUtils/SGArrayUtils.cpp +++ b/Source/SenseGloveUtils/Private/SGUtils/SGArrayUtils.cpp @@ -33,4 +33,56 @@ */ -#include "SGUtils/SGArrayUtils.h" \ No newline at end of file +#include "SGUtils/SGArrayUtils.h" + +TArray FSGArrayUtils::QuatsToRotators(const TArray& QuatsArray) +{ + TArray RotatorsArray; + + for (const FQuat& Quat: QuatsArray) + { + FRotator Rotator{Quat.Rotator()}; + RotatorsArray.Add(MoveTemp(Rotator)); + } + + return MoveTemp(RotatorsArray); +} + +TArray> FSGArrayUtils::QuatsToRotators(const TArray>& QuatsNestedArray) +{ + TArray> RotatorsNestedArray; + + for (const TArray& InnerQuatsArray: QuatsNestedArray) + { + TArray InnerRotatorsArray{QuatsToRotators(InnerQuatsArray)}; + RotatorsNestedArray.Add(MoveTemp(InnerRotatorsArray)); + } + + return MoveTemp(RotatorsNestedArray); +} + +TArray FSGArrayUtils::RotatorsToQuats(const TArray& RotatorsArray) +{ + TArray QuatsArray; + + for (const FRotator& Rotator: RotatorsArray) + { + FQuat Quat{Rotator.Quaternion()}; + QuatsArray.Add(MoveTemp(Quat)); + } + + return MoveTemp(QuatsArray); +} + +TArray> FSGArrayUtils::RotatorsToQuats(const TArray>& RotatorsNestedArray) +{ + TArray> QuatsNestedArray; + + for (const TArray& RotatorsInnerArray: RotatorsNestedArray) + { + TArray InnerQuatsArray{RotatorsToQuats(RotatorsInnerArray)}; + QuatsNestedArray.Add(MoveTemp(InnerQuatsArray)); + } + + return MoveTemp(QuatsNestedArray); +} \ No newline at end of file diff --git a/Source/SenseGloveUtils/Public/SGUtils/SGArrayUtils.h b/Source/SenseGloveUtils/Public/SGUtils/SGArrayUtils.h index e25c7aa3..2f08c560 100644 --- a/Source/SenseGloveUtils/Public/SGUtils/SGArrayUtils.h +++ b/Source/SenseGloveUtils/Public/SGUtils/SGArrayUtils.h @@ -374,7 +374,8 @@ public: return MoveTemp(ImplArray); } - template S::*InnerArray> + template S::* + InnerArray> static TArray> ToImplType(const TArray& Array) { TArray> ImplArray; @@ -388,7 +389,8 @@ public: return MoveTemp(ImplArray); } - template S::*InnerArray> + template S::* + InnerArray> static TArray> ToImplType(const TArray& Array) { TArray> ImplArray; @@ -429,7 +431,6 @@ public: return MoveTemp(BPNestedArray); } - template static TArray ToBPNestedArray(const TArray>& NestedArray) { @@ -444,6 +445,94 @@ public: return MoveTemp(BPNestedArray); } + static TArray QuatsToRotators(const TArray& QuatsArray); + static TArray> QuatsToRotators(const TArray>& QuatsNestedArray); + + template S::*InnerArray> + static TArray> QuatsToRotators(const TArray& QuatsNestedArray) + { + TArray> RotatorsNestedArray; + + for (const S& BPQuatsInnerArrayContainer: QuatsNestedArray) + { + RotatorsNestedArray.Add(QuatsToRotators(BPQuatsInnerArrayContainer.*InnerArray)); + } + + return MoveTemp(RotatorsNestedArray); + } + + template + static TArray QuatsToRotators(const TArray>& QuatsNestedArray) + { + TArray BPRotatorsNestedArray; + + for (const TArray& QuatsInnerArray: QuatsNestedArray) + { + S BPRotatorsInnerArrayContainer{QuatsToRotators(QuatsInnerArray)}; + BPRotatorsNestedArray.Add(MoveTemp(BPRotatorsInnerArrayContainer)); + } + + return MoveTemp(BPRotatorsNestedArray); + } + + template Q::*InnerArray> + static TArray QuatsToRotators(const TArray& QuatsNestedArray) + { + TArray BPRotatorsNestedArray; + + for (const Q& QuatsInnerArrayContainer: QuatsNestedArray) + { + R BPRotatorsInnerArrayContainer{QuatsToRotators(QuatsInnerArrayContainer.*InnerArray)}; + BPRotatorsNestedArray.Add(MoveTemp(BPRotatorsInnerArrayContainer)); + } + + return MoveTemp(BPRotatorsNestedArray); + } + + static TArray RotatorsToQuats(const TArray& RotatorsArray); + static TArray> RotatorsToQuats(const TArray>& RotatorsNestedArray); + + template S::*InnerArray> + static TArray> RotatorsToQuats(const TArray& RotatorsNestedArray) + { + TArray> QuatsNestedArray; + + for (const S& BPRotatorsInnerArrayContainer: RotatorsNestedArray) + { + QuatsNestedArray.Add(RotatorsToQuats(BPRotatorsInnerArrayContainer.*InnerArray)); + } + + return MoveTemp(QuatsNestedArray); + } + + template + static TArray RotatorsToQuats(const TArray>& RotatorsNestedArray) + { + TArray BPQuatsNestedArray; + + for (const TArray& RotatorsInnerArray: RotatorsNestedArray) + { + S BPQuatsInnerArrayContainer{RotatorsToQuats(RotatorsInnerArray)}; + BPQuatsNestedArray.Add(MoveTemp(BPQuatsInnerArrayContainer)); + } + + return MoveTemp(BPQuatsNestedArray); + } + + template Q::*InnerArray> + static TArray RotatorsToQuats(const TArray& RotatorsNestedArray) + { + TArray BPQuatsNestedArray; + + for (const Q& RotatorsInnerArrayContainer: RotatorsNestedArray) + { + R BPQuatsInnerArrayContainer{RotatorsToQuats(RotatorsInnerArrayContainer.*InnerArray)}; + BPQuatsNestedArray.Add(MoveTemp(BPQuatsInnerArrayContainer)); + } + + return MoveTemp(BPQuatsNestedArray); + } + public: FSGArrayUtils() = delete; virtual ~FSGArrayUtils() = delete;