implement the nova2 api updates and bump the senseglove libraries to v2.101.0-3e1693fb

This commit is contained in:
Mamadou Babaei
2024-03-22 20:54:09 +01:00
parent 695d4f01ba
commit d83251a57c
574 changed files with 22013 additions and 27569 deletions
@@ -68,6 +68,12 @@ float FSGAnatomy::GetThumbJointLimit(const bool bRightHanded, const int32 Joint,
return SGCoreImpl_FSGAnatomyImpl_GetThumbJointLimit(bRightHanded, Joint, Movement, bMax);
}
float FSGAnatomy::ClampJointAngle(
const float Value, const int32 Finger, const bool bRightHand, const int32 Joint, const int32 Movement)
{
return SGCoreImpl_FSGAnatomyImpl_ClampJointAngle(Value, Finger, bRightHand, Joint, Movement);
}
float FSGAnatomy::NormalizeFingerFlexion(const float FlexionInDegrees)
{
return SGCoreImpl_FSGAnatomyImpl_NormalizeFingerFlexion(FlexionInDegrees);
@@ -1,180 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGBuzzCommand.h"
#include "SGFingerCommandImplCast.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_ESGFinger.h"
#include "SGInterop/SGIC_FSGBuzzCommandImpl.h"
#include "SGInterop/SGIC_FSGFingerCommandImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_TArray_int32.h"
#include "SGInterop/SGIC_TSharedPtr_FSGBuzzCommandImpl.h"
USGBuzzCommand* USGBuzzCommand::NewBuzzCommand(UObject* Outer, const FSGBuzzCommandImpl& BuzzCommandImpl)
{
USGBuzzCommand* Instance = NewObject<USGBuzzCommand>(Outer);
Instance->SetFingerCommandImpl(BuzzCommandImpl);
return Instance;
}
USGBuzzCommand* USGBuzzCommand::NewBuzzCommand(UObject* Outer, TSharedRef<FSGBuzzCommandImpl> BuzzCommandImpl)
{
USGBuzzCommand* Instance = NewObject<USGBuzzCommand>(Outer);
Instance->SetFingerCommandImpl(MoveTemp(BuzzCommandImpl));
return Instance;
}
USGBuzzCommand* USGBuzzCommand::NewBuzzCommand(UObject* Outer)
{
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
SGCoreImpl_FSGBuzzCommandImpl_ctor_MakeShared(&OutSharedPtrContainer);
return NewBuzzCommand(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGBuzzCommand* USGBuzzCommand::NewBuzzCommand(UObject* Outer, const TArray<int32>& BuzzLevels)
{
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
FSGIC_TArray_int32 BuzzLevelsContainer{BuzzLevels};
SGCoreImpl_FSGBuzzCommandImpl_ctor_BuzzLevels_MakeShared(
&OutSharedPtrContainer, &BuzzLevelsContainer);
return NewBuzzCommand(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGBuzzCommand* USGBuzzCommand::NewBuzzCommand(UObject* Outer, const int32 Thumb, const int32 Index, const int32 Middle,
const int32 Ring, const int32 Pinky)
{
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
SGCoreImpl_FSGBuzzCommandImpl_ctor_Thumb_Index_Middle_Ring_Pinky_MakeShared(
&OutSharedPtrContainer, Thumb, Index, Middle, Ring, Pinky);
return NewBuzzCommand(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGBuzzCommand* USGBuzzCommand::NewBuzzCommand(UObject* Outer, const ESGFinger Finger, const int32 BuzzLevel)
{
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
FSGIC_ESGFinger FingerContainer{Finger};
SGCoreImpl_FSGBuzzCommandImpl_ctor_Finger_BuzzLevel_MakeShared(
&OutSharedPtrContainer, &FingerContainer, BuzzLevel);
return NewBuzzCommand(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGBuzzCommand* USGBuzzCommand::Off(UObject* Outer)
{
FSGIC_FSGBuzzCommandImpl OutContainer;
SGCoreImpl_FSGBuzzCommandImpl_Off(&OutContainer);
return NewBuzzCommand(Outer, OutContainer.BuzzCommandImpl);
}
USGBuzzCommand::USGBuzzCommand()
: USGFingerCommand()
{
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
SGCoreImpl_FSGBuzzCommandImpl_ctor_MakeShared(&OutSharedPtrContainer);
SetFingerCommandImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGBuzzCommand::USGBuzzCommand(const TArray<int32>& BuzzLevels)
: USGFingerCommand(BuzzLevels)
{
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
FSGIC_TArray_int32 BuzzLevelsContainer{BuzzLevels};
SGCoreImpl_FSGBuzzCommandImpl_ctor_BuzzLevels_MakeShared(
&OutSharedPtrContainer, &BuzzLevelsContainer);
SetFingerCommandImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGBuzzCommand::USGBuzzCommand(
const int32 Thumb, const int32 Index, const int32 Middle, const int32 Ring, const int32 Pinky)
: USGFingerCommand()
{
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
SGCoreImpl_FSGBuzzCommandImpl_ctor_Thumb_Index_Middle_Ring_Pinky_MakeShared(
&OutSharedPtrContainer, Thumb, Index, Middle, Ring, Pinky);
SetFingerCommandImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGBuzzCommand::USGBuzzCommand(const ESGFinger Finger, const int32 BuzzLevel)
: USGFingerCommand()
{
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
FSGIC_ESGFinger FingerContainer{Finger};
SGCoreImpl_FSGBuzzCommandImpl_ctor_Finger_BuzzLevel_MakeShared(
&OutSharedPtrContainer, &FingerContainer, BuzzLevel);
SetFingerCommandImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGBuzzCommand::USGBuzzCommand(const FSGBuzzCommandImpl& BuzzCommandImpl)
: USGFingerCommand(BuzzCommandImpl)
{
}
USGBuzzCommand::USGBuzzCommand(TSharedRef<FSGBuzzCommandImpl> BuzzCommandImpl)
: USGFingerCommand(MoveTemp(BuzzCommandImpl))
{
}
USGBuzzCommand::~USGBuzzCommand() = default;
TSharedRef<FSGBuzzCommandImpl> USGBuzzCommand::ToBuzzCommandImpl() const
{
return FSGFingerCommandImplCast::ToBuzzCommandImpl(ToFingerCommandImpl());
}
USGBuzzCommand* USGBuzzCommand::Copy(UObject* Outer) const
{
FSGIC_TSharedPtr_FSGBuzzCommandImpl InstanceContainer{ToBuzzCommandImpl()};
FSGIC_FSGBuzzCommandImpl OutBuzzCommandImplContainer;
SGCoreImpl_FSGBuzzCommandImpl_Copy(&InstanceContainer, &OutBuzzCommandImplContainer);
return NewBuzzCommand(Outer, MoveTemp(OutBuzzCommandImplContainer.BuzzCommandImpl));
}
USGBuzzCommand* USGBuzzCommand::Merge(UObject* Outer, const USGBuzzCommand* BuzzCommand) const
{
FSGIC_TSharedPtr_FSGBuzzCommandImpl InstanceContainer{ToBuzzCommandImpl()};
FSGIC_FSGBuzzCommandImpl BuzzCommandImplContainer{BuzzCommand->ToBuzzCommandImpl().Get()};
FSGIC_FSGBuzzCommandImpl OutBuzzCommandImplContainer;
SGCoreImpl_FSGBuzzCommandImpl_Merge(&InstanceContainer, &OutBuzzCommandImplContainer, &BuzzCommandImplContainer);
return NewBuzzCommand(Outer, MoveTemp(OutBuzzCommandImplContainer.BuzzCommandImpl));
}
@@ -1,175 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGCalibrationDataPoint.h"
#include "Runtime/Launch/Resources/Version.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_FSGCalibrationDataPointImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_TArray_FVector.h"
struct USGCalibrationDataPoint::FImpl
{
/************************
* Member variables
************************/
FSGCalibrationDataPointImpl CalibrationDataPointImpl;
/************************
* Owner object
************************/
USGCalibrationDataPoint* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGCalibrationDataPoint* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGCalibrationDataPoint* USGCalibrationDataPoint::NewCalibrationDataPoint(
UObject* Outer, const FSGCalibrationDataPointImpl& CalibrationDataPointImpl)
{
USGCalibrationDataPoint* Instance = NewObject<USGCalibrationDataPoint>(Outer);
Instance->SetCalibrationDataPointImpl(CalibrationDataPointImpl);
return Instance;
}
USGCalibrationDataPoint* USGCalibrationDataPoint::NewCalibrationDataPoint(UObject* Outer)
{
FSGIC_FSGCalibrationDataPointImpl OutCalibrationDataPointImplContainer;
SGCoreImpl_FSGCalibrationDataPointImpl_ctor(&OutCalibrationDataPointImplContainer);
return NewCalibrationDataPoint(Outer, MoveTemp(OutCalibrationDataPointImplContainer.CalibrationDataPointImpl));
}
USGCalibrationDataPoint* USGCalibrationDataPoint::NewCalibrationDataPoint(
UObject* Outer, const int32 CurrentStage, const TArray<FVector>& CalibrationValues)
{
FSGIC_FSGCalibrationDataPointImpl OutCalibrationDataPointImplContainer;
FSGIC_TArray_FVector CalibrationValuesContainer{CalibrationValues};
SGCoreImpl_FSGCalibrationDataPointImpl_ctor_CurrentStage_CalibrationValues(
&OutCalibrationDataPointImplContainer, CurrentStage, &CalibrationValuesContainer);
return NewCalibrationDataPoint(Outer, MoveTemp(OutCalibrationDataPointImplContainer.CalibrationDataPointImpl));
}
USGCalibrationDataPoint::USGCalibrationDataPoint()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGCalibrationDataPointImpl OutCalibrationDataPointImplContainer;
SGCoreImpl_FSGCalibrationDataPointImpl_ctor(&OutCalibrationDataPointImplContainer);
Pimpl->CalibrationDataPointImpl = MoveTemp(OutCalibrationDataPointImplContainer.CalibrationDataPointImpl);
}
USGCalibrationDataPoint::USGCalibrationDataPoint(const int32 CurrentStage, const TArray<FVector>& CalibrationValues)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGCalibrationDataPointImpl OutCalibrationDataPointImplContainer;
FSGIC_TArray_FVector CalibrationValuesContainer{CalibrationValues};
SGCoreImpl_FSGCalibrationDataPointImpl_ctor_CurrentStage_CalibrationValues(
&OutCalibrationDataPointImplContainer, CurrentStage, &CalibrationValuesContainer);
Pimpl->CalibrationDataPointImpl = MoveTemp(OutCalibrationDataPointImplContainer.CalibrationDataPointImpl);
}
USGCalibrationDataPoint::USGCalibrationDataPoint(const FSGCalibrationDataPointImpl& CalibrationDataPointImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
SetCalibrationDataPointImpl(CalibrationDataPointImpl);
}
USGCalibrationDataPoint::~USGCalibrationDataPoint() = default;
void USGCalibrationDataPoint::SetCalibrationDataPointImpl(const FSGCalibrationDataPointImpl& CalibrationDataPointImpl)
{
FSGIC_FSGCalibrationDataPointImpl OutCalibrationDataPointContainer;
FSGIC_FSGCalibrationDataPointImpl RhsContainer{CalibrationDataPointImpl};
SGCoreImpl_FSGCalibrationDataPointImpl_ctor_copy(&OutCalibrationDataPointContainer, &RhsContainer);
Pimpl->CalibrationDataPointImpl = MoveTemp(OutCalibrationDataPointContainer.CalibrationDataPointImpl);
}
const FSGCalibrationDataPointImpl& USGCalibrationDataPoint::ToCalibrationDataPointImpl() const
{
return Pimpl->CalibrationDataPointImpl;
}
TArray<FVector> USGCalibrationDataPoint::GetCalibrationValues() const
{
FSGIC_FSGCalibrationDataPointImpl InstanceContainer{ToCalibrationDataPointImpl()};
FSGIC_TArray_FVector OutValuesContainer;
SGCoreImpl_FSGCalibrationDataPointImpl_GetCalibrationValues(&InstanceContainer, &OutValuesContainer);
return MoveTemp(OutValuesContainer.Array);
}
int32 USGCalibrationDataPoint::GetStage() const
{
FSGIC_FSGCalibrationDataPointImpl InstanceContainer{ToCalibrationDataPointImpl()};
return SGCoreImpl_FSGCalibrationDataPointImpl_GetStage(&InstanceContainer);
}
FString USGCalibrationDataPoint::ToLogData(const FString& Delimiter) const
{
FSGIC_FSGCalibrationDataPointImpl InstanceContainer{Pimpl->CalibrationDataPointImpl};
FSGIC_FString DelimiterContainer{Delimiter};
FSGIC_FString OutDataContainer;
SGCoreImpl_FSGCalibrationDataPointImpl_ToLogData(&InstanceContainer, &OutDataContainer, &DelimiterContainer);
return MoveTemp(OutDataContainer.String);
}
USGCalibrationDataPoint::FImpl::FImpl(USGCalibrationDataPoint* InOwner)
: Owner(InOwner)
{
}
USGCalibrationDataPoint::FImpl::~FImpl() = default;
void USGCalibrationDataPoint::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -0,0 +1,340 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGCustomWaveform.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_ESGWaveformType.h"
#include "SGInterop/SGIC_FSGCustomWaveformImpl.h"
#include "SGInterop/SGIC_FString.h"
struct USGCustomWaveform::FImpl
{
/************************
* Member variables
************************/
FSGCustomWaveformImpl CustomWaveformImpl;
/************************
* Owner object
************************/
USGCustomWaveform* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGCustomWaveform* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGCustomWaveform* USGCustomWaveform::NewCustomWaveform(UObject* Outer, const FSGCustomWaveformImpl& CustomWaveformImpl)
{
USGCustomWaveform* Instance = NewObject<USGCustomWaveform>(Outer);
Instance->SetCustomWaveformImpl(CustomWaveformImpl);
return Instance;
}
USGCustomWaveform* USGCustomWaveform::NewCustomWaveform(UObject* Outer)
{
FSGIC_FSGCustomWaveformImpl OutCustomWaveformImplContainer;
SGCoreImpl_FSGCustomWaveformImpl_ctor(&OutCustomWaveformImplContainer);
return NewCustomWaveform(Outer, MoveTemp(OutCustomWaveformImplContainer.CustomWaveformImpl));
}
USGCustomWaveform* USGCustomWaveform::NewCustomWaveform(UObject* Outer, const float Amplitude, const float Duration)
{
FSGIC_FSGCustomWaveformImpl OutCustomWaveformImplContainer;
SGCoreImpl_FSGCustomWaveformImpl_ctor_Amplitude_Duration(
&OutCustomWaveformImplContainer, Amplitude, Duration);
return NewCustomWaveform(Outer, MoveTemp(OutCustomWaveformImplContainer.CustomWaveformImpl));
}
USGCustomWaveform* USGCustomWaveform::NewCustomWaveform(
UObject* Outer, const float Amplitude, const float Duration, const float Frequency)
{
FSGIC_FSGCustomWaveformImpl OutCustomWaveformImplContainer;
SGCoreImpl_FSGCustomWaveformImpl_ctor_Amplitude_Duration_Frequency(
&OutCustomWaveformImplContainer, Amplitude, Duration, Frequency);
return NewCustomWaveform(Outer, MoveTemp(OutCustomWaveformImplContainer.CustomWaveformImpl));
}
FString USGCustomWaveform::ToString(const ESGWaveformType Type)
{
FSGIC_ESGWaveformType TypeContainer{Type};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGCustomWaveformImpl_ToString_Type(&OutStringContainer, &TypeContainer);
return MoveTemp(OutStringContainer.String);
}
USGCustomWaveform::USGCustomWaveform()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGCustomWaveformImpl OutCustomWaveformImplContainer;
SGCoreImpl_FSGCustomWaveformImpl_ctor(&OutCustomWaveformImplContainer);
Pimpl->CustomWaveformImpl = MoveTemp(OutCustomWaveformImplContainer.CustomWaveformImpl);
}
USGCustomWaveform::USGCustomWaveform(const float Amplitude, const float Duration)
{
FSGIC_FSGCustomWaveformImpl OutCustomWaveformImplContainer;
SGCoreImpl_FSGCustomWaveformImpl_ctor_Amplitude_Duration(
&OutCustomWaveformImplContainer, Amplitude, Duration);
Pimpl->CustomWaveformImpl = MoveTemp(OutCustomWaveformImplContainer.CustomWaveformImpl);
}
USGCustomWaveform::USGCustomWaveform(const float Amplitude, const float Duration, const float Frequency)
{
FSGIC_FSGCustomWaveformImpl OutCustomWaveformImplContainer;
SGCoreImpl_FSGCustomWaveformImpl_ctor_Amplitude_Duration_Frequency(
&OutCustomWaveformImplContainer, Amplitude, Duration, Frequency);
Pimpl->CustomWaveformImpl = MoveTemp(OutCustomWaveformImplContainer.CustomWaveformImpl);
}
USGCustomWaveform::USGCustomWaveform(const FSGCustomWaveformImpl& CustomWaveformImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
SetCustomWaveformImpl(CustomWaveformImpl);
}
USGCustomWaveform::~USGCustomWaveform() = default;
void USGCustomWaveform::SetCustomWaveformImpl(const FSGCustomWaveformImpl& CustomWaveformImpl)
{
FSGIC_FSGCustomWaveformImpl OutCustomWaveformContainer;
FSGIC_FSGCustomWaveformImpl RhsContainer{CustomWaveformImpl};
SGCoreImpl_FSGCustomWaveformImpl_ctor_copy(&OutCustomWaveformContainer, &RhsContainer);
Pimpl->CustomWaveformImpl = MoveTemp(OutCustomWaveformContainer.CustomWaveformImpl);
}
const FSGCustomWaveformImpl& USGCustomWaveform::ToCustomWaveformImpl() const
{
return Pimpl->CustomWaveformImpl;
}
float USGCustomWaveform::GetAmplitude() const
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
return SGCoreImpl_FSGCustomWaveformImpl_GetAmplitude(&InstanceContainer);
}
void USGCustomWaveform::SetAmplitude(const float Amplitude)
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
SGCoreImpl_FSGCustomWaveformImpl_SetAmplitude(&InstanceContainer, Amplitude);
}
ESGWaveformType USGCustomWaveform::GetWaveType() const
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
FSGIC_ESGWaveformType OutTypeContainer;
SGCoreImpl_FSGCustomWaveformImpl_GetWaveType(&InstanceContainer, &OutTypeContainer);
return MoveTemp(OutTypeContainer.Type);
}
void USGCustomWaveform::SetWaveType(const ESGWaveformType Type)
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
FSGIC_ESGWaveformType TypeContainer{Type};
SGCoreImpl_FSGCustomWaveformImpl_SetWaveType(&InstanceContainer, &TypeContainer);
}
bool USGCustomWaveform::IsInfinite() const
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
return SGCoreImpl_FSGCustomWaveformImpl_IsInfinite(&InstanceContainer);
}
void USGCustomWaveform::SetInfinite(const bool bInfinite)
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
SGCoreImpl_FSGCustomWaveformImpl_SetInfinite(&InstanceContainer, bInfinite);
}
int32 USGCustomWaveform::GetRepeatAmount() const
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
return SGCoreImpl_FSGCustomWaveformImpl_GetRepeatAmount(&InstanceContainer);
}
void USGCustomWaveform::SetRepeatAmount(const int32 Amount)
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
SGCoreImpl_FSGCustomWaveformImpl_SetRepeatAmount(&InstanceContainer, Amount);
}
float USGCustomWaveform::GetAttackTime() const
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
return SGCoreImpl_FSGCustomWaveformImpl_GetAttackTime(&InstanceContainer);
}
void USGCustomWaveform::SetAttackTime(const float Time)
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
SGCoreImpl_FSGCustomWaveformImpl_SetAttackTime(&InstanceContainer, Time);
}
float USGCustomWaveform::GetSustainTime() const
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
return SGCoreImpl_FSGCustomWaveformImpl_GetSustainTime(&InstanceContainer);
}
void USGCustomWaveform::SetSustainTime(const float Time)
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
SGCoreImpl_FSGCustomWaveformImpl_SetSustainTime(&InstanceContainer, Time);
}
float USGCustomWaveform::GetDecayTime() const
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
return SGCoreImpl_FSGCustomWaveformImpl_GetDecayTime(&InstanceContainer);
}
void USGCustomWaveform::SetDecayTime(const float Time)
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
SGCoreImpl_FSGCustomWaveformImpl_SetDecayTime(&InstanceContainer, Time);
}
float USGCustomWaveform::GetFrequencyStart() const
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
return SGCoreImpl_FSGCustomWaveformImpl_GetFrequencyStart(&InstanceContainer);
}
void USGCustomWaveform::SetFrequencyStart(const float Frequency)
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
SGCoreImpl_FSGCustomWaveformImpl_SetFrequencyStart(&InstanceContainer, Frequency);
}
float USGCustomWaveform::GetFrequencyEnd() const
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
return SGCoreImpl_FSGCustomWaveformImpl_GetFrequencyEnd(&InstanceContainer);
}
void USGCustomWaveform::SetFrequencyEnd(const float Frequency)
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
SGCoreImpl_FSGCustomWaveformImpl_SetFrequencyEnd(&InstanceContainer, Frequency);
}
float USGCustomWaveform::GetFrequencySwitchTime() const
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
return SGCoreImpl_FSGCustomWaveformImpl_GetFrequencySwitchTime(&InstanceContainer);
}
void USGCustomWaveform::SetFrequencySwitchTime(const float Time)
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
SGCoreImpl_FSGCustomWaveformImpl_SetFrequencySwitchTime(&InstanceContainer, Time);
}
float USGCustomWaveform::GetFrequencySwitchFactor() const
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
return SGCoreImpl_FSGCustomWaveformImpl_GetFrequencySwitchFactor(&InstanceContainer);
}
void USGCustomWaveform::SetFrequencySwitchFactor(const float Time)
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
SGCoreImpl_FSGCustomWaveformImpl_SetFrequencySwitchFactor(&InstanceContainer, Time);
}
float USGCustomWaveform::GetEffectTime() const
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
return SGCoreImpl_FSGCustomWaveformImpl_GetEffectTime(&InstanceContainer);
}
float USGCustomWaveform::GetTotalEffectTime() const
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
return SGCoreImpl_FSGCustomWaveformImpl_GetTotalEffectTime(&InstanceContainer);
}
bool USGCustomWaveform::FrequencyJumps() const
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
return SGCoreImpl_FSGCustomWaveformImpl_FrequencyJumps(&InstanceContainer);
}
bool USGCustomWaveform::Equals(const USGCustomWaveform* CustomWaveform) const
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
FSGIC_FSGCustomWaveformImpl CustomWaveformContainer{CustomWaveform->ToCustomWaveformImpl()};
return SGCoreImpl_FSGCustomWaveformImpl_Equals(&InstanceContainer, &CustomWaveformContainer);
}
FString USGCustomWaveform::ToString() const
{
FSGIC_FSGCustomWaveformImpl InstanceContainer{ToCustomWaveformImpl()};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGCustomWaveformImpl_ToString(&InstanceContainer, &OutStringContainer);
return MoveTemp(OutStringContainer.String);
}
USGCustomWaveform::FImpl::FImpl(USGCustomWaveform* InOwner)
: Owner(InOwner)
{
}
USGCustomWaveform::FImpl::~FImpl() = default;
void USGCustomWaveform::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -36,25 +36,25 @@
#include "SGCore/SGDevice.h"
#include "Engine/Engine.h"
#include "Engine/GameViewportClient.h"
#include "Engine/World.h"
#include "Kismet/GameplayStatics.h"
#include "Runtime/Launch/Resources/Version.h"
#include "SGCoreImpl/SGBetaDeviceImpl.h"
#include "SGCoreImpl/SGBetaDeviceImpl.h"
#include "SGCoreImpl/SGDeviceImpl.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_ESGConnectionType.h"
#include "SGInterop/SGIC_ESGDeviceType.h"
#include "SGInterop/SGIC_ESGHapticChannelType.h"
#include "SGInterop/SGIC_FSGBetaDeviceImpl.h"
#include "SGInterop/SGIC_FSGDeviceImpl.h"
#include "SGInterop/SGIC_FSGHapticChannelInfoImpl.h"
#include "SGInterop/SGIC_FSGHapticGloveImpl.h"
#include "SGInterop/SGIC_FSGNova2GloveImpl.h"
#include "SGInterop/SGIC_FSGNovaGloveImpl.h"
#include "SGInterop/SGIC_FSGSenseGloveImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_TSharedPtr_FSGBetaDeviceImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGDeviceImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGHapticGloveImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGNova2GloveImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGNovaGloveImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGSenseGloveImpl.h"
@@ -93,6 +93,24 @@ void USGDevice::ParseFirmware(const FString& RawFirmware, int32& OutMainVersion,
SGCoreImpl_FSGDeviceImpl_ParseFirmware(&RawFirmwareContainer, &OutMainVersion, &OutSubVersion);
}
bool USGDevice::FirmwareNewerThan(
const int32 MyFirmwareMain, const int32 MyFirmwareSub, const int32 ReferenceMain, const int32 ReferenceSub,
const bool bInclusive)
{
return
SGCoreImpl_FSGDeviceImpl_FirmwareNewerThan_MyFirmwareMain_MyFirmwareSub_ReferenceMain_ReferenceSub_bInclusive(
MyFirmwareMain, MyFirmwareSub, ReferenceMain, ReferenceSub, bInclusive);
}
bool USGDevice::FirmwareOlderThan(
const int32 MyFirmwareMain, const int32 MyFirmwareSub, const int32 ReferenceMain, const int32 ReferenceSub,
const bool bInclusive)
{
return
SGCoreImpl_FSGDeviceImpl_FirmwareOlderThan_MyFirmwareMain_MyFirmwareSub_ReferenceMain_ReferenceSub_bInclusive(
MyFirmwareMain, MyFirmwareSub, ReferenceMain, ReferenceSub, bInclusive);
}
FString USGDevice::ToString(const ESGDeviceType DeviceType)
{
FSGIC_ESGDeviceType DeviceTypeContainer{DeviceType};
@@ -140,6 +158,16 @@ USGDevice::USGDevice(const FSGHapticGloveImpl& HapticGloveImpl)
Pimpl->SGDeviceImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
USGDevice::USGDevice(const FSGNova2GloveImpl& Nova2GloveImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_TSharedPtr_FSGNova2GloveImpl OutSharedPtrContainer;
FSGIC_FSGNova2GloveImpl RhsContainer{Nova2GloveImpl};
SGCoreImpl_FSGNova2GloveImpl_ctor_copy_MakeShared(&OutSharedPtrContainer, &RhsContainer);
Pimpl->SGDeviceImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
USGDevice::USGDevice(const FSGNovaGloveImpl& NovaGloveImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
@@ -178,6 +206,12 @@ USGDevice::USGDevice(TSharedRef<FSGHapticGloveImpl> HapticGloveImpl)
Pimpl->SGDeviceImpl = MoveTemp(HapticGloveImpl);
}
USGDevice::USGDevice(TSharedRef<FSGNova2GloveImpl> Nova2GloveImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
Pimpl->SGDeviceImpl = MoveTemp(Nova2GloveImpl);
}
USGDevice::USGDevice(TSharedRef<FSGNovaGloveImpl> NovaGloveImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
@@ -216,6 +250,14 @@ void USGDevice::SetSGDeviceImpl(const FSGHapticGloveImpl& HapticGloveImpl)
Pimpl->SGDeviceImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
void USGDevice::SetSGDeviceImpl(const FSGNova2GloveImpl& Nova2GloveImpl)
{
FSGIC_TSharedPtr_FSGNova2GloveImpl OutSharedPtrContainer;
FSGIC_FSGNova2GloveImpl RhsContainer{Nova2GloveImpl};
SGCoreImpl_FSGNovaGloveImpl_ctor_copy_MakeShared(&OutSharedPtrContainer, &RhsContainer);
Pimpl->SGDeviceImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
void USGDevice::SetSGDeviceImpl(const FSGNovaGloveImpl& NovaGloveImpl)
{
FSGIC_TSharedPtr_FSGNovaGloveImpl OutSharedPtrContainer;
@@ -247,6 +289,11 @@ void USGDevice::SetSGDeviceImpl(TSharedRef<FSGHapticGloveImpl> HapticGloveImpl)
Pimpl->SGDeviceImpl = MoveTemp(HapticGloveImpl);
}
void USGDevice::SetSGDeviceImpl(TSharedRef<FSGNova2GloveImpl> Nova2GloveImpl)
{
Pimpl->SGDeviceImpl = MoveTemp(Nova2GloveImpl);
}
void USGDevice::SetSGDeviceImpl(TSharedRef<FSGNovaGloveImpl> NovaGloveImpl)
{
Pimpl->SGDeviceImpl = MoveTemp(NovaGloveImpl);
@@ -284,6 +331,20 @@ FString USGDevice::GetFirmwareString() const
return MoveTemp(OutStringContainer.String);
}
bool USGDevice::FirmwareNewerThan(int32 FirmwareMain, int32 FirmwareSub, bool bInclusive) const
{
FSGIC_TSharedPtr_FSGDeviceImpl InstanceContainer{ToSGDeviceImpl()};
return SGCoreImpl_FSGDeviceImpl_FirmwareNewerThan_MyFirmwareMain_MyFirmwareSub_bInclusive(
&InstanceContainer, FirmwareMain, FirmwareSub, bInclusive);
}
bool USGDevice::FirmwareOlderThan(int32 FirmwareMain, int32 FirmwareSub, bool bInclusive) const
{
FSGIC_TSharedPtr_FSGDeviceImpl InstanceContainer{ToSGDeviceImpl()};
return SGCoreImpl_FSGDeviceImpl_FirmwareOlderThan_MyFirmwareMain_MyFirmwareSub_bInclusive(
&InstanceContainer, FirmwareMain, FirmwareSub, bInclusive);
}
FString USGDevice::GetAddress() const
{
FSGIC_TSharedPtr_FSGDeviceImpl InstanceContainer{ToSGDeviceImpl()};
@@ -357,6 +418,26 @@ bool USGDevice::GetBatteryLevel(float& OutLevel)
return bResult;
}
void USGDevice::SetHapticChannels(const USGHapticChannelInfo* Channels)
{
FSGIC_TSharedPtr_FSGDeviceImpl InstanceContainer{ToSGDeviceImpl()};
FSGIC_FSGHapticChannelInfoImpl ChannelsContainer{Channels->ToHapticChannelInfoImpl()};
SGCoreImpl_FSGDeviceImpl_SetHapticChannels(&InstanceContainer, &ChannelsContainer);
}
int32 USGDevice::GetHapticChannelCount() const
{
FSGIC_TSharedPtr_FSGDeviceImpl InstanceContainer{ToSGDeviceImpl()};
return SGCoreImpl_FSGDeviceImpl_GetHapticChannelCount(&InstanceContainer);
}
int32 USGDevice::GetHapticChannelCount(ESGHapticChannelType ChannelType) const
{
FSGIC_TSharedPtr_FSGDeviceImpl InstanceContainer{ToSGDeviceImpl()};
FSGIC_ESGHapticChannelType ChannelTypeContainer{ChannelType};
return SGCoreImpl_FSGDeviceImpl_GetHapticChannelCount_ChannelType(&InstanceContainer, &ChannelTypeContainer);
}
FString USGDevice::ToString() const
{
FSGIC_TSharedPtr_FSGDeviceImpl InstanceContainer{ToSGDeviceImpl()};
@@ -39,11 +39,13 @@
#include "SGCoreImpl/SGDeviceImpl.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGCoreImpl/SGHapticGloveImpl.h"
#include "SGCoreImpl/SGNova2GloveImpl.h"
#include "SGCoreImpl/SGNovaGloveImpl.h"
#include "SGCoreImpl/SGSenseGloveImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGBetaDeviceImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGDeviceImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGHapticGloveImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGNova2GloveImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGNovaGloveImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGSenseGloveImpl.h"
@@ -63,6 +65,14 @@ TSharedRef<FSGHapticGloveImpl> FSGDeviceImplCast::ToHapticGloveImpl(TSharedRef<F
return OutSharedPtrContainer.Ptr.ToSharedRef();
}
TSharedRef<FSGNova2GloveImpl> FSGDeviceImplCast::ToNova2GloveImpl(TSharedRef<FSGDeviceImpl> SGDeviceImpl)
{
FSGIC_TSharedPtr_FSGDeviceImpl InstanceContainer{MoveTemp(SGDeviceImpl)};
FSGIC_TSharedPtr_FSGNova2GloveImpl OutSharedPtrContainer;
SGCoreImpl_FSGDeviceImpl_ToNova2GloveImplRef(&InstanceContainer, &OutSharedPtrContainer);
return OutSharedPtrContainer.Ptr.ToSharedRef();
}
TSharedRef<FSGNovaGloveImpl> FSGDeviceImplCast::ToNovaGloveImpl(TSharedRef<FSGDeviceImpl> SGDeviceImpl)
{
FSGIC_TSharedPtr_FSGDeviceImpl InstanceContainer{MoveTemp(SGDeviceImpl)};
@@ -40,6 +40,7 @@
class FSGBetaDeviceImpl;
class FSGDeviceImpl;
class FSGHapticGloveImpl;
class FSGNova2GloveImpl;
class FSGNovaGloveImpl;
class FSGSenseGloveImpl;
@@ -50,6 +51,8 @@ public:
static TSharedRef<FSGHapticGloveImpl> ToHapticGloveImpl(TSharedRef<FSGDeviceImpl> SGDeviceImpl);
static TSharedRef<FSGNova2GloveImpl> ToNova2GloveImpl(TSharedRef<FSGDeviceImpl> SGDeviceImpl);
static TSharedRef<FSGNovaGloveImpl> ToNovaGloveImpl(TSharedRef<FSGDeviceImpl> SGDeviceImpl);
static TSharedRef<FSGSenseGloveImpl> ToSenseGloveImpl(TSharedRef<FSGDeviceImpl> SGDeviceImpl);
@@ -165,11 +165,12 @@ bool FSGDeviceList::GetSensorDataString(const int32 IpcIndex, const FString& Ipc
return bReturn;
}
bool FSGDeviceList::SendHaptics(const int32 IpcIndex, const FString& IpcAddress, const FString& Commands)
bool FSGDeviceList::SendHaptics(
const int32 IpcIndex, const FString& IpcAddress, const int32 ChannelIndex, const FString& Commands)
{
FSGIC_FString IpcAddressContainer{IpcAddress};
FSGIC_FString CommandsContainer{Commands};
return SGCoreImpl_FSGDeviceListImpl_SendHaptics(IpcIndex, &IpcAddressContainer, &CommandsContainer);
return SGCoreImpl_FSGDeviceListImpl_SendHaptics(IpcIndex, &IpcAddressContainer, ChannelIndex, &CommandsContainer);
}
FString FSGDeviceList::GetDeviceStringAt(const int32 IpcIndex, const FString& IpcAddress, const int32 Index)
@@ -188,6 +188,22 @@ int32 USGDeviceModel::GetSubFirmwareVersion() const
return SGCoreImpl_FSGDeviceModelImpl_GetSubFirmwareVersion(&InstanceContainer);
}
bool USGDeviceModel::FirmwareNewerThan(const int32 FirmwareMain, const int32 FirmwareSub,
const bool bInclusive) const
{
FSGIC_FSGDeviceModelImpl InstanceContainer{ToDeviceModelImpl()};
return SGCoreImpl_FSGDeviceModelImpl_FirmwareNewerThan(
&InstanceContainer, FirmwareMain, FirmwareSub, bInclusive);
}
bool USGDeviceModel::FirmwareOlderThan(const int32 FirmwareMain, const int32 FirmwareSub,
const bool bInclusive) const
{
FSGIC_FSGDeviceModelImpl InstanceContainer{ToDeviceModelImpl()};
return SGCoreImpl_FSGDeviceModelImpl_FirmwareOlderThan(
&InstanceContainer, FirmwareMain, FirmwareSub, bInclusive);
}
USGDeviceModel::FImpl::FImpl(USGDeviceModel* InOwner)
: Owner(InOwner)
{
@@ -1,274 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGFingerCommand.h"
#include "Runtime/Launch/Resources/Version.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_FSGBuzzCommandImpl.h"
#include "SGInterop/SGIC_FSGFingerCommandImpl.h"
#include "SGInterop/SGIC_FSGForceFeedbackCommandImpl.h"
#include "SGInterop/SGIC_FSGTimedBuzzCommandImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_TArray_int32.h"
#include "SGInterop/SGIC_TSharedPtr_FSGBuzzCommandImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGFingerCommandImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGForceFeedbackCommandImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGTimedBuzzCommandImpl.h"
struct USGFingerCommand::FImpl
{
/************************
* Member variables
************************/
TSharedPtr<FSGFingerCommandImpl> FingerCommandImpl;
/************************
* Owner object
************************/
USGFingerCommand* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGFingerCommand* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGFingerCommand::USGFingerCommand()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_TSharedPtr_FSGFingerCommandImpl OutSharedPtrContainer;
SGCoreImpl_FSGFingerCommandImpl_ctor_MakeShared(&OutSharedPtrContainer);
Pimpl->FingerCommandImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
USGFingerCommand::USGFingerCommand(const TArray<int32>& InLevels)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_TSharedPtr_FSGFingerCommandImpl OutSharedPtrContainer;
FSGIC_TArray_int32 LevelsContainer{InLevels};
SGCoreImpl_FSGFingerCommandImpl_ctor_Levels_MakeShared(&OutSharedPtrContainer, &LevelsContainer);
Pimpl->FingerCommandImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
USGFingerCommand::USGFingerCommand(const FSGFingerCommandImpl& FingerCommandImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_TSharedPtr_FSGFingerCommandImpl OutSharedPtrContainer;
FSGIC_FSGFingerCommandImpl RhsContainer{FingerCommandImpl};
SGCoreImpl_FSGFingerCommandImpl_ctor_copy_MakeShared(
&OutSharedPtrContainer, &RhsContainer);
Pimpl->FingerCommandImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
USGFingerCommand::USGFingerCommand(const FSGBuzzCommandImpl& BuzzCommandImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
FSGIC_FSGBuzzCommandImpl RhsContainer{BuzzCommandImpl};
SGCoreImpl_FSGBuzzCommandImpl_ctor_copy_MakeShared(
&OutSharedPtrContainer, &RhsContainer);
Pimpl->FingerCommandImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
USGFingerCommand::USGFingerCommand(const FSGForceFeedbackCommandImpl& ForceFeedbackCommandImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_TSharedPtr_FSGForceFeedbackCommandImpl OutSharedPtrContainer;
FSGIC_FSGForceFeedbackCommandImpl RhsContainer{ForceFeedbackCommandImpl};
SGCoreImpl_FSGForceFeedbackCommandImpl_ctor_copy_MakeShared(
&OutSharedPtrContainer, &RhsContainer);
Pimpl->FingerCommandImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
USGFingerCommand::USGFingerCommand(const FSGTimedBuzzCommandImpl& TimedBuzzCommandImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl OutSharedPtrContainer;
FSGIC_FSGTimedBuzzCommandImpl RhsContainer{TimedBuzzCommandImpl};
SGCoreImpl_FSGTimedBuzzCommandImpl_ctor_copy_MakeShared(
&OutSharedPtrContainer, &RhsContainer);
Pimpl->FingerCommandImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
USGFingerCommand::USGFingerCommand(TSharedRef<FSGFingerCommandImpl> FingerCommandImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
Pimpl->FingerCommandImpl = MoveTemp(FingerCommandImpl);
}
USGFingerCommand::USGFingerCommand(TSharedRef<FSGBuzzCommandImpl> BuzzCommandImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
Pimpl->FingerCommandImpl = MoveTemp(BuzzCommandImpl);
}
USGFingerCommand::USGFingerCommand(TSharedRef<FSGForceFeedbackCommandImpl> ForceFeedbackCommandImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
Pimpl->FingerCommandImpl = MoveTemp(ForceFeedbackCommandImpl);
}
USGFingerCommand::USGFingerCommand(TSharedRef<FSGTimedBuzzCommandImpl> TimedBuzzCommandImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
Pimpl->FingerCommandImpl = MoveTemp(TimedBuzzCommandImpl);
}
USGFingerCommand::~USGFingerCommand() = default;
void USGFingerCommand::SetFingerCommandImpl(const FSGFingerCommandImpl& FingerCommandImpl)
{
FSGIC_TSharedPtr_FSGFingerCommandImpl OutSharedPtrContainer;
FSGIC_FSGFingerCommandImpl RhsContainer{FingerCommandImpl};
SGCoreImpl_FSGFingerCommandImpl_ctor_copy_MakeShared(&OutSharedPtrContainer, &RhsContainer);
Pimpl->FingerCommandImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
void USGFingerCommand::SetFingerCommandImpl(const FSGBuzzCommandImpl& BuzzCommandImpl)
{
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
FSGIC_FSGBuzzCommandImpl RhsContainer{BuzzCommandImpl};
SGCoreImpl_FSGBuzzCommandImpl_ctor_copy_MakeShared(&OutSharedPtrContainer, &RhsContainer);
Pimpl->FingerCommandImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
void USGFingerCommand::SetFingerCommandImpl(const FSGForceFeedbackCommandImpl& ForceFeedbackCommandImpl)
{
FSGIC_TSharedPtr_FSGForceFeedbackCommandImpl OutSharedPtrContainer;
FSGIC_FSGForceFeedbackCommandImpl RhsContainer{ForceFeedbackCommandImpl};
SGCoreImpl_FSGForceFeedbackCommandImpl_ctor_copy_MakeShared(&OutSharedPtrContainer, &RhsContainer);
Pimpl->FingerCommandImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
void USGFingerCommand::SetFingerCommandImpl(const FSGTimedBuzzCommandImpl& TimedBuzzCommandImpl)
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl OutSharedPtrContainer;
FSGIC_FSGTimedBuzzCommandImpl RhsContainer{TimedBuzzCommandImpl};
SGCoreImpl_FSGTimedBuzzCommandImpl_ctor_copy_MakeShared(&OutSharedPtrContainer, &RhsContainer);
Pimpl->FingerCommandImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
void USGFingerCommand::SetFingerCommandImpl(TSharedRef<FSGFingerCommandImpl> FingerCommandImpl)
{
Pimpl->FingerCommandImpl = MoveTemp(FingerCommandImpl);
}
void USGFingerCommand::SetFingerCommandImpl(TSharedRef<FSGBuzzCommandImpl> BuzzCommandImpl)
{
Pimpl->FingerCommandImpl = MoveTemp(BuzzCommandImpl);
}
void USGFingerCommand::SetFingerCommandImpl(TSharedRef<FSGForceFeedbackCommandImpl> ForceFeedbackCommandImpl)
{
Pimpl->FingerCommandImpl = MoveTemp(ForceFeedbackCommandImpl);
}
void USGFingerCommand::SetFingerCommandImpl(TSharedRef<FSGTimedBuzzCommandImpl> TimedBuzzCommandImpl)
{
Pimpl->FingerCommandImpl = MoveTemp(TimedBuzzCommandImpl);
}
TSharedRef<FSGFingerCommandImpl> USGFingerCommand::ToFingerCommandImpl() const
{
return Pimpl->FingerCommandImpl.ToSharedRef();
}
TArray<int32> USGFingerCommand::GetLevels() const
{
FSGIC_TSharedPtr_FSGFingerCommandImpl InstanceContainer{ToFingerCommandImpl()};
FSGIC_TArray_int32 OutLevelsContainer;
SGCoreImpl_FSGFingerCommandImpl_GetLevels(&InstanceContainer, &OutLevelsContainer);
return MoveTemp(OutLevelsContainer.Array);
}
int32 USGFingerCommand::GetLevel(const int32 Finger) const
{
FSGIC_TSharedPtr_FSGFingerCommandImpl InstanceContainer{ToFingerCommandImpl()};
const int32 Level = SGCoreImpl_FSGFingerCommandImpl_GetLevel(&InstanceContainer, Finger);
return Level;
}
void USGFingerCommand::SetLevel(const int32 Finger, const int32 Value)
{
FSGIC_TSharedPtr_FSGFingerCommandImpl InstanceContainer{ToFingerCommandImpl()};
SGCoreImpl_FSGFingerCommandImpl_SetLevel(&InstanceContainer, Finger, Value);
}
bool USGFingerCommand::Equals(const USGFingerCommand* FingerCommand) const
{
FSGIC_TSharedPtr_FSGFingerCommandImpl InstanceContainer{ToFingerCommandImpl()};
FSGIC_FSGFingerCommandImpl FingerCommandImplContainer{FingerCommand->ToFingerCommandImpl().Get()};
const bool bEquals = SGCoreImpl_FSGFingerCommandImpl_Equals(&InstanceContainer, &FingerCommandImplContainer);
return bEquals;
}
FString USGFingerCommand::ToString() const
{
FSGIC_TSharedPtr_FSGFingerCommandImpl InstanceContainer{ToFingerCommandImpl()};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGFingerCommandImpl_ToString(&InstanceContainer, &OutStringContainer);
return MoveTemp(OutStringContainer.String);
}
USGFingerCommand::FImpl::FImpl(USGFingerCommand* InOwner)
: Owner(InOwner)
{
}
USGFingerCommand::FImpl::~FImpl() = default;
void USGFingerCommand::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -1,70 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGFingerCommandImplCast.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGCoreImpl/SGFingerCommandImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGBuzzCommandImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGFingerCommandImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGForceFeedbackCommandImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGTimedBuzzCommandImpl.h"
TSharedRef<FSGBuzzCommandImpl> FSGFingerCommandImplCast::ToBuzzCommandImpl(
TSharedRef<FSGFingerCommandImpl> FingerCommandImpl)
{
FSGIC_TSharedPtr_FSGFingerCommandImpl InstanceContainer{MoveTemp(FingerCommandImpl)};
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
SGCoreImpl_FSGFingerCommandImpl_ToBuzzCommandImplRef(&InstanceContainer, &OutSharedPtrContainer);
return OutSharedPtrContainer.Ptr.ToSharedRef();
}
TSharedRef<FSGForceFeedbackCommandImpl> FSGFingerCommandImplCast::ToForceFeedbackCommandImpl(
TSharedRef<FSGFingerCommandImpl> FingerCommandImpl)
{
FSGIC_TSharedPtr_FSGFingerCommandImpl InstanceContainer{MoveTemp(FingerCommandImpl)};
FSGIC_TSharedPtr_FSGForceFeedbackCommandImpl OutSharedPtrContainer;
SGCoreImpl_FSGFingerCommandImpl_ToForceFeedbackCommandImplRef(&InstanceContainer, &OutSharedPtrContainer);
return OutSharedPtrContainer.Ptr.ToSharedRef();
}
TSharedRef<FSGTimedBuzzCommandImpl> FSGFingerCommandImplCast::ToTimedBuzzCommandImpl(
TSharedRef<FSGFingerCommandImpl> FingerCommandImpl)
{
FSGIC_TSharedPtr_FSGFingerCommandImpl InstanceContainer{MoveTemp(FingerCommandImpl)};
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl OutSharedPtrContainer;
SGCoreImpl_FSGFingerCommandImpl_ToTimedBuzzCommandImplRef(&InstanceContainer, &OutSharedPtrContainer);
return OutSharedPtrContainer.Ptr.ToSharedRef();
}
@@ -1,55 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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 "Templates/SharedPointer.h"
class FSGFingerCommandImpl;
class FSGBuzzCommandImpl;
class FSGForceFeedbackCommandImpl;
class FSGTimedBuzzCommandImpl;
class SENSEGLOVECORE_API FSGFingerCommandImplCast
{
public:
static TSharedRef<FSGBuzzCommandImpl> ToBuzzCommandImpl(TSharedRef<FSGFingerCommandImpl> FingerCommandImpl);
static TSharedRef<FSGForceFeedbackCommandImpl> ToForceFeedbackCommandImpl(
TSharedRef<FSGFingerCommandImpl> FingerCommandImpl);
static TSharedRef<FSGTimedBuzzCommandImpl> ToTimedBuzzCommandImpl(
TSharedRef<FSGFingerCommandImpl> FingerCommandImpl);
};
@@ -1,187 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGForceFeedbackCommand.h"
#include "SGFingerCommandImplCast.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_ESGFinger.h"
#include "SGInterop/SGIC_FSGForceFeedbackCommandImpl.h"
#include "SGInterop/SGIC_TArray_int32.h"
#include "SGInterop/SGIC_TSharedPtr_FSGForceFeedbackCommandImpl.h"
USGForceFeedbackCommand* USGForceFeedbackCommand::NewForceFeedbackCommand(UObject* Outer,
const FSGForceFeedbackCommandImpl&
ForceFeedbackCommandImpl)
{
USGForceFeedbackCommand* Instance = NewObject<USGForceFeedbackCommand>(Outer);
Instance->SetFingerCommandImpl(ForceFeedbackCommandImpl);
return Instance;
}
USGForceFeedbackCommand* USGForceFeedbackCommand::NewForceFeedbackCommand(UObject* Outer,
TSharedRef<FSGForceFeedbackCommandImpl>
ForceFeedbackCommandImpl)
{
USGForceFeedbackCommand* Instance = NewObject<USGForceFeedbackCommand>(Outer);
Instance->SetFingerCommandImpl(MoveTemp(ForceFeedbackCommandImpl));
return Instance;
}
USGForceFeedbackCommand* USGForceFeedbackCommand::NewForceFeedbackCommand(UObject* Outer)
{
FSGIC_TSharedPtr_FSGForceFeedbackCommandImpl OutSharedPtrContainer;
SGCoreImpl_FSGForceFeedbackCommandImpl_ctor_MakeShared(&OutSharedPtrContainer);
return NewForceFeedbackCommand(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGForceFeedbackCommand* USGForceFeedbackCommand::NewForceFeedbackCommand(
UObject* Outer, const TArray<int32>& ForceFeedbackLevels)
{
FSGIC_TSharedPtr_FSGForceFeedbackCommandImpl OutSharedPtrContainer;
FSGIC_TArray_int32 ForceFeedbackLevelsContainer{ForceFeedbackLevels};
SGCoreImpl_FSGForceFeedbackCommandImpl_ctor_ForceFeedbackLevels_MakeShared(
&OutSharedPtrContainer, &ForceFeedbackLevelsContainer);
return NewForceFeedbackCommand(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGForceFeedbackCommand* USGForceFeedbackCommand::NewForceFeedbackCommand(
UObject* Outer, const int32 Thumb, const int32 Index, const int32 Middle, const int32 Ring, const int32 Pinky)
{
FSGIC_TSharedPtr_FSGForceFeedbackCommandImpl OutSharedPtrContainer;
SGCoreImpl_FSGForceFeedbackCommandImpl_ctor_Thumb_Index_Middle_Ring_Pinky_MakeShared(
&OutSharedPtrContainer, Thumb, Index, Middle, Ring, Pinky);
return NewForceFeedbackCommand(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGForceFeedbackCommand* USGForceFeedbackCommand::NewForceFeedbackCommand(
UObject* Outer, ESGFinger Finger, const int32 BuzzLevel)
{
FSGIC_TSharedPtr_FSGForceFeedbackCommandImpl OutSharedPtrContainer;
FSGIC_ESGFinger FingerContainer{Finger};
SGCoreImpl_FSGForceFeedbackCommandImpl_ctor_Finger_BuzzLevel_MakeShared(
&OutSharedPtrContainer, &FingerContainer, BuzzLevel);
return NewForceFeedbackCommand(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGForceFeedbackCommand* USGForceFeedbackCommand::Off(UObject* Outer)
{
FSGIC_FSGForceFeedbackCommandImpl OutContainer;
SGCoreImpl_FSGForceFeedbackCommandImpl_Off(&OutContainer);
return NewForceFeedbackCommand(Outer, OutContainer.ForceFeedbackCommandImpl);
}
USGForceFeedbackCommand::USGForceFeedbackCommand()
: USGFingerCommand()
{
FSGIC_TSharedPtr_FSGForceFeedbackCommandImpl OutSharedPtrContainer;
SGCoreImpl_FSGForceFeedbackCommandImpl_ctor_MakeShared(&OutSharedPtrContainer);
SetFingerCommandImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGForceFeedbackCommand::USGForceFeedbackCommand(const TArray<int32>& ForceFeedbackLevels)
: USGFingerCommand(ForceFeedbackLevels)
{
FSGIC_TSharedPtr_FSGForceFeedbackCommandImpl OutSharedPtrContainer;
FSGIC_TArray_int32 ForceFeedbackLevelsContainer{ForceFeedbackLevels};
SGCoreImpl_FSGForceFeedbackCommandImpl_ctor_ForceFeedbackLevels_MakeShared(
&OutSharedPtrContainer, &ForceFeedbackLevelsContainer);
SetFingerCommandImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGForceFeedbackCommand::USGForceFeedbackCommand(
const int32 Thumb, const int32 Index, const int32 Middle, const int32 Ring, const int32 Pinky)
: USGFingerCommand()
{
FSGIC_TSharedPtr_FSGForceFeedbackCommandImpl OutSharedPtrContainer;
SGCoreImpl_FSGForceFeedbackCommandImpl_ctor_Thumb_Index_Middle_Ring_Pinky_MakeShared(
&OutSharedPtrContainer, Thumb, Index, Middle, Ring, Pinky);
SetFingerCommandImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGForceFeedbackCommand::USGForceFeedbackCommand(const ESGFinger Finger, const int32 BuzzLevel)
: USGFingerCommand()
{
FSGIC_TSharedPtr_FSGForceFeedbackCommandImpl OutSharedPtrContainer;
FSGIC_ESGFinger FingerContainer{Finger};
SGCoreImpl_FSGForceFeedbackCommandImpl_ctor_Finger_BuzzLevel_MakeShared(
&OutSharedPtrContainer, &FingerContainer, BuzzLevel);
SetFingerCommandImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGForceFeedbackCommand::USGForceFeedbackCommand(const FSGForceFeedbackCommandImpl& ForceFeedbackCommandImpl)
: USGFingerCommand(ForceFeedbackCommandImpl)
{
}
USGForceFeedbackCommand::USGForceFeedbackCommand(TSharedRef<FSGForceFeedbackCommandImpl> ForceFeedbackCommandImpl)
: USGFingerCommand(MoveTemp(ForceFeedbackCommandImpl))
{
}
USGForceFeedbackCommand::~USGForceFeedbackCommand() = default;
TSharedRef<FSGForceFeedbackCommandImpl> USGForceFeedbackCommand::ToForceFeedbackCommandImpl() const
{
return FSGFingerCommandImplCast::ToForceFeedbackCommandImpl(ToFingerCommandImpl());
}
USGForceFeedbackCommand* USGForceFeedbackCommand::Copy(UObject* Outer) const
{
FSGIC_TSharedPtr_FSGForceFeedbackCommandImpl InstanceContainer{ToForceFeedbackCommandImpl()};
FSGIC_FSGForceFeedbackCommandImpl OutForceFeedbackCommandImplContainer;
SGCoreImpl_FSGForceFeedbackCommandImpl_Copy(&InstanceContainer, &OutForceFeedbackCommandImplContainer);
return NewForceFeedbackCommand(Outer, MoveTemp(OutForceFeedbackCommandImplContainer.ForceFeedbackCommandImpl));
}
USGForceFeedbackCommand* USGForceFeedbackCommand::Merge(UObject* Outer,
const USGForceFeedbackCommand* ForceFeedbackCommand) const
{
FSGIC_TSharedPtr_FSGForceFeedbackCommandImpl InstanceContainer{ToForceFeedbackCommandImpl()};
FSGIC_FSGForceFeedbackCommandImpl ForceFeedbackCommandImplContainer{
ForceFeedbackCommand->ToForceFeedbackCommandImpl().Get()};
FSGIC_FSGForceFeedbackCommandImpl OutForceFeedbackCommandImplContainer;
SGCoreImpl_FSGForceFeedbackCommandImpl_Merge(&InstanceContainer, &OutForceFeedbackCommandImplContainer,
&ForceFeedbackCommandImplContainer);
return NewForceFeedbackCommand(Outer, MoveTemp(OutForceFeedbackCommandImplContainer.ForceFeedbackCommandImpl));
}
@@ -50,6 +50,8 @@
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_FVector.h"
#include "SGInterop/SGIC_TArray_FVector.h"
#include "SGInterop/SGIC_TArray_float.h"
#include "SGInterop/SGIC_TArray_TArray_float.h"
#include "SGInterop/SGIC_TArray_TArray_FSGInterpolationSetImpl.h"
#include "SGInterop/SGIC_TArray_TArray_FVector.h"
#include "SGUtils/SGArrayUtils.h"
@@ -99,155 +101,26 @@ USGHandInterpolator* USGHandInterpolator::NewHandInterpolator(UObject* Outer)
return NewHandInterpolator(Outer, MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl));
}
USGHandInterpolator* USGHandInterpolator::NewHandInterpolator(
UObject* Outer,
const TArray<TArray<USGInterpolationSet*>>& JointInterpolations)
USGHandInterpolator* USGHandInterpolator::NewHandInterpolator(UObject* Outer, const bool bRightHanded)
{
FSGIC_FSGHandInterpolatorImpl OutHandInterpolatorImplContainer;
FSGIC_TArray_TArray_FSGInterpolationSetImpl JointInterpolationsContainer{
FSGArrayUtils::ToImplType<USGInterpolationSet, FSGInterpolationSetImpl,
&USGInterpolationSet::ToInterpolationSetImpl>(JointInterpolations)};
SGCoreImpl_FSGHandInterpolatorImpl_ctor_JointInterpolations(&OutHandInterpolatorImplContainer,
&JointInterpolationsContainer);
SGCoreImpl_FSGHandInterpolatorImpl_ctor_bRightHanded(&OutHandInterpolatorImplContainer,
bRightHanded);
return NewHandInterpolator(Outer, MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl));
}
USGHandInterpolator* USGHandInterpolator::NewHandInterpolator(
UObject* Outer,
const TArray<FSGInterpolationSetArray>& JointInterpolations)
{
FSGIC_FSGHandInterpolatorImpl OutHandInterpolatorImplContainer;
FSGIC_TArray_TArray_FSGInterpolationSetImpl JointInterpolationsContainer{
FSGArrayUtils::ToImplType<
USGInterpolationSet, FSGInterpolationSetImpl,
&USGInterpolationSet::ToInterpolationSetImpl,
FSGInterpolationSetArray, &FSGInterpolationSetArray::InterpolationSetArray>(
JointInterpolations)};
SGCoreImpl_FSGHandInterpolatorImpl_ctor_JointInterpolations(&OutHandInterpolatorImplContainer,
&JointInterpolationsContainer);
return NewHandInterpolator(Outer, MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl));
}
USGHandInterpolator* USGHandInterpolator::NewHandInterpolator(
UObject* Outer,
const TArray<TArray<USGInterpolationSet*>>& JointInterpolations, const FQuat& CmcStartRotation)
{
FSGIC_FSGHandInterpolatorImpl OutHandInterpolatorImplContainer;
FSGIC_TArray_TArray_FSGInterpolationSetImpl JointInterpolationsContainer{
FSGArrayUtils::ToImplType<USGInterpolationSet, FSGInterpolationSetImpl,
&USGInterpolationSet::ToInterpolationSetImpl>(JointInterpolations)};
FSGIC_FQuat CmcStartRotationContainer{CmcStartRotation};
SGCoreImpl_FSGHandInterpolatorImpl_ctor_JointInterpolations_CmcStartRotation(
&OutHandInterpolatorImplContainer, &JointInterpolationsContainer, &CmcStartRotationContainer);
return NewHandInterpolator(Outer, MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl));
}
USGHandInterpolator* USGHandInterpolator::NewHandInterpolator(
UObject* Outer,
const TArray<TArray<USGInterpolationSet*>>& JointInterpolations, const FRotator& CmcStartRotation)
{
FSGIC_FSGHandInterpolatorImpl OutHandInterpolatorImplContainer;
FSGIC_TArray_TArray_FSGInterpolationSetImpl JointInterpolationsContainer{
FSGArrayUtils::ToImplType<USGInterpolationSet, FSGInterpolationSetImpl,
&USGInterpolationSet::ToInterpolationSetImpl>(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<FSGInterpolationSetArray>& JointInterpolations, const FQuat& CmcStartRotation)
{
FSGIC_FSGHandInterpolatorImpl OutHandInterpolatorImplContainer;
FSGIC_TArray_TArray_FSGInterpolationSetImpl JointInterpolationsContainer{
FSGArrayUtils::ToImplType<
USGInterpolationSet, FSGInterpolationSetImpl,
&USGInterpolationSet::ToInterpolationSetImpl,
FSGInterpolationSetArray, &FSGInterpolationSetArray::InterpolationSetArray>(
JointInterpolations)};
FSGIC_FQuat CmcStartRotationContainer{CmcStartRotation};
SGCoreImpl_FSGHandInterpolatorImpl_ctor_JointInterpolations_CmcStartRotation(
&OutHandInterpolatorImplContainer, &JointInterpolationsContainer, &CmcStartRotationContainer);
return NewHandInterpolator(Outer, MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl));
}
USGHandInterpolator* USGHandInterpolator::NewHandInterpolator(
UObject* Outer,
const TArray<FSGInterpolationSetArray>& 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;
SGCoreImpl_FSGHandInterpolatorImpl_Default(&OutHandInterpolatorImplContainer, bRightHanded);
return NewHandInterpolator(Outer, MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl));
}
USGHandInterpolator* USGHandInterpolator::Deserialize(UObject* Outer, const FString& SerializedString)
USGHandInterpolator* USGHandInterpolator::Deserialize(UObject* Outer,
const FString& SerializedString, const bool bRightHanded)
{
FSGIC_FSGHandInterpolatorImpl OutHandInterpolatorImplContainer;
FSGIC_FString SerializedStringContainer{SerializedString};
SGCoreImpl_FSGHandInterpolatorImpl_Deserialize(&OutHandInterpolatorImplContainer, &SerializedStringContainer);
SGCoreImpl_FSGHandInterpolatorImpl_Deserialize(&OutHandInterpolatorImplContainer,
&SerializedStringContainer, bRightHanded);
return NewHandInterpolator(Outer, MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl));
}
TArray<FVector> USGHandInterpolator::InterpolateFingerAngles(const ESGFinger Finger,
const USGHandInterpolator* Interpolator,
const FVector& TotalGloveAngles)
{
FSGIC_TArray_FVector OutAnglesContainer;
FSGIC_ESGFinger FingerContainer{Finger};
FSGIC_FSGHandInterpolatorImpl InterpolatorContainer{Interpolator->ToHandInterpolatorImpl()};
FSGIC_FVector TotalGloveAnglesContainer{TotalGloveAngles};
SGCoreImpl_FSGHandInterpolatorImpl_InterpolateFingerAngles(&OutAnglesContainer, &FingerContainer,
&InterpolatorContainer, &TotalGloveAnglesContainer);
return MoveTemp(OutAnglesContainer.Array);
}
TArray<FVector> USGHandInterpolator::InterpolateThumbAngles(const USGHandInterpolator* Interpolator,
const FVector& TotalGloveAngles)
{
FSGIC_TArray_FVector OutAnglesContainer;
FSGIC_FSGHandInterpolatorImpl InterpolatorContainer{Interpolator->ToHandInterpolatorImpl()};
FSGIC_FVector TotalGloveAnglesContainer{TotalGloveAngles};
SGCoreImpl_FSGHandInterpolatorImpl_InterpolateThumbAngles(&OutAnglesContainer, &InterpolatorContainer,
&TotalGloveAnglesContainer);
return MoveTemp(OutAnglesContainer.Array);
}
TArray<TArray<FVector>> USGHandInterpolator::InterpolateHandAngles(const USGHandInterpolator* Interpolator,
const TArray<FVector>& TotalAngles)
{
FSGIC_TArray_TArray_FVector OutAnglesContainer;
FSGIC_FSGHandInterpolatorImpl InterpolatorContainer{Interpolator->ToHandInterpolatorImpl()};
FSGIC_TArray_FVector TotalAnglesContainer{TotalAngles};
SGCoreImpl_FSGHandInterpolatorImpl_InterpolateHandAngles(&OutAnglesContainer, &InterpolatorContainer,
&TotalAnglesContainer);
return MoveTemp(OutAnglesContainer.Array);
}
USGHandInterpolator::USGHandInterpolator()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
@@ -257,97 +130,12 @@ USGHandInterpolator::USGHandInterpolator()
Pimpl->HandInterpolatorImpl = MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl);
}
USGHandInterpolator::USGHandInterpolator(const TArray<TArray<USGInterpolationSet*>>& JointInterpolations)
USGHandInterpolator::USGHandInterpolator(const bool bRightHanded)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGHandInterpolatorImpl OutHandInterpolatorImplContainer;
FSGIC_TArray_TArray_FSGInterpolationSetImpl JointInterpolationsContainer{
FSGArrayUtils::ToImplType<USGInterpolationSet, FSGInterpolationSetImpl,
&USGInterpolationSet::ToInterpolationSetImpl>(JointInterpolations)};
SGCoreImpl_FSGHandInterpolatorImpl_ctor_JointInterpolations(&OutHandInterpolatorImplContainer,
&JointInterpolationsContainer);
Pimpl->HandInterpolatorImpl = MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl);
}
USGHandInterpolator::USGHandInterpolator(const TArray<FSGInterpolationSetArray>& JointInterpolations)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGHandInterpolatorImpl OutHandInterpolatorImplContainer;
FSGIC_TArray_TArray_FSGInterpolationSetImpl JointInterpolationsContainer{
FSGArrayUtils::ToImplType<
USGInterpolationSet, FSGInterpolationSetImpl,
&USGInterpolationSet::ToInterpolationSetImpl,
FSGInterpolationSetArray, &FSGInterpolationSetArray::InterpolationSetArray>(
JointInterpolations)};
SGCoreImpl_FSGHandInterpolatorImpl_ctor_JointInterpolations(&OutHandInterpolatorImplContainer,
&JointInterpolationsContainer);
Pimpl->HandInterpolatorImpl = MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl);
}
USGHandInterpolator::USGHandInterpolator(const TArray<TArray<USGInterpolationSet*>>& JointInterpolations,
const FQuat& CmcStartRotation)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGHandInterpolatorImpl OutHandInterpolatorImplContainer;
FSGIC_TArray_TArray_FSGInterpolationSetImpl JointInterpolationsContainer{
FSGArrayUtils::ToImplType<USGInterpolationSet, FSGInterpolationSetImpl,
&USGInterpolationSet::ToInterpolationSetImpl>(JointInterpolations)};
FSGIC_FQuat CmcStartRotationContainer{CmcStartRotation};
SGCoreImpl_FSGHandInterpolatorImpl_ctor_JointInterpolations_CmcStartRotation(
&OutHandInterpolatorImplContainer, &JointInterpolationsContainer, &CmcStartRotationContainer);
Pimpl->HandInterpolatorImpl = MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl);
}
USGHandInterpolator::USGHandInterpolator(const TArray<TArray<USGInterpolationSet*>>& JointInterpolations,
const FRotator& CmcStartRotation)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGHandInterpolatorImpl OutHandInterpolatorImplContainer;
FSGIC_TArray_TArray_FSGInterpolationSetImpl JointInterpolationsContainer{
FSGArrayUtils::ToImplType<USGInterpolationSet, FSGInterpolationSetImpl,
&USGInterpolationSet::ToInterpolationSetImpl>(JointInterpolations)};
FSGIC_FQuat CmcStartRotationContainer{CmcStartRotation.Quaternion()};
SGCoreImpl_FSGHandInterpolatorImpl_ctor_JointInterpolations_CmcStartRotation(
&OutHandInterpolatorImplContainer, &JointInterpolationsContainer, &CmcStartRotationContainer);
Pimpl->HandInterpolatorImpl = MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl);
}
USGHandInterpolator::USGHandInterpolator(const TArray<FSGInterpolationSetArray>& JointInterpolations,
const FQuat& CmcStartRotation)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGHandInterpolatorImpl OutHandInterpolatorImplContainer;
FSGIC_TArray_TArray_FSGInterpolationSetImpl JointInterpolationsContainer{
FSGArrayUtils::ToImplType<
USGInterpolationSet, FSGInterpolationSetImpl,
&USGInterpolationSet::ToInterpolationSetImpl,
FSGInterpolationSetArray, &FSGInterpolationSetArray::InterpolationSetArray>(
JointInterpolations)};
FSGIC_FQuat CmcStartRotationContainer{CmcStartRotation};
SGCoreImpl_FSGHandInterpolatorImpl_ctor_JointInterpolations_CmcStartRotation(
&OutHandInterpolatorImplContainer, &JointInterpolationsContainer, &CmcStartRotationContainer);
Pimpl->HandInterpolatorImpl = MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl);
}
USGHandInterpolator::USGHandInterpolator(const TArray<FSGInterpolationSetArray>& JointInterpolations,
const FRotator& CmcStartRotation)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
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);
SGCoreImpl_FSGHandInterpolatorImpl_ctor_bRightHanded(&OutHandInterpolatorImplContainer,
bRightHanded);
Pimpl->HandInterpolatorImpl = MoveTemp(OutHandInterpolatorImplContainer.HandInterpolatorImpl);
}
@@ -373,104 +161,36 @@ const FSGHandInterpolatorImpl& USGHandInterpolator::ToHandInterpolatorImpl() con
return Pimpl->HandInterpolatorImpl;
}
TArray<TArray<USGInterpolationSet*>> USGHandInterpolator::GetJointInterpolations(UObject* Outer) const
float USGHandInterpolator::CalculateAngle(
const ESGFingerMovement Movement, const float Value, const bool bApplyLimits) const
{
FSGIC_FSGHandInterpolatorImpl InstanceContainer{ToHandInterpolatorImpl()};
FSGIC_TArray_TArray_FSGInterpolationSetImpl OutInterpolationsContainer;
SGCoreImpl_FSGHandInterpolatorImpl_GetJointInterpolations(&InstanceContainer, &OutInterpolationsContainer);
TArray<TArray<USGInterpolationSet*>> JointInterpolations{
FSGArrayUtils::FromImplType<FSGInterpolationSetImpl, USGInterpolationSet,
&USGInterpolationSet::NewInterpolationSet>(
Outer, MoveTemp(OutInterpolationsContainer.Array))
};
return JointInterpolations;
}
FQuat USGHandInterpolator::GetCmcStartRotationQ() const
{
FSGIC_FSGHandInterpolatorImpl InstanceContainer{ToHandInterpolatorImpl()};
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGHandInterpolatorImpl_GetCmcStartRotation(&InstanceContainer, &OutRotationContainer);
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
{
FSGIC_FSGHandInterpolatorImpl InstanceContainer{ToHandInterpolatorImpl()};
FSGIC_ESGFinger FingerContainer{Finger};
const float Angle = SGCoreImpl_FSGHandInterpolatorImpl_CalculateAngle_Finger_int32Movement_Value(
&InstanceContainer, &FingerContainer, Movement, Value);
return Angle;
}
float USGHandInterpolator::CalculateAngle(const ESGFinger Finger, const ESGFingerMovement Movement,
const float Value) const
{
FSGIC_FSGHandInterpolatorImpl InstanceContainer{ToHandInterpolatorImpl()};
FSGIC_ESGFinger FingerContainer{Finger};
FSGIC_ESGFingerMovement MovementContainer{Movement};
const float Angle = SGCoreImpl_FSGHandInterpolatorImpl_CalculateAngle_Finger_ESGFingerMovement_Value(
&InstanceContainer, &FingerContainer, &MovementContainer, Value);
const float Angle = SGCoreImpl_FSGHandInterpolatorImpl_CalculateAngle_ESGFingerMovement_Value_bApplyLimits(
&InstanceContainer, &MovementContainer, Value, bApplyLimits);
return Angle;
}
float USGHandInterpolator::CalculateAngle(const ESGFinger Finger, const ESGThumbMovement Movement,
const float Value) const
{
FSGIC_FSGHandInterpolatorImpl InstanceContainer{ToHandInterpolatorImpl()};
FSGIC_ESGFinger FingerContainer{Finger};
FSGIC_ESGThumbMovement MovementContainer{Movement};
const float Angle = SGCoreImpl_FSGHandInterpolatorImpl_CalculateAngle_Finger_ESGThumbMovement_Value(
&InstanceContainer, &FingerContainer, &MovementContainer, Value);
return Angle;
}
void USGHandInterpolator::SetInterpolation(const int32 Finger, const int32 Movement, const float InputAt0,
const float InputAt1, const float AngleAt0, const float AngleAt1)
{
FSGIC_FSGHandInterpolatorImpl InstanceContainer{ToHandInterpolatorImpl()};
SGCoreImpl_FSGHandInterpolatorImpl_SetInterpolation_int32Finger_int32Movement_InputAt0_InputAt1_AngleAt0_AngleAt1(
&InstanceContainer, Finger, Movement, InputAt0, InputAt1, AngleAt0, AngleAt1);
}
void USGHandInterpolator::SetInterpolation(const ESGFinger Finger, const ESGFingerMovement Movement,
const float InputAt0, const float InputAt1, const float AngleAt0,
const float AngleAt1)
{
FSGIC_FSGHandInterpolatorImpl InstanceContainer{ToHandInterpolatorImpl()};
FSGIC_ESGFinger FingerContainer{Finger};
FSGIC_ESGFingerMovement MovementContainer{Movement};
SGCoreImpl_FSGHandInterpolatorImpl_SetInterpolation_ESGFinger_ESGFingerMovement_InputAt0_InputAt1_AngleAt0_AngleAt1(
&InstanceContainer, &FingerContainer, &MovementContainer, InputAt0, InputAt1, AngleAt0, AngleAt1);
}
void USGHandInterpolator::SetInterpolation(const ESGThumbMovement Movement, const float InputAt0, const float InputAt1,
const float AngleAt0, const float AngleAt1)
float USGHandInterpolator::CalculateAngle(
const ESGThumbMovement Movement, const float Value, const bool bApplyLimits) const
{
FSGIC_FSGHandInterpolatorImpl InstanceContainer{ToHandInterpolatorImpl()};
FSGIC_ESGThumbMovement MovementContainer{Movement};
SGCoreImpl_FSGHandInterpolatorImpl_SetInterpolation_Movement_InputAt0_InputAt1_AngleAt0_AngleAt1(
&InstanceContainer, &MovementContainer, InputAt0, InputAt1, AngleAt0, AngleAt1);
const float Angle = SGCoreImpl_FSGHandInterpolatorImpl_CalculateAngle_ESGThumbMovement_Value_bApplyLimits(
&InstanceContainer, &MovementContainer, Value, bApplyLimits);
return Angle;
}
USGInterpolationSet* USGHandInterpolator::GetInterpolation(UObject* Outer,
const int32 Finger, const int32 Movement) const
TArray<TArray<FVector>> USGHandInterpolator::InterpolateHandAngles(
const TArray<TArray<float>>& Flexions, const TArray<float>& Abductions, const float CmcTwist) const
{
FSGIC_FSGHandInterpolatorImpl InstanceContainer{ToHandInterpolatorImpl()};
FSGIC_FSGInterpolationSetImpl OutInterpolationContainer;
SGCoreImpl_FSGHandInterpolatorImpl_GetInterpolation(&InstanceContainer, &OutInterpolationContainer, Finger,
Movement);
return USGInterpolationSet::NewInterpolationSet(Outer, MoveTemp(OutInterpolationContainer.InterpolationSetImpl));
FSGIC_TArray_TArray_FVector OutAnglesContainer;
FSGIC_TArray_TArray_float FlexionsContainer{Flexions};
FSGIC_TArray_float AbductionsContainer{Abductions};
SGCoreImpl_FSGHandInterpolatorImpl_InterpolateHandAngles(
&InstanceContainer, &OutAnglesContainer, &FlexionsContainer, &AbductionsContainer, CmcTwist);
return MoveTemp(OutAnglesContainer.Array);
}
bool USGHandInterpolator::Equals(const USGHandInterpolator* HandInterpolator) const
@@ -0,0 +1,213 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGHandLayer.h"
#include "SGCore/SGCustomWaveform.h"
#include "SGCore/SGHandPose.h"
#include "SGCore/SGHapticGlove.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_ESGDeviceType.h"
#include "SGInterop/SGIC_ESGHapticGloveCalibrationState.h"
#include "SGInterop/SGIC_ESGHapticLocation.h"
#include "SGInterop/SGIC_ESGPositionalTrackingHardware.h"
#include "SGInterop/SGIC_FQuat.h"
#include "SGInterop/SGIC_FSGCustomWaveformImpl.h"
#include "SGInterop/SGIC_FSGHandPoseImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_FVector.h"
#include "SGInterop/SGIC_TArray_float.h"
#include "SGInterop/SGIC_TSharedPtr_FSGHapticGloveImpl.h"
bool FSGHandLayer::DeviceConnected(const bool bRightHanded)
{
return SGCoreImpl_FSGHandLayerImpl_DeviceConnected(bRightHanded);
}
ESGDeviceType FSGHandLayer::GetDeviceType(const bool bRightHanded)
{
FSGIC_ESGDeviceType DeviceTypeContainer;
SGCoreImpl_FSGHandLayerImpl_GetDeviceType(&DeviceTypeContainer, bRightHanded);
return DeviceTypeContainer.Type;
}
bool FSGHandLayer::GetFirstGloveHandedness()
{
return SGCoreImpl_FSGHandLayerImpl_GetFirstGloveHandedness();
}
int32 FSGHandLayer::GlovesConnected()
{
return SGCoreImpl_FSGHandLayerImpl_GlovesConnected();
}
bool FSGHandLayer::GetGloveInstance(UObject* Outer, const bool bRightHanded, USGHapticGlove*& OutGlove)
{
FSGIC_TSharedPtr_FSGHapticGloveImpl OutGloveContainer;
const bool bResult = SGCoreImpl_FSGHandLayerImpl_GetGloveInstance(bRightHanded, &OutGloveContainer);
OutGlove = USGHapticGlove::NewHapticGlove(Outer, OutGloveContainer.Ptr.ToSharedRef());
return bResult;
}
ESGHapticGloveCalibrationState FSGHandLayer::GetCalibrationState(const bool bRightHanded)
{
FSGIC_ESGHapticGloveCalibrationState HapticGloveCalibrationStateContainer;
SGCoreImpl_FSGHandLayerImpl_GetDeviceType(&HapticGloveCalibrationStateContainer, bRightHanded);
return HapticGloveCalibrationStateContainer.State;
}
FString FSGHandLayer::GetCalibrationInstructions(const bool bRightHanded)
{
FSGIC_FString CalibrationInstructionsContainer;
SGCoreImpl_FSGHandLayerImpl_GetCalibrationInstructions(&CalibrationInstructionsContainer, bRightHanded);
return MoveTemp(CalibrationInstructionsContainer.String);
}
void FSGHandLayer::ResetCalibration(const bool bRightHanded)
{
SGCoreImpl_FSGHandLayerImpl_ResetCalibration(bRightHanded);
}
void FSGHandLayer::EndCalibration(const bool bRightHanded)
{
SGCoreImpl_FSGHandLayerImpl_EndCalibration(bRightHanded);
}
bool FSGHandLayer::GetHandPose(UObject* Outer, const bool bRightHanded, USGHandPose*& OutHandPose)
{
FSGIC_FSGHandPoseImpl OutHandPoseContainer;
const bool bResult = SGCoreImpl_FSGHandLayerImpl_GetHandPose(bRightHanded, &OutHandPoseContainer);
OutHandPose = USGHandPose::NewHandPose(Outer, OutHandPose->ToHandPoseImpl());
return bResult;
}
void FSGHandLayer::GetWristLocation(
const bool bRightHanded, const FVector& ReferencePosition, const FQuat& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware, FVector& OutWristPosition, FQuat& OutWristRotation)
{
FSGIC_FVector ReferencePositionContainer{ReferencePosition};
FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation};
FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware};
FSGIC_FVector OutWristPositionContainer;
FSGIC_FQuat OutWristRotationContainer;
SGCoreImpl_FSGHandLayerImpl_GetWristLocation(
bRightHanded, &ReferencePositionContainer, &ReferenceRotationContainer,
&TrackingHardwareContainer,
&OutWristPositionContainer, &OutWristRotationContainer);
OutWristPosition = MoveTemp(OutWristPositionContainer.Vector);
OutWristRotation = MoveTemp(OutWristRotationContainer.Quat);
}
bool FSGHandLayer::SendHaptics(const bool bRightHanded)
{
return SGCoreImpl_FSGHandLayerImpl_SendHaptics(bRightHanded);
}
void FSGHandLayer::StopAllHaptics(const bool bRightHanded)
{
SGCoreImpl_FSGHandLayerImpl_StopAllHaptics(bRightHanded);
}
bool FSGHandLayer::QueueCommand_ForceFeedbackLevel(
const bool bRightHanded, const int32 Finger, const float Level01, const bool bSendImmediate)
{
return SGCoreImpl_FSGHandLayerImpl_QueueCommand_ForceFeedbackLevel(bRightHanded, Finger, Level01, bSendImmediate);
}
bool FSGHandLayer::QueueCommand_ForceFeedbackLevels(
const bool bRightHanded, const TArray<float>& Levels01, const bool bSendImmediate)
{
FSGIC_TArray_float Levels01Container{Levels01};
return SGCoreImpl_FSGHandLayerImpl_QueueCommand_ForceFeedbackLevels(
bRightHanded, &Levels01Container, bSendImmediate);
}
bool FSGHandLayer::QueueCommand_SetVibroLevel(
const bool bRightHanded, const int32 Finger, const float Level01, const bool bSendImmediate)
{
return SGCoreImpl_FSGHandLayerImpl_QueueCommand_SetVibroLevel(bRightHanded, Finger, Level01, bSendImmediate);
}
bool FSGHandLayer::QueueCommand_SetVibroLevels(
const bool bRightHanded, const TArray<float>& Levels01, const bool bSendImmediate)
{
FSGIC_TArray_float Levels01Container{Levels01};
return SGCoreImpl_FSGHandLayerImpl_QueueCommand_SetVibroLevels(bRightHanded, &Levels01Container, bSendImmediate);
}
bool FSGHandLayer::SupportsCustomWaveform(
const bool bRightHanded, const ESGHapticLocation AtLocation)
{
FSGIC_ESGHapticLocation AtLocationContainer{AtLocation};
return SGCoreImpl_FSGHandLayerImpl_SupportsCustomWaveform(bRightHanded, &AtLocationContainer);
}
bool FSGHandLayer::SendCustomWaveform(
const bool bRightHanded, USGCustomWaveform*& OutWaveform, const ESGHapticLocation Location)
{
FSGIC_FSGCustomWaveformImpl OutWaveformContainer{OutWaveform->ToCustomWaveformImpl()};
FSGIC_ESGHapticLocation LocationContainer{Location};
return SGCoreImpl_FSGHandLayerImpl_SendCustomWaveform(bRightHanded, &OutWaveformContainer, &LocationContainer);
}
bool FSGHandLayer::SupportsWristSqueeze(const bool bRightHanded)
{
return SGCoreImpl_FSGHandLayerImpl_SupportsWristSqueeze(bRightHanded);
}
bool FSGHandLayer::QueueCommand_WristSqueeze(
const bool bRightHanded, const float SqueezeLevel01, const bool bSendImmediate)
{
return SGCoreImpl_FSGHandLayerImpl_QueueCommand_WristSqueeze(bRightHanded, SqueezeLevel01, bSendImmediate);
}
bool FSGHandLayer::SupportsFlexionLocks(const bool bRightHanded)
{
return SGCoreImpl_FSGHandLayerImpl_SupportsFlexionLocks(bRightHanded);
}
bool FSGHandLayer::QueueCommand_FlexionLock(
const bool bRightHanded, const int32 Finger, const float Flexion01, const bool bSendImmediate)
{
return SGCoreImpl_FSGHandLayerImpl_QueueCommand_FlexionLock(bRightHanded, Finger, Flexion01, bSendImmediate);
}
bool FSGHandLayer::QueueCommand_ClearFlexionLock(
const bool bRightHanded, const int32 Finger, const bool bSendImmediate)
{
return SGCoreImpl_FSGHandLayerImpl_QueueCommand_ClearFlexionLock(bRightHanded, Finger, bSendImmediate);
}
@@ -35,8 +35,6 @@
#include "SGCore/SGHandPose.h"
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGBasicHandModel.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGCoreImpl/SGHandPoseImpl.h"
@@ -423,7 +421,6 @@ TArray<TArray<FVector>> USGHandPose::GetHandAngles() const
bool USGHandPose::Equals(const USGHandPose* HandPose) const
{
FSGIC_FSGHandPoseImpl InstanceContainer{ToHandPoseImpl()};
FSGIC_FSGHandPoseImpl HandPoseContainer{HandPose->ToHandPoseImpl()};
return SGCoreImpl_FSGHandPoseImpl_Equals(&InstanceContainer, &HandPoseContainer);
@@ -1,284 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGHandProfile.h"
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGNovaGloveHandProfile.h"
#include "SGCore/SGSenseGloveHandProfile.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGCoreImpl/SGHandProfileImpl.h"
#include "SGInterop/SGIC_FSGHandProfileImpl.h"
#include "SGInterop/SGIC_FSGNovaGloveHandProfileImpl.h"
#include "SGInterop/SGIC_FSGSenseGloveHandProfileImpl.h"
#include "SGInterop/SGIC_FString.h"
struct USGHandProfile::FImpl
{
/************************
* Member variables
************************/
FSGHandProfileImpl HandProfileImpl;
/************************
* Owner object
************************/
USGHandProfile* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGHandProfile* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGHandProfile* USGHandProfile::NewHandProfile(UObject* Outer, const FSGHandProfileImpl& HandProfileImpl)
{
USGHandProfile* Instance = NewObject<USGHandProfile>(Outer);
Instance->SetHandProfileImpl(HandProfileImpl);
return Instance;
}
USGHandProfile* USGHandProfile::NewHandProfile(UObject* Outer)
{
FSGIC_FSGHandProfileImpl OutHandProfileImplContainer;
SGCoreImpl_FSGHandProfileImpl_ctor(&OutHandProfileImplContainer);
return NewHandProfile(Outer, MoveTemp(OutHandProfileImplContainer.HandProfileImpl));
}
USGHandProfile* USGHandProfile::NewHandProfile(UObject* Outer, const bool bRightHanded,
const USGSenseGloveHandProfile* SenseGloveHandProfile,
const USGNovaGloveHandProfile* NovaGloveHandProfile)
{
FSGIC_FSGHandProfileImpl OutHandProfileImplContainer;
FSGIC_FSGSenseGloveHandProfileImpl SenseGloveHandProfileContainer
{SenseGloveHandProfile->ToSenseGloveHandProfileImpl()};
FSGIC_FSGNovaGloveHandProfileImpl NovaGloveHandProfileContainer
{NovaGloveHandProfile->ToNovaGloveHandProfileImpl()};
SGCoreImpl_FSGHandProfileImpl_ctor_bRightHanded_SenseGloveHandProfile_NovaGloveHandProfile(
&OutHandProfileImplContainer, bRightHanded, &SenseGloveHandProfileContainer, &NovaGloveHandProfileContainer);
return NewHandProfile(Outer, MoveTemp(OutHandProfileImplContainer.HandProfileImpl));
}
USGHandProfile* USGHandProfile::Default(UObject* Outer, const bool bRightHanded)
{
FSGIC_FSGHandProfileImpl OutHandProfileImplContainer;
SGCoreImpl_FSGHandProfileImpl_Default(&OutHandProfileImplContainer, bRightHanded);
return NewHandProfile(Outer, MoveTemp(OutHandProfileImplContainer.HandProfileImpl));
}
USGHandProfile* USGHandProfile::Deserialize(UObject* Outer, const FString& SerializedString)
{
FSGIC_FSGHandProfileImpl OutHandProfileImplContainer;
FSGIC_FString SerializedStringContainer{SerializedString};
SGCoreImpl_FSGHandProfileImpl_Deserialize(&OutHandProfileImplContainer,
&SerializedStringContainer);
return NewHandProfile(Outer, MoveTemp(OutHandProfileImplContainer.HandProfileImpl));
}
FString USGHandProfile::GetProfileDirectory()
{
FSGIC_FString OutDirectoryContainer;
SGCoreImpl_FSGHandProfileImpl_GetProfileDirectory(&OutDirectoryContainer);
return MoveTemp(OutDirectoryContainer.String);
}
FString USGHandProfile::GetLeftHandFileName()
{
FSGIC_FString OutFileName;
SGCoreImpl_FSGHandProfileImpl_GetLeftHandFileName(&OutFileName);
return MoveTemp(OutFileName.String);
}
FString USGHandProfile::GetRightHandFileName()
{
FSGIC_FString OutFileName;
SGCoreImpl_FSGHandProfileImpl_GetRightHandFileName(&OutFileName);
return MoveTemp(OutFileName.String);
}
FString USGHandProfile::GetProfileFileName(const bool bRightHanded)
{
FSGIC_FString OutFileName;
SGCoreImpl_FSGHandProfileImpl_GetProfileFileName(&OutFileName, bRightHanded);
return MoveTemp(OutFileName.String);
}
bool USGHandProfile::GetLatestProfile(UObject* Outer, const bool bRightHanded, USGHandProfile*& OutLatestProfile)
{
FSGIC_FSGHandProfileImpl OutLatestProfileContainer;
const bool bResult = SGCoreImpl_FSGHandProfileImpl_GetLatestProfile(bRightHanded, &OutLatestProfileContainer);
if (bResult)
{
OutLatestProfile = NewHandProfile(Outer, MoveTemp(OutLatestProfileContainer.HandProfileImpl));
}
return bResult;
}
bool USGHandProfile::StoreProfile(const USGHandProfile* ProfileToStore)
{
FSGIC_FSGHandProfileImpl ProfileToStoreContainer{ProfileToStore->ToHandProfileImpl()};
return SGCoreImpl_FSGHandProfileImpl_StoreProfile(&ProfileToStoreContainer);
}
bool USGHandProfile::ResetCalibration(const bool bRightHanded, const bool bOnDisk)
{
return SGCoreImpl_FSGHandProfileImpl_ResetCalibration_bRightHanded_bOnDisk(bRightHanded, bOnDisk);
}
void USGHandProfile::ResetCalibration(const bool bOnDisk)
{
return SGCoreImpl_FSGHandProfileImpl_ResetCalibration_bOnDisk(bOnDisk);
}
USGHandProfile::USGHandProfile()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGHandProfileImpl OutHandProfileImplContainer;
SGCoreImpl_FSGHandProfileImpl_ctor(&OutHandProfileImplContainer);
Pimpl->HandProfileImpl = MoveTemp(OutHandProfileImplContainer.HandProfileImpl);
}
USGHandProfile::USGHandProfile(const bool bRightHanded,
const USGSenseGloveHandProfile* SenseGloveHandProfile,
const USGNovaGloveHandProfile* NovaGloveHandProfile)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGHandProfileImpl OutHandProfileImplContainer;
FSGIC_FSGSenseGloveHandProfileImpl SenseGloveHandProfileContainer
{SenseGloveHandProfile->ToSenseGloveHandProfileImpl()};
FSGIC_FSGNovaGloveHandProfileImpl NovaGloveHandProfileContainer
{NovaGloveHandProfile->ToNovaGloveHandProfileImpl()};
SGCoreImpl_FSGHandProfileImpl_ctor_bRightHanded_SenseGloveHandProfile_NovaGloveHandProfile(
&OutHandProfileImplContainer, bRightHanded, &SenseGloveHandProfileContainer, &NovaGloveHandProfileContainer);
Pimpl->HandProfileImpl = MoveTemp(OutHandProfileImplContainer.HandProfileImpl);
}
USGHandProfile::USGHandProfile(const FSGHandProfileImpl& HandProfileImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
SetHandProfileImpl(HandProfileImpl);
}
USGHandProfile::~USGHandProfile() = default;
void USGHandProfile::SetHandProfileImpl(const FSGHandProfileImpl& HandProfileImpl)
{
FSGIC_FSGHandProfileImpl OutHandProfileContainer;
FSGIC_FSGHandProfileImpl RhsContainer{HandProfileImpl};
SGCoreImpl_FSGHandProfileImpl_ctor_copy(&OutHandProfileContainer, &RhsContainer);
Pimpl->HandProfileImpl = MoveTemp(OutHandProfileContainer.HandProfileImpl);
}
const FSGHandProfileImpl& USGHandProfile::ToHandProfileImpl() const
{
return Pimpl->HandProfileImpl;
}
bool USGHandProfile::IsRight() const
{
FSGIC_FSGHandProfileImpl InstanceContainer{ToHandProfileImpl()};
return SGCoreImpl_FSGHandProfileImpl_IsRight(&InstanceContainer);
}
USGSenseGloveHandProfile* USGHandProfile::GetSenseGloveHandProfile(UObject* Outer) const
{
FSGIC_FSGHandProfileImpl InstanceContainer{ToHandProfileImpl()};
FSGIC_FSGSenseGloveHandProfileImpl OutProfileContainer;
SGCoreImpl_FSGHandProfileImpl_GetSenseGloveHandProfile(&InstanceContainer, &OutProfileContainer);
return USGSenseGloveHandProfile::NewSenseGloveHandProfile(
Outer, MoveTemp(OutProfileContainer.SenseGloveHandProfileImpl));
}
USGNovaGloveHandProfile* USGHandProfile::GetNovaGloveHandProfile(UObject* Outer) const
{
FSGIC_FSGHandProfileImpl InstanceContainer{ToHandProfileImpl()};
FSGIC_FSGNovaGloveHandProfileImpl OutProfileContainer;
SGCoreImpl_FSGHandProfileImpl_GetNovaGloveHandProfile(&InstanceContainer, &OutProfileContainer);
return USGNovaGloveHandProfile::NewNovaGloveHandProfile(
Outer, MoveTemp(OutProfileContainer.NovaGloveHandProfileImpl));
}
bool USGHandProfile::Equals(const USGHandProfile* HandProfile) const
{
FSGIC_FSGHandProfileImpl InstanceContainer{ToHandProfileImpl()};
FSGIC_FSGHandProfileImpl HandProfileContainer{HandProfile->ToHandProfileImpl()};
return SGCoreImpl_FSGHandProfileImpl_Equals(&InstanceContainer, &HandProfileContainer);
}
void USGHandProfile::Reset()
{
FSGIC_FSGHandProfileImpl InstanceContainer{ToHandProfileImpl()};
SGCoreImpl_FSGHandProfileImpl_Reset(&InstanceContainer);
}
FString USGHandProfile::SGSerialize() const
{
FSGIC_FSGHandProfileImpl InstanceContainer{ToHandProfileImpl()};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGHandProfileImpl_Serialize(&InstanceContainer, &OutStringContainer);
return MoveTemp(OutStringContainer.String);
}
USGHandProfile::FImpl::FImpl(USGHandProfile* InOwner)
: Owner(InOwner)
{
}
USGHandProfile::FImpl::~FImpl() = default;
void USGHandProfile::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -0,0 +1,236 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGHapticChannelInfo.h"
#include "SGCoreImpl/SGHapticChannelInfoImpl.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_ESGHapticChannelType.h"
#include "SGInterop/SGIC_ESGWaveformType.h"
#include "SGInterop/SGIC_FSGHapticChannelInfoImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_TArray_FString.h"
#include "SGInterop/SGIC_TArray_int32.h"
struct USGHapticChannelInfo::FImpl
{
/************************
* Member variables
************************/
FSGHapticChannelInfoImpl HapticChannelInfoImpl;
/************************
* Owner object
************************/
USGHapticChannelInfo* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGHapticChannelInfo* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGHapticChannelInfo* USGHapticChannelInfo::NewHapticChannelInfo(UObject* Outer,
const FSGHapticChannelInfoImpl& HapticChannelInfoImpl)
{
USGHapticChannelInfo* Instance = NewObject<USGHapticChannelInfo>(Outer);
Instance->SetHapticChannelInfoImpl(HapticChannelInfoImpl);
return Instance;
}
USGHapticChannelInfo* USGHapticChannelInfo::NewHapticChannelInfo(UObject* Outer)
{
FSGIC_FSGHapticChannelInfoImpl OutHapticChannelInfoImplContainer;
SGCoreImpl_FSGHapticChannelInfoImpl_ctor(&OutHapticChannelInfoImplContainer);
return NewHapticChannelInfo(Outer, MoveTemp(OutHapticChannelInfoImplContainer.HapticChannelInfoImpl));
}
USGHapticChannelInfo* USGHapticChannelInfo::NewHapticChannelInfo(
UObject* Outer,
const TArray<int32>& StreamIndex, const TArray<int32>& FireAndForgetIndex)
{
FSGIC_FSGHapticChannelInfoImpl OutHapticChannelInfoImplContainer;
FSGIC_TArray_int32 StreamIndexContainer{StreamIndex};
FSGIC_TArray_int32 FireAndForgetContainer{FireAndForgetIndex};
SGCoreImpl_FSGHapticChannelInfoImpl_ctor_StreamIndex_FireAndForgetIndex(
&OutHapticChannelInfoImplContainer, &StreamIndexContainer, &FireAndForgetContainer);
return NewHapticChannelInfo(Outer, MoveTemp(OutHapticChannelInfoImplContainer.HapticChannelInfoImpl));
}
FString USGHapticChannelInfo::GenerateAddress(const int32 DeviceIndex, const int32 ChannelIndex)
{
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGHapticChannelInfoImpl_GenerateAddress(&OutStringContainer, DeviceIndex, ChannelIndex);
return MoveTemp(OutStringContainer.String);
}
USGHapticChannelInfo* USGHapticChannelInfo::Parse(UObject* Outer, const FString& IpcString)
{
FSGIC_FSGHapticChannelInfoImpl OutHapticChannelInfoImplContainer;
FSGIC_FString IpcStringContainer{IpcString};
SGCoreImpl_FSGHapticChannelInfoImpl_Parse(&OutHapticChannelInfoImplContainer, &IpcStringContainer);
return NewHapticChannelInfo(Outer, MoveTemp(OutHapticChannelInfoImplContainer.HapticChannelInfoImpl));
}
int32 USGHapticChannelInfo::GetStreamingType()
{
return SGCoreImpl_FSGHapticChannelInfoImpl_GetStreamingType();
}
int32 USGHapticChannelInfo::GetFireAndForgetType()
{
return SGCoreImpl_FSGHapticChannelInfoImpl_GetFireAndForgetType();
}
USGHapticChannelInfo::USGHapticChannelInfo()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGHapticChannelInfoImpl OutHapticChannelInfoImplContainer;
SGCoreImpl_FSGHapticChannelInfoImpl_ctor(&OutHapticChannelInfoImplContainer);
Pimpl->HapticChannelInfoImpl = MoveTemp(OutHapticChannelInfoImplContainer.HapticChannelInfoImpl);
}
USGHapticChannelInfo::USGHapticChannelInfo(const TArray<int32>& StreamIndex, const TArray<int32>& FireAndForgetIndex)
{
FSGIC_FSGHapticChannelInfoImpl OutHapticChannelInfoImplContainer;
FSGIC_TArray_int32 StreamIndexContainer{StreamIndex};
FSGIC_TArray_int32 FireAndForgetContainer{FireAndForgetIndex};
SGCoreImpl_FSGHapticChannelInfoImpl_ctor_StreamIndex_FireAndForgetIndex(
&OutHapticChannelInfoImplContainer, &StreamIndexContainer, &FireAndForgetContainer);
Pimpl->HapticChannelInfoImpl = MoveTemp(OutHapticChannelInfoImplContainer.HapticChannelInfoImpl);
}
USGHapticChannelInfo::USGHapticChannelInfo(const FSGHapticChannelInfoImpl& HapticChannelInfoImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
SetHapticChannelInfoImpl(HapticChannelInfoImpl);
}
USGHapticChannelInfo::~USGHapticChannelInfo() = default;
void USGHapticChannelInfo::SetHapticChannelInfoImpl(const FSGHapticChannelInfoImpl& HapticChannelInfoImpl)
{
FSGIC_FSGHapticChannelInfoImpl OutHapticChannelInfoContainer;
FSGIC_FSGHapticChannelInfoImpl RhsContainer{HapticChannelInfoImpl};
SGCoreImpl_FSGHapticChannelInfoImpl_ctor_copy(&OutHapticChannelInfoContainer, &RhsContainer);
Pimpl->HapticChannelInfoImpl = MoveTemp(OutHapticChannelInfoContainer.HapticChannelInfoImpl);
}
const FSGHapticChannelInfoImpl& USGHapticChannelInfo::ToHapticChannelInfoImpl() const
{
return Pimpl->HapticChannelInfoImpl;
}
int32 USGHapticChannelInfo::GetStreamChannelCount() const
{
FSGIC_FSGHapticChannelInfoImpl InstanceContainer{ToHapticChannelInfoImpl()};
return SGCoreImpl_FSGHapticChannelInfoImpl_GetStreamChannelCount(&InstanceContainer);
}
int32 USGHapticChannelInfo::GetFireAndForgetChannelCount() const
{
FSGIC_FSGHapticChannelInfoImpl InstanceContainer{ToHapticChannelInfoImpl()};
return SGCoreImpl_FSGHapticChannelInfoImpl_GetFireAndForgetChannelCount(&InstanceContainer);
}
int32 USGHapticChannelInfo::GetTotalChannelCount() const
{
FSGIC_FSGHapticChannelInfoImpl InstanceContainer{ToHapticChannelInfoImpl()};
return SGCoreImpl_FSGHapticChannelInfoImpl_GetTotalChannelCount(&InstanceContainer);
}
FString USGHapticChannelInfo::GetAddress_Unguarded(const ESGHapticChannelType Type, const int32 TypeIndex) const
{
FSGIC_FSGHapticChannelInfoImpl InstanceContainer{ToHapticChannelInfoImpl()};
FSGIC_FString OutStringContainer;
FSGIC_ESGHapticChannelType TypeContainer{Type};
SGCoreImpl_FSGHapticChannelInfoImpl_GetAddress_Unguarded(
&InstanceContainer, &OutStringContainer, &TypeContainer, TypeIndex);
return MoveTemp(OutStringContainer.String);
}
void USGHapticChannelInfo::GetIpcParams_Unguarded(
const ESGHapticChannelType Type, const int32 TypeIndex, int32& OutIndex, FString& OutAddressString) const
{
FSGIC_FSGHapticChannelInfoImpl InstanceContainer{ToHapticChannelInfoImpl()};
FSGIC_ESGHapticChannelType TypeContainer{Type};
FSGIC_FString OutAddressStringContainer;
SGCoreImpl_FSGHapticChannelInfoImpl_GetIpcParams_Unguarded(
&InstanceContainer, &TypeContainer, TypeIndex, &OutIndex, &OutAddressString);
OutAddressString = MoveTemp(OutAddressStringContainer.String);
}
void USGHapticChannelInfo::RegenerateAddresses(const int32 ForDeviceIndex)
{
FSGIC_FSGHapticChannelInfoImpl InstanceContainer{ToHapticChannelInfoImpl()};
SGCoreImpl_FSGHapticChannelInfoImpl_RegenerateAddresses(&InstanceContainer, ForDeviceIndex);
}
TArray<FString> USGHapticChannelInfo::GetAllAddresses() const
{
FSGIC_FSGHapticChannelInfoImpl InstanceContainer{ToHapticChannelInfoImpl()};
FSGIC_TArray_FString* OutArrayContainer;
SGCoreImpl_FSGHapticChannelInfoImpl_GetAllAddresses(&InstanceContainer, &OutArrayContainer);
return MoveTemp(OutArrayContainer->Array);
}
USGHapticChannelInfo::FImpl::FImpl(USGHapticChannelInfo* InOwner)
: Owner(InOwner)
{
}
USGHapticChannelInfo::FImpl::~FImpl() = default;
void USGHapticChannelInfo::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -35,27 +35,28 @@
#include "SGCore/SGHapticGlove.h"
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGBuzzCommand.h"
#include "SGCore/SGForceFeedbackCommand.h"
#include "SGCore/SGBasicHandModel.h"
#include "SGCore/SGCustomWaveform.h"
#include "SGCore/SGDeviceImplCast.h"
#include "SGCoreImpl/SGBasicHandModelImpl.h"
#include "SGCoreImpl/SGCustomWaveformImpl.h"
#include "SGCoreImpl/SGDeviceImpl.h"
#include "SGCoreImpl/SGHapticGloveImpl.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_ESGDeviceType.h"
#include "SGInterop/SGIC_ESGHapticGloveCalibrationState.h"
#include "SGInterop/SGIC_ESGHapticLocation.h"
#include "SGInterop/SGIC_ESGPositionalTrackingHardware.h"
#include "SGInterop/SGIC_FQuat.h"
#include "SGInterop/SGIC_FSGBasicHandModelImpl.h"
#include "SGInterop/SGIC_FSGBuzzCommandImpl.h"
#include "SGInterop/SGIC_FSGForceFeedbackCommandImpl.h"
#include "SGInterop/SGIC_FSGCustomWaveformImpl.h"
#include "SGInterop/SGIC_FSGHandPoseImpl.h"
#include "SGInterop/SGIC_FSGHandProfileImpl.h"
#include "SGInterop/SGIC_FSGThumperCommandImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_FVector.h"
#include "SGInterop/SGIC_TArray_FVector.h"
#include "SGInterop/SGIC_TArray_TArray_FVector.h"
#include "SGInterop/SGIC_TArray_TSharedRef_FSGHapticGloveImpl.h"
#include "SGInterop/SGIC_TArray_float.h"
#include "SGInterop/SGIC_TSharedPtr_FSGHapticGloveImpl.h"
USGHapticGlove* USGHapticGlove::NewHapticGlove(UObject* Outer, const FSGHapticGloveImpl& HapticGloveImpl)
@@ -80,10 +81,10 @@ USGHapticGlove* USGHapticGlove::NewHapticGlove(UObject* Outer)
return NewHapticGlove(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
TArray<USGHapticGlove*> USGHapticGlove::GetHapticGloves(UObject* Outer)
TArray<USGHapticGlove*> USGHapticGlove::GetHapticGloves(UObject* Outer, const bool bConnectedOnly)
{
FSGIC_TArray_TSharedRef_FSGHapticGloveImpl OutGlovesContainer;
SGCoreImpl_FSGHapticGloveImpl_GetHapticGloves(&OutGlovesContainer);
SGCoreImpl_FSGHapticGloveImpl_GetHapticGloves(&OutGlovesContainer, bConnectedOnly);
TArray<USGHapticGlove*> HapticGloves;
for (TSharedRef<FSGHapticGloveImpl> HapticGloveImpl: OutGlovesContainer.Array)
{
@@ -109,7 +110,8 @@ bool USGHapticGlove::GetGlove(UObject* Outer, const bool bRightHanded, USGHaptic
{
FSGIC_TSharedPtr_FSGHapticGloveImpl OutGloveContainer;
const bool bResult = SGCoreImpl_FSGHapticGloveImpl_GetGlove_bRightHanded_OutGlove(bRightHanded, &OutGloveContainer);
const bool bResult = SGCoreImpl_FSGHapticGloveImpl_GetGlove_bRightHanded_OutGlove(
bRightHanded, &OutGloveContainer);
if (bResult)
{
OutGlove = NewHapticGlove(Outer, OutGloveContainer.Ptr.ToSharedRef());
@@ -118,6 +120,22 @@ bool USGHapticGlove::GetGlove(UObject* Outer, const bool bRightHanded, USGHaptic
return bResult;
}
FString USGHapticGlove::ToString(const ESGHapticGloveCalibrationState State)
{
FSGIC_ESGHapticGloveCalibrationState StateContainer{State};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGHapticGloveImpl_ToString_State(&StateContainer, &OutStringContainer);
return MoveTemp(OutStringContainer.String);
}
FString USGHapticGlove::ToString(const ESGHapticLocation Location)
{
FSGIC_ESGHapticLocation LocationContainer{Location};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGHapticGloveImpl_ToString_Location(&LocationContainer, &OutStringContainer);
return MoveTemp(OutStringContainer.String);
}
USGHapticGlove::USGHapticGlove()
: USGDevice()
{
@@ -137,6 +155,11 @@ USGHapticGlove::USGHapticGlove(const FSGHapticGloveImpl& HapticGloveImpl)
{
}
USGHapticGlove::USGHapticGlove(const FSGNova2GloveImpl& Nova2GloveImpl)
: USGDevice(Nova2GloveImpl)
{
}
USGHapticGlove::USGHapticGlove(const FSGNovaGloveImpl& NovaGloveImpl)
: USGDevice(NovaGloveImpl)
{
@@ -157,6 +180,11 @@ USGHapticGlove::USGHapticGlove(TSharedRef<FSGHapticGloveImpl> HapticGloveImpl)
{
}
USGHapticGlove::USGHapticGlove(TSharedRef<FSGNova2GloveImpl> Nova2GloveImpl)
: USGDevice(MoveTemp(Nova2GloveImpl))
{
}
USGHapticGlove::USGHapticGlove(TSharedRef<FSGNovaGloveImpl> NovaGloveImpl)
: USGDevice(MoveTemp(NovaGloveImpl))
{
@@ -245,41 +273,7 @@ bool USGHapticGlove::GetImuRotation(FRotator& OutImu)
}
bool USGHapticGlove::GetHandPose(
UObject* Outer,
const USGBasicHandModel* HandGeometry, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose)
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_FSGBasicHandModelImpl HandGeometryContainer{HandGeometry->ToBasicHandModelImpl()};
FSGIC_FSGHandProfileImpl HandProfileContainer{HandProfile->ToHandProfileImpl()};
FSGIC_FSGHandPoseImpl OutHandPoseContainer;
const bool bResult = SGCoreImpl_FSGHapticGloveImpl_GetHandPose_HandGeometry_HandProfile_OutHandPose(
&InstanceContainer, &HandGeometryContainer, &HandProfileContainer, &OutHandPoseContainer);
if (bResult)
{
OutHandPose = USGHandPose::NewHandPose(Outer, MoveTemp(OutHandPoseContainer.HandPoseImpl));
}
return bResult;
}
bool USGHapticGlove::GetHandPose(UObject* Outer, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose)
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_FSGHandProfileImpl HandProfileContainer{HandProfile->ToHandProfileImpl()};
FSGIC_FSGHandPoseImpl OutHandPoseContainer;
const bool bResult = SGCoreImpl_FSGHapticGloveImpl_GetHandPose_HandProfile_OutHandPose(
&InstanceContainer, &HandProfileContainer, &OutHandPoseContainer);
if (bResult)
{
OutHandPose = USGHandPose::NewHandPose(Outer, MoveTemp(OutHandPoseContainer.HandPoseImpl));
}
return bResult;
}
bool USGHapticGlove::GetHandPose(UObject* Outer, const USGBasicHandModel* HandGeometry, USGHandPose*& OutHandPose)
UObject* Outer, const USGBasicHandModel* HandGeometry, USGHandPose*& OutHandPose) const
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_FSGBasicHandModelImpl HandGeometryContainer{HandGeometry->ToBasicHandModelImpl()};
@@ -310,22 +304,63 @@ bool USGHapticGlove::GetHandPose(UObject* Outer, USGHandPose*& OutHandPose)
return bResult;
}
#if PLATFORM_ANDROID
bool USGHapticGlove::GetHandPose(UObject* Outer, const float DeltaTime, USGHandPose*& OutHandPose)
bool USGHapticGlove::GetHandAngles(TArray<TArray<FVector>>& OutHandAngles) const
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_FSGHandPoseImpl OutHandPoseContainer;
const bool bResult = SGCoreImpl_FSGHapticGloveImpl_GetHandPose_DeltaTime_OutHandPose(
&InstanceContainer, DeltaTime, &OutHandPoseContainer);
FSGIC_TArray_TArray_FVector OutHandAnglesContainer;
const bool bResult = SGCoreImpl_FSGHapticGloveImpl_GetHandAngles_OutHandAngles(
&InstanceContainer, &OutHandAnglesContainer);
if (bResult)
{
OutHandPose = USGHandPose::NewHandPose(Outer, MoveTemp(OutHandPoseContainer.HandPoseImpl));
OutHandAngles = MoveTemp(OutHandAnglesContainer.Array);
}
return bResult;
}
#endif /* PLATFORM_ANDROID */
USGBasicHandModel* USGHapticGlove::GetHandGeometry(UObject* Outer) const
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_FSGBasicHandModelImpl OutBasicHandModelContainer;
SGCoreImpl_FSGHapticGloveImpl_GetHandGeometry(&InstanceContainer, &OutBasicHandModelContainer);
return USGBasicHandModel::NewBasicHandModel(Outer, MoveTemp(OutBasicHandModelContainer.BasicHandModelImpl));
}
void USGHapticGlove::SetHandGeometry(const USGBasicHandModel* HandGeometry)
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_FSGBasicHandModelImpl HandGeometryContainer{HandGeometry->ToBasicHandModelImpl()};
SGCoreImpl_FSGHapticGloveImpl_SetHandGeometry(&InstanceContainer, &HandGeometryContainer);
}
ESGHapticGloveCalibrationState USGHapticGlove::GetCalibrationState() const
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_ESGHapticGloveCalibrationState OutHapticGloveCalibrationStateContainer;
SGCoreImpl_FSGHapticGloveImpl_GetCalibrationState(&InstanceContainer, &OutHapticGloveCalibrationStateContainer);
return OutHapticGloveCalibrationStateContainer.State;
}
void USGHapticGlove::EndCalibration()
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
SGCoreImpl_FSGHapticGloveImpl_EndCalibration(&InstanceContainer);
}
void USGHapticGlove::ResetCalibration()
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
SGCoreImpl_FSGHapticGloveImpl_ResetCalibration(&InstanceContainer);
}
FString USGHapticGlove::GetCalibrationInstruction() const
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGHapticGloveImpl_GetCalibrationInstruction(&InstanceContainer, &OutStringContainer);
return MoveTemp(OutStringContainer.String);
}
void USGHapticGlove::StopHaptics()
{
@@ -339,113 +374,39 @@ void USGHapticGlove::StopVibrations()
SGCoreImpl_FSGHapticGloveImpl_StopVibrations(&InstanceContainer);
}
void USGHapticGlove::SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand)
bool USGHapticGlove::SendHaptics()
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_FSGForceFeedbackCommandImpl ForceFeedbackCommandContainer{
ForceFeedbackCommand->ToForceFeedbackCommandImpl().Get()};
SGCoreImpl_FSGHapticGloveImpl_SendHaptics_ForceFeedbackCommand(&InstanceContainer, &ForceFeedbackCommandContainer);
return SGCoreImpl_FSGHapticGloveImpl_SendHaptics(&InstanceContainer);
}
void USGHapticGlove::SendHaptics(const USGBuzzCommand* BuzzCommand)
bool USGHapticGlove::QueueForceFeedbackLevels(const TArray<float>& Levels01)
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_FSGBuzzCommandImpl BuzzCommandContainer{BuzzCommand->ToBuzzCommandImpl().Get()};
SGCoreImpl_FSGHapticGloveImpl_SendHaptics_BuzzCommand(&InstanceContainer, &BuzzCommandContainer);
FSGIC_TArray_float Levels01Container{Levels01};
return SGCoreImpl_FSGHapticGloveImpl_QueueForceFeedbackLevels(&InstanceContainer, &Levels01Container);
}
void USGHapticGlove::SendHaptics(const USGThumperCommand* ThumperCommand)
bool USGHapticGlove::QueueForceFeedbackLevel(const int32 Finger, const float Level01)
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_FSGThumperCommandImpl ThumperCommandContainer{ThumperCommand->ToThumperCommandImpl()};
SGCoreImpl_FSGHapticGloveImpl_SendHaptics_ThumperCommand(&InstanceContainer, &ThumperCommandContainer);
return SGCoreImpl_FSGHapticGloveImpl_QueueForceFeedbackLevel(&InstanceContainer, Finger, Level01);
}
void USGHapticGlove::SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand,
const USGBuzzCommand* BuzzCommand)
bool USGHapticGlove::SupportsCustomWaveform(const ESGHapticLocation AtLocation) const
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_FSGForceFeedbackCommandImpl ForceFeedbackCommandContainer{
ForceFeedbackCommand->ToForceFeedbackCommandImpl().Get()};
FSGIC_FSGBuzzCommandImpl BuzzCommandContainer{BuzzCommand->ToBuzzCommandImpl().Get()};
SGCoreImpl_FSGHapticGloveImpl_SendHaptics_ForceFeedbackCommand_BuzzCommand(
&InstanceContainer, &ForceFeedbackCommandContainer, &BuzzCommandContainer);
FSGIC_ESGHapticLocation AtLocationContainer{AtLocation};
return SGCoreImpl_FSGHapticGloveImpl_SupportsCustomWaveform(&InstanceContainer, &AtLocationContainer);
}
void USGHapticGlove::SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand,
const USGBuzzCommand* BuzzCommand,
const USGThumperCommand* ThumperCommand)
bool USGHapticGlove::SendCustomWaveform(USGCustomWaveform* OutWaveform, const ESGHapticLocation Location)
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_FSGForceFeedbackCommandImpl ForceFeedbackCommandContainer{
ForceFeedbackCommand->ToForceFeedbackCommandImpl().Get()};
FSGIC_FSGBuzzCommandImpl BuzzCommandContainer{BuzzCommand->ToBuzzCommandImpl().Get()};
FSGIC_FSGThumperCommandImpl ThumperCommandContainer{ThumperCommand->ToThumperCommandImpl()};
SGCoreImpl_FSGHapticGloveImpl_SendHaptics_ForceFeedbackCommand_BuzzCommand_ThumperCommand(
&InstanceContainer, &ForceFeedbackCommandContainer, &BuzzCommandContainer, &ThumperCommandContainer);
}
bool USGHapticGlove::GetCalibrationValues(TArray<FVector>& OutValues)
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_TArray_FVector OutValuesContainer;
const bool bResult = SGCoreImpl_FSGHapticGloveImpl_GetCalibrationValues(&InstanceContainer, &OutValuesContainer);
if (bResult)
{
OutValues = MoveTemp(OutValuesContainer.Array);
}
return bResult;
}
void USGHapticGlove::ResetCalibrationRange()
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
SGCoreImpl_FSGHapticGloveImpl_ResetCalibrationRange(&InstanceContainer);
}
void USGHapticGlove::UpdateCalibrationRange()
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
SGCoreImpl_FSGHapticGloveImpl_UpdateCalibrationRange(&InstanceContainer);
}
void USGHapticGlove::UpdateCalibrationRange(const TArray<FVector>& CalibrationValues)
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_TArray_FVector CalibrationValuesContainer{CalibrationValues};
SGCoreImpl_FSGHapticGloveImpl_UpdateCalibrationRange_CalibrationValues(
&InstanceContainer, &CalibrationValuesContainer);
}
void USGHapticGlove::GetCalibrationRange(TArray<FVector>& OutMinValues, TArray<FVector>& OutMaxValues)
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_TArray_FVector OutMinValuesContainer;
FSGIC_TArray_FVector OutMaxValuesContainer;
SGCoreImpl_FSGHapticGloveImpl_GetCalibrationRange(&InstanceContainer, &OutMinValues, &OutMaxValues);
OutMinValues = MoveTemp(OutMinValuesContainer.Array);
OutMaxValues = MoveTemp(OutMaxValuesContainer.Array);
}
void USGHapticGlove::UpdateCalibration(UObject* Outer, USGHandProfile*& OutProfile)
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_FSGHandProfileImpl OutProfileContainer;
SGCoreImpl_FSGHapticGloveImpl_UpdateCalibration(&InstanceContainer, &OutProfileContainer);
OutProfile = USGHandProfile::NewHandProfile(Outer, MoveTemp(OutProfileContainer.HandProfileImpl));
}
void USGHapticGlove::ApplyCalibration(UObject* Outer, USGHandProfile*& OutProfile) const
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_FSGHandProfileImpl OutProfileContainer;
SGCoreImpl_FSGHapticGloveImpl_ApplyCalibration(&InstanceContainer, &OutProfileContainer);
OutProfile = USGHandProfile::NewHandProfile(Outer, MoveTemp(OutProfileContainer.HandProfileImpl));
FSGIC_FSGCustomWaveformImpl OutWaveformContainer{OutWaveform->ToCustomWaveformImpl()};
FSGIC_ESGHapticLocation LocationContainer{Location};
return SGCoreImpl_FSGHapticGloveImpl_SendCustomWaveform(
&InstanceContainer, &OutWaveformContainer, &LocationContainer);
}
void USGHapticGlove::GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
@@ -528,4 +489,12 @@ void USGHapticGlove::GetGloveLocation(const FVector& ReferencePosition, const FR
OutGlovePosition = MoveTemp(OutGlovePositionContainer.Vector);
OutGloveRotation = OutGloveRotationContainer.Quat.Rotator();
}
FString USGHapticGlove::ToString() const
{
FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGHapticGloveImpl_ToString(&InstanceContainer, &OutStringContainer);
return MoveTemp(OutStringContainer.String);
}
@@ -1,259 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGHapticGloveCalibrationCheck.h"
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGSensorRange.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_ESGCalibrationStage.h"
#include "SGInterop/SGIC_ESGDeviceType.h"
#include "SGInterop/SGIC_FSGHapticGloveCalibrationCheckImpl.h"
#include "SGInterop/SGIC_FSGSensorRangeImpl.h"
#include "SGInterop/SGIC_FSGThumperCommandImpl.h"
#include "SGInterop/SGIC_TArray_FVector.h"
#include "SGUtils/SGArrayUtils.h"
struct USGHapticGloveCalibrationCheck::FImpl
{
/************************
* Member variables
************************/
FSGHapticGloveCalibrationCheckImpl HapticGloveCalibrationCheckImpl;
/************************
* Owner object
************************/
USGHapticGloveCalibrationCheck* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGHapticGloveCalibrationCheck* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGHapticGloveCalibrationCheck* USGHapticGloveCalibrationCheck::NewHapticGloveCalibrationCheck(
UObject* Outer, const FSGHapticGloveCalibrationCheckImpl& HapticGloveCalibrationCheckImpl)
{
USGHapticGloveCalibrationCheck* Instance = NewObject<USGHapticGloveCalibrationCheck>(Outer);
Instance->SetHapticGloveCalibrationCheckImpl(HapticGloveCalibrationCheckImpl);
return Instance;
}
USGHapticGloveCalibrationCheck* USGHapticGloveCalibrationCheck::NewHapticGloveCalibrationCheck(UObject* Outer)
{
FSGIC_FSGHapticGloveCalibrationCheckImpl OutHapticGloveCalibrationCheckImplContainer;
SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_ctor(&OutHapticGloveCalibrationCheckImplContainer);
return NewHapticGloveCalibrationCheck(
Outer, MoveTemp(OutHapticGloveCalibrationCheckImplContainer.HapticGloveCalibrationCheckImpl));
}
USGHapticGloveCalibrationCheck* USGHapticGloveCalibrationCheck::NewHapticGloveCalibrationCheck(
UObject* Outer, const USGSensorRange* LastCalibrationRange)
{
FSGIC_FSGHapticGloveCalibrationCheckImpl OutHapticGloveCalibrationCheckImplContainer;
FSGIC_FSGSensorRangeImpl LastCalibrationRangeContainer{LastCalibrationRange->ToSensorRangeImpl()};
SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_ctor_LastCalibrationRange(
&OutHapticGloveCalibrationCheckImplContainer, &LastCalibrationRangeContainer);
return NewHapticGloveCalibrationCheck(
Outer, MoveTemp(OutHapticGloveCalibrationCheckImplContainer.HapticGloveCalibrationCheckImpl));
}
float USGHapticGloveCalibrationCheck::GetSenseGloveThreshold()
{
return SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_GetSenseGloveThreshold();
}
float USGHapticGloveCalibrationCheck::GetNovaGloveThreshold()
{
return SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_GetNovaGloveThreshold();
}
float USGHapticGloveCalibrationCheck::GetSenseGloveMinFlexion()
{
return SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_GetSenseGloveMinFlexion();
}
float USGHapticGloveCalibrationCheck::GetNovaGloveMinFlexion()
{
return SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_GetNovaGloveMinFlexion();
}
float USGHapticGloveCalibrationCheck::GetSenseGloveMinAbduction()
{
return SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_GetSenseGloveMinAbduction();
}
float USGHapticGloveCalibrationCheck::GetNovaGloveMinAbduction()
{
return SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_GetNovaGloveMinAbduction();
}
bool USGHapticGloveCalibrationCheck::NeedsCheck(const ESGDeviceType DeviceType)
{
FSGIC_ESGDeviceType DeviceTypeContainer{DeviceType};
return SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_NeedsCheck(&DeviceTypeContainer);
}
int32 USGHapticGloveCalibrationCheck::OutOfBounds(
const USGSensorRange* PreviousRange, const TArray<FVector>& CurrentValues, const ESGDeviceType DeviceType)
{
FSGIC_FSGSensorRangeImpl PreviousRangeContainer{PreviousRange->ToSensorRangeImpl()};
FSGIC_TArray_FVector CurrentValuesContainer{CurrentValues};
FSGIC_ESGDeviceType DeviceTypeContainer{DeviceType};
return SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_OutOfBounds(
&PreviousRangeContainer, &CurrentValuesContainer, &DeviceTypeContainer);
}
bool USGHapticGloveCalibrationCheck::MovedMinimum(const TArray<FVector>& CurrentRange, const ESGDeviceType DeviceType)
{
FSGIC_TArray_FVector CurrentRangeContainer{CurrentRange};
FSGIC_ESGDeviceType DeviceTypeContainer{DeviceType};
return SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_MovedMinimum(&CurrentRangeContainer, &DeviceTypeContainer);
}
bool USGHapticGloveCalibrationCheck::MatchesLast(const TArray<FVector>& CurrentRange, const TArray<FVector>& LastRange,
const ESGDeviceType DeviceType)
{
FSGIC_TArray_FVector CurrentRangeContainer{CurrentRange};
FSGIC_TArray_FVector LastRangeContainer{LastRange};
FSGIC_ESGDeviceType DeviceTypeContainer{DeviceType};
return SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_MatchesLast(
&CurrentRangeContainer, &LastRangeContainer, &DeviceTypeContainer);
}
USGHapticGloveCalibrationCheck::USGHapticGloveCalibrationCheck()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGHapticGloveCalibrationCheckImpl OutHapticGloveCalibrationCheckImplContainer;
SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_ctor(&OutHapticGloveCalibrationCheckImplContainer);
Pimpl->HapticGloveCalibrationCheckImpl = MoveTemp(
OutHapticGloveCalibrationCheckImplContainer.HapticGloveCalibrationCheckImpl);
}
USGHapticGloveCalibrationCheck::USGHapticGloveCalibrationCheck(const USGSensorRange* LastCalibrationRange)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGHapticGloveCalibrationCheckImpl OutHapticGloveCalibrationCheckImplContainer;
FSGIC_FSGSensorRangeImpl LastCalibrationRangeContainer{LastCalibrationRange->ToSensorRangeImpl()};
SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_ctor_LastCalibrationRange(
&OutHapticGloveCalibrationCheckImplContainer, &LastCalibrationRangeContainer);
Pimpl->HapticGloveCalibrationCheckImpl = MoveTemp(
OutHapticGloveCalibrationCheckImplContainer.HapticGloveCalibrationCheckImpl);
}
USGHapticGloveCalibrationCheck::USGHapticGloveCalibrationCheck(
const FSGHapticGloveCalibrationCheckImpl& HapticGloveCalibrationCheckImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
SetHapticGloveCalibrationCheckImpl(HapticGloveCalibrationCheckImpl);
}
USGHapticGloveCalibrationCheck::~USGHapticGloveCalibrationCheck() = default;
void USGHapticGloveCalibrationCheck::SetHapticGloveCalibrationCheckImpl(
const FSGHapticGloveCalibrationCheckImpl& HapticGloveCalibrationCheckImpl)
{
FSGIC_FSGHapticGloveCalibrationCheckImpl OutHapticGloveCalibrationCheckContainer;
FSGIC_FSGHapticGloveCalibrationCheckImpl RhsContainer{HapticGloveCalibrationCheckImpl};
SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_ctor_copy(&OutHapticGloveCalibrationCheckContainer, &RhsContainer);
Pimpl->HapticGloveCalibrationCheckImpl = MoveTemp(
OutHapticGloveCalibrationCheckContainer.HapticGloveCalibrationCheckImpl);
}
const FSGHapticGloveCalibrationCheckImpl& USGHapticGloveCalibrationCheck::ToHapticGloveCalibrationCheckImpl() const
{
return Pimpl->HapticGloveCalibrationCheckImpl;
}
ESGCalibrationStage USGHapticGloveCalibrationCheck::GetCalibrationStage() const
{
FSGIC_FSGHapticGloveCalibrationCheckImpl InstanceContainer{ToHapticGloveCalibrationCheckImpl()};
FSGIC_ESGCalibrationStage OutStageContainer;
SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_GetCalibrationStage(&InstanceContainer, &OutStageContainer);
return MoveTemp(OutStageContainer.Stage);
}
bool USGHapticGloveCalibrationCheck::ReachedConclusion() const
{
FSGIC_FSGHapticGloveCalibrationCheckImpl InstanceContainer{ToHapticGloveCalibrationCheckImpl()};
return SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_ReachedConclusion(&InstanceContainer);
}
void USGHapticGloveCalibrationCheck::Reset()
{
FSGIC_FSGHapticGloveCalibrationCheckImpl InstanceContainer{ToHapticGloveCalibrationCheckImpl()};
SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_Reset(&InstanceContainer);
}
void USGHapticGloveCalibrationCheck::CheckRange(
const TArray<FVector>& CurrentValues, const float DeltaSeconds, const ESGDeviceType DeviceType)
{
FSGIC_FSGHapticGloveCalibrationCheckImpl InstanceContainer{ToHapticGloveCalibrationCheckImpl()};
FSGIC_TArray_FVector CurrentValuesContainer{CurrentValues};
FSGIC_ESGDeviceType DeviceTypeContainer{DeviceType};
SGCoreImpl_FSGHapticGloveCalibrationCheckImpl_CheckRange(&InstanceContainer, &CurrentValuesContainer,
DeltaSeconds, &DeviceTypeContainer);
}
USGHapticGloveCalibrationCheck::FImpl::FImpl(USGHapticGloveCalibrationCheck* InOwner)
: Owner(InOwner)
{
}
USGHapticGloveCalibrationCheck::FImpl::~FImpl() = default;
void USGHapticGloveCalibrationCheck::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -1,421 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGHapticGloveCalibrationSequence.h"
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGCalibrationDataPoint.h"
#include "SGCore/SGHandPose.h"
#include "SGCore/SGHandProfile.h"
#include "SGCore/SGHapticGlove.h"
#include "SGCore/SGSensorRange.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_ESGDeviceType.h"
#include "SGInterop/SGIC_FSGHandPoseImpl.h"
#include "SGInterop/SGIC_FSGHandProfileImpl.h"
#include "SGInterop/SGIC_FSGHapticGloveCalibrationSequenceImpl.h"
#include "SGInterop/SGIC_FSGHapticGloveQuickCalibrationImpl.h"
#include "SGInterop/SGIC_FSGSensorRangeImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_TArray_FSGCalibrationDataPointImpl.h"
#include "SGInterop/SGIC_TArray_FVector.h"
#include "SGInterop/SGIC_TSharedPtr_FSGHapticGloveImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl.h"
#include "SGUtils/SGArrayUtils.h"
struct USGHapticGloveCalibrationSequence::FImpl
{
/************************
* Member variables
************************/
TSharedPtr<FSGHapticGloveCalibrationSequenceImpl> HapticGloveCalibrationSequenceImpl;
/************************
* Owner object
************************/
USGHapticGloveCalibrationSequence* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGHapticGloveCalibrationSequence* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGHapticGloveCalibrationSequence* USGHapticGloveCalibrationSequence::NewHapticGloveCalibrationSequence(UObject* Outer,
const FSGHapticGloveCalibrationSequenceImpl& HapticGloveCalibrationSequence)
{
USGHapticGloveCalibrationSequence* Instance = NewObject<USGHapticGloveCalibrationSequence>(Outer);
Instance->SetHapticGloveCalibrationSequenceImpl(HapticGloveCalibrationSequence);
return Instance;
}
USGHapticGloveCalibrationSequence* USGHapticGloveCalibrationSequence::NewHapticGloveCalibrationSequence(UObject* Outer,
TSharedRef<FSGHapticGloveCalibrationSequenceImpl> HapticGloveCalibrationSequence)
{
USGHapticGloveCalibrationSequence* Instance = NewObject<USGHapticGloveCalibrationSequence>(Outer);
Instance->SetHapticGloveCalibrationSequenceImpl(MoveTemp(HapticGloveCalibrationSequence));
return Instance;
}
USGHapticGloveCalibrationSequence* USGHapticGloveCalibrationSequence::NewHapticGloveCalibrationSequence(UObject* Outer)
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl OutSharedPtrContainer;
SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_ctor_MakeShared(&OutSharedPtrContainer);
return NewHapticGloveCalibrationSequence(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGHapticGloveCalibrationSequence* USGHapticGloveCalibrationSequence::NewHapticGloveCalibrationSequence(UObject* Outer,
const USGHapticGlove* LinkedGlove)
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl OutSharedPtrContainer;
FSGIC_TSharedPtr_FSGHapticGloveImpl LinkedGloveContainer{LinkedGlove->ToHapticGloveImpl()};
SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_ctor_LinkedGlove_MakeShared(
&OutSharedPtrContainer, &LinkedGloveContainer);
return NewHapticGloveCalibrationSequence(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
int32 USGHapticGloveCalibrationSequence::GetMaxDataPoints()
{
return SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_GetMaxDataPoints();
}
bool USGHapticGloveCalibrationSequence::CompileProfile(UObject* Outer,
const USGSensorRange* SensorRange, const ESGDeviceType ForDevice,
const bool bRightHanded, USGHandProfile*& OutProfile)
{
FSGIC_FSGSensorRangeImpl SensorRangeContainer{SensorRange->ToSensorRangeImpl()};
FSGIC_ESGDeviceType ForDeviceContainer{ForDevice};
FSGIC_FSGHandProfileImpl OutProfileContainer;
const bool bResult =
SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_CompileProfile_SensorRange_ForDevice_bRightHanded_OutProfile(
&SensorRangeContainer, &ForDeviceContainer, bRightHanded, &OutProfileContainer);
if (bResult)
{
OutProfile = USGHandProfile::NewHandProfile(Outer, MoveTemp(OutProfileContainer.HandProfileImpl));
}
return bResult;
}
USGHapticGloveCalibrationSequence::USGHapticGloveCalibrationSequence()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl OutSharedPtrContainer;
SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_ctor_MakeShared(&OutSharedPtrContainer);
Pimpl->HapticGloveCalibrationSequenceImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
USGHapticGloveCalibrationSequence::USGHapticGloveCalibrationSequence(const USGHapticGlove* LinkedGlove)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl OutSharedPtrContainer;
FSGIC_TSharedPtr_FSGHapticGloveImpl LinkedGloveContainer{LinkedGlove->ToHapticGloveImpl()};
SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_ctor_LinkedGlove_MakeShared(
&OutSharedPtrContainer, &LinkedGloveContainer);
Pimpl->HapticGloveCalibrationSequenceImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
USGHapticGloveCalibrationSequence::USGHapticGloveCalibrationSequence(
const FSGHapticGloveCalibrationSequenceImpl& HapticGloveCalibrationSequenceImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl OutSharedPtrContainer;
FSGIC_FSGHapticGloveCalibrationSequenceImpl RhsContainer{HapticGloveCalibrationSequenceImpl};
SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_ctor_copy_MakeShared(
&OutSharedPtrContainer, &RhsContainer);
Pimpl->HapticGloveCalibrationSequenceImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
USGHapticGloveCalibrationSequence::USGHapticGloveCalibrationSequence(
const FSGHapticGloveQuickCalibrationImpl& HapticGloveQuickCalibrationImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl OutSharedPtrContainer;
FSGIC_FSGHapticGloveQuickCalibrationImpl RhsContainer{HapticGloveQuickCalibrationImpl};
SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_ctor_copy_MakeShared(
&OutSharedPtrContainer, &RhsContainer);
Pimpl->HapticGloveCalibrationSequenceImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
USGHapticGloveCalibrationSequence::USGHapticGloveCalibrationSequence(
TSharedRef<FSGHapticGloveCalibrationSequenceImpl> HapticGloveCalibrationSequenceImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
Pimpl->HapticGloveCalibrationSequenceImpl = MoveTemp(HapticGloveCalibrationSequenceImpl);
}
USGHapticGloveCalibrationSequence::USGHapticGloveCalibrationSequence(
TSharedRef<FSGHapticGloveQuickCalibrationImpl> HapticGloveQuickCalibrationImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
Pimpl->HapticGloveCalibrationSequenceImpl = MoveTemp(HapticGloveQuickCalibrationImpl);
}
USGHapticGloveCalibrationSequence::~USGHapticGloveCalibrationSequence() = default;
void USGHapticGloveCalibrationSequence::SetHapticGloveCalibrationSequenceImpl(
const FSGHapticGloveCalibrationSequenceImpl& HapticGloveCalibrationSequenceImpl)
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl OutSharedPtrContainer;
FSGIC_FSGHapticGloveCalibrationSequenceImpl RhsContainer{HapticGloveCalibrationSequenceImpl};
SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_ctor_copy_MakeShared(&OutSharedPtrContainer, &RhsContainer);
Pimpl->HapticGloveCalibrationSequenceImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
void USGHapticGloveCalibrationSequence::SetHapticGloveCalibrationSequenceImpl(
const FSGHapticGloveQuickCalibrationImpl& HapticGloveQuickCalibrationImpl)
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl OutSharedPtrContainer;
FSGIC_FSGHapticGloveQuickCalibrationImpl RhsContainer{HapticGloveQuickCalibrationImpl};
SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_ctor_copy_MakeShared(&OutSharedPtrContainer, &RhsContainer);
Pimpl->HapticGloveCalibrationSequenceImpl = MoveTemp(OutSharedPtrContainer.Ptr);
}
void USGHapticGloveCalibrationSequence::SetHapticGloveCalibrationSequenceImpl(
TSharedRef<FSGHapticGloveCalibrationSequenceImpl> HapticGloveCalibrationSequenceImpl)
{
Pimpl->HapticGloveCalibrationSequenceImpl = MoveTemp(HapticGloveCalibrationSequenceImpl);
}
void USGHapticGloveCalibrationSequence::SetHapticGloveCalibrationSequenceImpl(
TSharedRef<FSGHapticGloveQuickCalibrationImpl> HapticGloveQuickCalibrationImpl)
{
Pimpl->HapticGloveCalibrationSequenceImpl = MoveTemp(HapticGloveQuickCalibrationImpl);
}
TSharedRef<FSGHapticGloveCalibrationSequenceImpl>
USGHapticGloveCalibrationSequence::ToHapticGloveCalibrationSequenceImpl() const
{
return Pimpl->HapticGloveCalibrationSequenceImpl.ToSharedRef();
}
USGHapticGlove* USGHapticGloveCalibrationSequence::GetLinkedGlove(UObject* Outer) const
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
FSGIC_TSharedPtr_FSGHapticGloveImpl OutGloveContainer;
SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_GetLinkedGlove(&InstanceContainer, &OutGloveContainer);
return USGHapticGlove::NewHapticGlove(Outer, OutGloveContainer.Ptr.ToSharedRef());
}
void USGHapticGloveCalibrationSequence::SetLinkedGlove(const USGHapticGlove* LinkedGlove)
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
FSGIC_TSharedPtr_FSGHapticGloveImpl LinkedGloveContainer{LinkedGlove->ToHapticGloveImpl()};
SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_SetLinkedGlove(&InstanceContainer, &LinkedGloveContainer);
}
TArray<USGCalibrationDataPoint*> USGHapticGloveCalibrationSequence::GetCalibrationPoints(UObject* Outer) const
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
FSGIC_TArray_FSGCalibrationDataPointImpl OutPoints;
SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_GetCalibrationPoints(&InstanceContainer, &OutPoints);
TArray<USGCalibrationDataPoint*> Points{
FSGArrayUtils::FromImplType<FSGCalibrationDataPointImpl, USGCalibrationDataPoint,
&USGCalibrationDataPoint::NewCalibrationDataPoint>(
Outer, MoveTemp(OutPoints.Array))
};
return MoveTemp(Points);
}
float USGHapticGloveCalibrationSequence::GetElapsedTime() const
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
return SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_GetElapsedTime(&InstanceContainer);
}
bool USGHapticGloveCalibrationSequence::IsManuallyCompleted() const
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
return SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_IsManuallyCompleted(&InstanceContainer);
}
int32 USGHapticGloveCalibrationSequence::GetCurrentStage() const
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
return SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_GetCurrentStage(&InstanceContainer);
}
SIZE_T USGHapticGloveCalibrationSequence::GetCalibrationPointsCount() const
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
return SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_GetCalibrationPointsCount(&InstanceContainer);
}
bool USGHapticGloveCalibrationSequence::AutoCompleted() const
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
return SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_AutoCompleted(&InstanceContainer);
}
bool USGHapticGloveCalibrationSequence::Completed() const
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
return SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_Completed(&InstanceContainer);
}
void USGHapticGloveCalibrationSequence::Reset()
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_Reset(&InstanceContainer);
}
void USGHapticGloveCalibrationSequence::AddDataPoint(const TArray<FVector>& CalibrationPoints)
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
FSGIC_TArray_FVector CalibrationPointsContainer{CalibrationPoints};
SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_AddDataPoint(&InstanceContainer, &CalibrationPointsContainer);
}
void USGHapticGloveCalibrationSequence::Update(const float DeltaSeconds)
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_Update(&InstanceContainer, DeltaSeconds);
}
void USGHapticGloveCalibrationSequence::ConfirmCurrentStep()
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_ConfirmCurrentStep(&InstanceContainer);
}
bool USGHapticGloveCalibrationSequence::CompileRange(UObject* Outer, USGSensorRange*& OutSensorRange) const
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
FSGIC_FSGSensorRangeImpl OutSensorRangeContainer;
const bool bResult = SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_CompileRange(
&InstanceContainer, &OutSensorRangeContainer);
if (bResult)
{
OutSensorRange = USGSensorRange::NewSensorRange(Outer, MoveTemp(OutSensorRangeContainer.SensorRangeImpl));
}
return bResult;
}
bool USGHapticGloveCalibrationSequence::CompileProfile(UObject* Outer,
const ESGDeviceType ForDevice, const bool bRightHanded,
USGHandProfile*& OutProfile) const
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
FSGIC_ESGDeviceType ForDeviceContainer{ForDevice};
FSGIC_FSGHandProfileImpl OutProfileContainer;
const bool bResult =
SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_CompileProfile_ForDevice_bRightHanded_OutProfile(
&InstanceContainer, &ForDeviceContainer, bRightHanded, &OutProfileContainer);
if (bResult)
{
OutProfile = USGHandProfile::NewHandProfile(Outer, MoveTemp(OutProfileContainer.HandProfileImpl));
}
return bResult;
}
bool USGHapticGloveCalibrationSequence::GetHandPose(UObject* Outer, USGHandPose*& OutCurrentHandPose) const
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
FSGIC_FSGHandPoseImpl OutCurrentHandPoseContainer;
const bool bResult = SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_GetHandPose_OutCurrentHandPose(
&InstanceContainer, &OutCurrentHandPoseContainer);
if (bResult)
{
OutCurrentHandPose = USGHandPose::NewHandPose(Outer, MoveTemp(OutCurrentHandPoseContainer.HandPoseImpl));
}
return bResult;
}
bool USGHapticGloveCalibrationSequence::GetHandPose(UObject* Outer,
const bool bRightHanded, USGHandPose*& OutCurrentHandPose) const
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
FSGIC_FSGHandPoseImpl OutCurrentHandPoseContainer;
const bool bResult = SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_GetHandPose_bRightHanded_OutCurrentHandPose(
&InstanceContainer, bRightHanded, &OutCurrentHandPoseContainer);
if (bResult)
{
OutCurrentHandPose = USGHandPose::NewHandPose(Outer, MoveTemp(OutCurrentHandPoseContainer.HandPoseImpl));
}
return bResult;
}
FString USGHapticGloveCalibrationSequence::GetCurrentInstruction(const FString& NextStepKey) const
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{ToHapticGloveCalibrationSequenceImpl()};
FSGIC_FString OutInstructionContainer;
FSGIC_FString NextStepKeyContainer{NextStepKey};
SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_GetCurrentInstruction(
&InstanceContainer, &OutInstructionContainer, &NextStepKeyContainer);
return MoveTemp(OutInstructionContainer.String);
}
USGHapticGloveCalibrationSequence::FImpl::FImpl(USGHapticGloveCalibrationSequence* InOwner)
: Owner(InOwner)
{
}
USGHapticGloveCalibrationSequence::FImpl::~FImpl() = default;
void USGHapticGloveCalibrationSequence::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -1,55 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGHapticGloveCalibrationSequenceImplCast.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGCoreImpl/SGHapticGloveCalibrationSequenceImpl.h"
#include "SGCoreImpl/SGHapticGloveQuickCalibrationImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl.h"
TSharedRef<FSGHapticGloveQuickCalibrationImpl> FSGHapticGloveCalibrationSequenceImplCast::
ToHapticGloveQuickCalibrationImpl(
TSharedRef<FSGHapticGloveCalibrationSequenceImpl> HapticGloveCalibrationSequenceImpl)
{
FSGIC_TSharedPtr_FSGHapticGloveCalibrationSequenceImpl InstanceContainer{
MoveTemp(HapticGloveCalibrationSequenceImpl)
};
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl OutSharedPtrContainer;
SGCoreImpl_FSGHapticGloveCalibrationSequenceImpl_ToHapticGloveQuickCalibrationImplRef(
&InstanceContainer, &OutSharedPtrContainer);
return OutSharedPtrContainer.Ptr.ToSharedRef();
}
@@ -1,48 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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 "Templates/SharedPointer.h"
class FSGHapticGloveCalibrationSequenceImpl;
class FSGHapticGloveQuickCalibrationImpl;
class SENSEGLOVECORE_API FSGHapticGloveCalibrationSequenceImplCast
{
public:
static TSharedRef<FSGHapticGloveQuickCalibrationImpl> ToHapticGloveQuickCalibrationImpl(
TSharedRef<FSGHapticGloveCalibrationSequenceImpl> HapticGloveCalibrationSequenceImpl);
};
@@ -1,345 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGHapticGloveCommandBuffer.h"
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGBuzzCommand.h"
#include "SGCore/SGForceFeedbackCommand.h"
#include "SGCore/SGTimedBuzzCommand.h"
#include "SGCore/SGThumperCommand.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_FSGBuzzCommandImpl.h"
#include "SGInterop/SGIC_FSGForceFeedbackCommandImpl.h"
#include "SGInterop/SGIC_FSGHapticGloveCommandBufferImpl.h"
#include "SGInterop/SGIC_FSGThumperCommandImpl.h"
#include "SGInterop/SGIC_FSGTimedBuzzCommandImpl.h"
#include "SGInterop/SGIC_FSGTimedThumpCommandImpl.h"
#include "SGInterop/SGIC_TArray_FSGForceFeedbackCommandImpl.h"
#include "SGInterop/SGIC_TArray_FSGTimedBuzzCommandImpl.h"
#include "SGInterop/SGIC_TArray_FSGTimedThumpCommandImpl.h"
#include "SGUtils/SGArrayUtils.h"
struct USGHapticGloveCommandBuffer::FImpl
{
/************************
* Member variables
************************/
FSGHapticGloveCommandBufferImpl HapticGloveCommandBufferImpl;
/************************
* Owner object
************************/
USGHapticGloveCommandBuffer* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGHapticGloveCommandBuffer* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGHapticGloveCommandBuffer* USGHapticGloveCommandBuffer::NewHapticGloveCommandBuffer(
UObject* Outer, const FSGHapticGloveCommandBufferImpl& HapticGloveCommandBufferImpl)
{
USGHapticGloveCommandBuffer* Instance = NewObject<USGHapticGloveCommandBuffer>(Outer);
Instance->SetHapticGloveCommandBufferImpl(HapticGloveCommandBufferImpl);
return Instance;
}
USGHapticGloveCommandBuffer* USGHapticGloveCommandBuffer::NewHapticGloveCommandBuffer(UObject* Outer)
{
FSGIC_FSGHapticGloveCommandBufferImpl OutHapticGloveCommandBufferImplContainer;
SGCoreImpl_FSGHapticGloveCommandBufferImpl_ctor(&OutHapticGloveCommandBufferImplContainer);
return NewHapticGloveCommandBuffer(
Outer, MoveTemp(OutHapticGloveCommandBufferImplContainer.HapticGloveCommandBufferImpl));
}
int32 USGHapticGloveCommandBuffer::GetMaxForceFeedbackCommands()
{
return SGCoreImpl_FSGHapticGloveCommandBufferImpl_GetMaxForceFeedbackCommands();
}
int32 USGHapticGloveCommandBuffer::GetMaxBuzzCommands()
{
return SGCoreImpl_FSGHapticGloveCommandBufferImpl_GetMaxBuzzCommands();
}
int32 USGHapticGloveCommandBuffer::GetMaxThumpCommands()
{
return SGCoreImpl_FSGHapticGloveCommandBufferImpl_GetMaxThumpCommands();
}
USGHapticGloveCommandBuffer::USGHapticGloveCommandBuffer()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGHapticGloveCommandBufferImpl OutHapticGloveCommandBufferImplContainer;
SGCoreImpl_FSGHapticGloveCommandBufferImpl_ctor(&OutHapticGloveCommandBufferImplContainer);
Pimpl->HapticGloveCommandBufferImpl = MoveTemp(
OutHapticGloveCommandBufferImplContainer.HapticGloveCommandBufferImpl);
}
USGHapticGloveCommandBuffer::USGHapticGloveCommandBuffer(
const FSGHapticGloveCommandBufferImpl& HapticGloveCommandBufferImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
SetHapticGloveCommandBufferImpl(HapticGloveCommandBufferImpl);
}
USGHapticGloveCommandBuffer::~USGHapticGloveCommandBuffer() = default;
void USGHapticGloveCommandBuffer::SetHapticGloveCommandBufferImpl(
const FSGHapticGloveCommandBufferImpl& HapticGloveCommandBufferImpl)
{
FSGIC_FSGHapticGloveCommandBufferImpl OutHapticGloveCommandBufferContainer;
FSGIC_FSGHapticGloveCommandBufferImpl RhsContainer{HapticGloveCommandBufferImpl};
SGCoreImpl_FSGHapticGloveCommandBufferImpl_ctor_copy(&OutHapticGloveCommandBufferContainer, &RhsContainer);
Pimpl->HapticGloveCommandBufferImpl = MoveTemp(OutHapticGloveCommandBufferContainer.HapticGloveCommandBufferImpl);
}
const FSGHapticGloveCommandBufferImpl& USGHapticGloveCommandBuffer::ToHapticGloveCommandBufferImpl() const
{
return Pimpl->HapticGloveCommandBufferImpl;
}
TArray<USGForceFeedbackCommand*> USGHapticGloveCommandBuffer::GetForceFeedbackCommandsQueue(UObject* Outer) const
{
FSGIC_FSGHapticGloveCommandBufferImpl InstanceContainer{ToHapticGloveCommandBufferImpl()};
FSGIC_TArray_FSGForceFeedbackCommandImpl OutForceFeedbackCommandsQueueContainer;
SGCoreImpl_FSGHapticGloveCommandBufferImpl_GetForceFeedbackCommandsQueue(&InstanceContainer,
&OutForceFeedbackCommandsQueueContainer);
TArray<USGForceFeedbackCommand*> CommandsQueue;
for (FSGForceFeedbackCommandImpl& ForceFeedbackCommandImpl: OutForceFeedbackCommandsQueueContainer.Array)
{
CommandsQueue.Add(USGForceFeedbackCommand::NewForceFeedbackCommand(
Outer, MoveTemp(ForceFeedbackCommandImpl)));
}
return MoveTemp(CommandsQueue);
}
TArray<USGTimedBuzzCommand*> USGHapticGloveCommandBuffer::GetBuzzCommandsQueue(UObject* Outer) const
{
FSGIC_FSGHapticGloveCommandBufferImpl InstanceContainer{ToHapticGloveCommandBufferImpl()};
FSGIC_TArray_FSGTimedBuzzCommandImpl OutBuzzCommandsQueueContainer;
SGCoreImpl_FSGHapticGloveCommandBufferImpl_GetBuzzCommandsQueue(&InstanceContainer, &OutBuzzCommandsQueueContainer);
TArray<USGTimedBuzzCommand*> CommandsQueue;
for (FSGTimedBuzzCommandImpl& TimedBuzzCommandImpl: OutBuzzCommandsQueueContainer.Array)
{
CommandsQueue.Add(USGTimedBuzzCommand::NewTimedBuzzCommand(Outer, MoveTemp(TimedBuzzCommandImpl)));
}
return MoveTemp(CommandsQueue);
}
TArray<USGTimedThumpCommand*> USGHapticGloveCommandBuffer::GetThumperCommandsQueue(UObject* Outer) const
{
FSGIC_FSGHapticGloveCommandBufferImpl InstanceContainer{ToHapticGloveCommandBufferImpl()};
FSGIC_TArray_FSGTimedThumpCommandImpl OutThumperCommandsQueueContainer;
SGCoreImpl_FSGHapticGloveCommandBufferImpl_GetThumperCommandsQueue(&InstanceContainer,
&OutThumperCommandsQueueContainer);
TArray<USGTimedThumpCommand*> CommandsQueue;
for (FSGTimedThumpCommandImpl& TimedThumpCommandImpl: OutThumperCommandsQueueContainer.Array)
{
CommandsQueue.Add(USGTimedThumpCommand::NewTimedThumpCommand(Outer, MoveTemp(TimedThumpCommandImpl)));
}
return MoveTemp(CommandsQueue);
}
void USGHapticGloveCommandBuffer::ClearForceFeedbackCommandsQueue()
{
FSGIC_FSGHapticGloveCommandBufferImpl InstanceContainer{ToHapticGloveCommandBufferImpl()};
SGCoreImpl_FSGHapticGloveCommandBufferImpl_ClearForceFeedbackCommandsQueue(&InstanceContainer);
}
void USGHapticGloveCommandBuffer::ClearVibrations()
{
FSGIC_FSGHapticGloveCommandBufferImpl InstanceContainer{ToHapticGloveCommandBufferImpl()};
SGCoreImpl_FSGHapticGloveCommandBufferImpl_ClearVibrations(&InstanceContainer);
}
void USGHapticGloveCommandBuffer::Clear()
{
FSGIC_FSGHapticGloveCommandBufferImpl InstanceContainer{ToHapticGloveCommandBufferImpl()};
SGCoreImpl_FSGHapticGloveCommandBufferImpl_Clear(&InstanceContainer);
}
void USGHapticGloveCommandBuffer::AddCommand(const USGForceFeedbackCommand* ForceFeedbackCommand)
{
FSGIC_FSGHapticGloveCommandBufferImpl InstanceContainer{ToHapticGloveCommandBufferImpl()};
FSGIC_FSGForceFeedbackCommandImpl ForceFeedbackCommandContainer{
ForceFeedbackCommand->ToForceFeedbackCommandImpl().Get()};
SGCoreImpl_FSGHapticGloveCommandBufferImpl_AddCommand_ForceFeedbackCommand(
&InstanceContainer, &ForceFeedbackCommandContainer);
}
void USGHapticGloveCommandBuffer::AddCommand(const USGTimedBuzzCommand* BuzzCommand)
{
FSGIC_FSGHapticGloveCommandBufferImpl InstanceContainer{ToHapticGloveCommandBufferImpl()};
FSGIC_FSGTimedBuzzCommandImpl BuzzCommandContainer{BuzzCommand->ToTimedBuzzCommandImpl().Get()};
SGCoreImpl_FSGHapticGloveCommandBufferImpl_AddCommand_BuzzCommand(&InstanceContainer, &BuzzCommandContainer);
}
void USGHapticGloveCommandBuffer::AddCommand(const USGTimedThumpCommand* ThumpCommand)
{
FSGIC_FSGHapticGloveCommandBufferImpl InstanceContainer{ToHapticGloveCommandBufferImpl()};
FSGIC_FSGTimedThumpCommandImpl ThumpCommandContainer{ThumpCommand->ToTimedThumpCommandImpl()};
SGCoreImpl_FSGHapticGloveCommandBufferImpl_AddCommand_ThumpCommand(&InstanceContainer, &ThumpCommandContainer);
}
void USGHapticGloveCommandBuffer::UpdateTimedCommands(const float DeltaSeconds)
{
FSGIC_FSGHapticGloveCommandBufferImpl InstanceContainer{ToHapticGloveCommandBufferImpl()};
SGCoreImpl_FSGHapticGloveCommandBufferImpl_UpdateTimedCommands(&InstanceContainer, DeltaSeconds);
}
USGForceFeedbackCommand* USGHapticGloveCommandBuffer::GetTotalForceFeedbackLevels(
UObject* Outer, const USGForceFeedbackCommand* LastForceFeedbackCommand) const
{
FSGIC_FSGHapticGloveCommandBufferImpl InstanceContainer{ToHapticGloveCommandBufferImpl()};
FSGIC_FSGForceFeedbackCommandImpl OutForceFeedbackCommandImplContainer;
FSGIC_FSGForceFeedbackCommandImpl LastForceFeedbackCommandContainer{
LastForceFeedbackCommand->ToForceFeedbackCommandImpl().Get()};
SGCoreImpl_FSGHapticGloveCommandBufferImpl_GetTotalForceFeedbackLevels_LastForceFeedbackCommand(
&InstanceContainer, &OutForceFeedbackCommandImplContainer, &LastForceFeedbackCommandContainer);
return USGForceFeedbackCommand::NewForceFeedbackCommand(
Outer, MoveTemp(OutForceFeedbackCommandImplContainer.ForceFeedbackCommandImpl));
}
USGForceFeedbackCommand* USGHapticGloveCommandBuffer::GetTotalForceFeedbackLevels(UObject* Outer) const
{
FSGIC_FSGHapticGloveCommandBufferImpl InstanceContainer{ToHapticGloveCommandBufferImpl()};
FSGIC_FSGForceFeedbackCommandImpl OutForceFeedbackCommandImplContainer;
SGCoreImpl_FSGHapticGloveCommandBufferImpl_GetTotalForceFeedbackLevels(
&InstanceContainer, &OutForceFeedbackCommandImplContainer);
return USGForceFeedbackCommand::NewForceFeedbackCommand(
Outer, MoveTemp(OutForceFeedbackCommandImplContainer.ForceFeedbackCommandImpl));
}
USGBuzzCommand* USGHapticGloveCommandBuffer::GetTotalBuzzLevels(UObject* Outer) const
{
FSGIC_FSGHapticGloveCommandBufferImpl InstanceContainer{ToHapticGloveCommandBufferImpl()};
FSGIC_FSGBuzzCommandImpl OutBuzzCommandImplContainer;
SGCoreImpl_FSGHapticGloveCommandBufferImpl_GetTotalBuzzLevels(&InstanceContainer, &OutBuzzCommandImplContainer);
return USGBuzzCommand::NewBuzzCommand(Outer, MoveTemp(OutBuzzCommandImplContainer.BuzzCommandImpl));
}
USGThumperCommand* USGHapticGloveCommandBuffer::GetTotalThumperLevels(UObject* Outer) const
{
FSGIC_FSGHapticGloveCommandBufferImpl InstanceContainer{ToHapticGloveCommandBufferImpl()};
FSGIC_FSGThumperCommandImpl OutThumperCommandImplContainer;
SGCoreImpl_FSGHapticGloveCommandBufferImpl_GetTotalThumperLevels(&InstanceContainer,
&OutThumperCommandImplContainer);
return USGThumperCommand::NewThumperCommand(Outer, MoveTemp(OutThumperCommandImplContainer.ThumperCommandImpl));
}
void USGHapticGloveCommandBuffer::FlushHaptics(UObject* Outer,
const USGForceFeedbackCommand* LastBrakeLevel,
USGForceFeedbackCommand*& OutForceFeedbackCommand,
USGBuzzCommand*& OutBuzzCommand,
USGThumperCommand*& OutThumperCommand,
const bool bClearForceFeedbackQueue)
{
FSGIC_FSGHapticGloveCommandBufferImpl InstanceContainer{ToHapticGloveCommandBufferImpl()};
FSGIC_FSGForceFeedbackCommandImpl LastBrakeLevelContainer{LastBrakeLevel->ToForceFeedbackCommandImpl().Get()};
FSGIC_FSGForceFeedbackCommandImpl OutForceFeedbackCommandImplContainer;
FSGIC_FSGBuzzCommandImpl OutBuzzCommandImplContainer;
FSGIC_FSGThumperCommandImpl OutThumperCommandImplContainer;
SGCoreImpl_FSGHapticGloveCommandBufferImpl_FlushHaptics_LastBrakeLevel_OutForceFeedbackCommand_OutBuzzCommand_OutThumperCommand_bClearForceFeedbackQueue(
&InstanceContainer, &LastBrakeLevelContainer, &OutForceFeedbackCommandImplContainer,
&OutBuzzCommandImplContainer, &OutThumperCommandImplContainer, bClearForceFeedbackQueue);
OutForceFeedbackCommand = USGForceFeedbackCommand::NewForceFeedbackCommand(
Outer, MoveTemp(OutForceFeedbackCommandImplContainer.ForceFeedbackCommandImpl));
OutBuzzCommand = USGBuzzCommand::NewBuzzCommand(Outer, MoveTemp(OutBuzzCommandImplContainer.BuzzCommandImpl));
OutThumperCommand = USGThumperCommand::NewThumperCommand(
Outer, MoveTemp(OutThumperCommandImplContainer.ThumperCommandImpl));
}
void USGHapticGloveCommandBuffer::FlushHaptics(UObject* Outer,
const float DeltaSeconds,
const USGForceFeedbackCommand* LastBrakeLevel,
USGForceFeedbackCommand*& OutForceFeedbackCommand,
USGBuzzCommand*& OutBuzzCommand,
USGThumperCommand*& OutThumperCommand)
{
FSGIC_FSGHapticGloveCommandBufferImpl InstanceContainer{ToHapticGloveCommandBufferImpl()};
FSGIC_FSGForceFeedbackCommandImpl LastBrakeLevelContainer{LastBrakeLevel->ToForceFeedbackCommandImpl().Get()};
FSGIC_FSGForceFeedbackCommandImpl OutForceFeedbackCommandImplContainer;
FSGIC_FSGBuzzCommandImpl OutBuzzCommandImplContainer;
FSGIC_FSGThumperCommandImpl OutThumperCommandImplContainer;
SGCoreImpl_FSGHapticGloveCommandBufferImpl_FlushHaptics_DeltaSeconds_LastBrakeLevel_OutForceFeedbackCommand_OutBuzzCommand_OutThumperCommand(
&InstanceContainer, DeltaSeconds, &LastBrakeLevelContainer, &OutForceFeedbackCommandImplContainer,
&OutBuzzCommandImplContainer, &OutThumperCommandImplContainer);
OutForceFeedbackCommand = USGForceFeedbackCommand::NewForceFeedbackCommand(
Outer, MoveTemp(OutForceFeedbackCommandImplContainer.ForceFeedbackCommandImpl));
OutBuzzCommand = USGBuzzCommand::NewBuzzCommand(Outer, MoveTemp(OutBuzzCommandImplContainer.BuzzCommandImpl));
OutThumperCommand = USGThumperCommand::NewThumperCommand(
Outer, MoveTemp(OutThumperCommandImplContainer.ThumperCommandImpl));
}
USGHapticGloveCommandBuffer::FImpl::FImpl(USGHapticGloveCommandBuffer* InOwner)
: Owner(InOwner)
{
}
USGHapticGloveCommandBuffer::FImpl::~FImpl() = default;
void USGHapticGloveCommandBuffer::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -1,144 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGHapticGloveHandProfiles.h"
#include "SGCore/SGHandProfile.h"
#include "SGCore/SGHapticGlove.h"
#include "SGCore/SGSensorRange.h"
#include "SGCoreImpl/SGHapticGloveImpl.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_FSGHandProfileImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGHapticGloveImpl.h"
#include "SGInterop/SGIC_FSGSensorRangeImpl.h"
#include "SGInterop/SGIC_FString.h"
FString FSGHapticGloveHandProfiles::GetProfileDirectory()
{
FSGIC_FString OutDirectoryContainer;
SGCoreImpl_FSGHapticGloveHandProfilesImpl_GetProfileDirectory(&OutDirectoryContainer);
return MoveTemp(OutDirectoryContainer.String);
}
void FSGHapticGloveHandProfiles::SetProfileDirectory(const FString& Directory)
{
FSGIC_FString DirectoryContainer{Directory};
SGCoreImpl_FSGHapticGloveHandProfilesImpl_SetProfileDirectory(&DirectoryContainer);
}
void FSGHapticGloveHandProfiles::GetLeftHandProfile(UObject* Outer, USGHandProfile*& OutHandProfile)
{
FSGIC_FSGHandProfileImpl OutHandProfileImplContainer{OutHandProfile->ToHandProfileImpl()};
SGCoreImpl_FSGHapticGloveHandProfilesImpl_GetLeftHandProfile(&OutHandProfileImplContainer);
OutHandProfile = USGHandProfile::NewHandProfile(Outer, MoveTemp(OutHandProfileImplContainer.HandProfileImpl));
}
void FSGHapticGloveHandProfiles::SetLeftHandProfile(const USGHandProfile* HandProfile)
{
FSGIC_FSGHandProfileImpl HandProfileImplContainer{HandProfile->ToHandProfileImpl()};
SGCoreImpl_FSGHapticGloveHandProfilesImpl_SetLeftHandProfile(&HandProfileImplContainer);
}
void FSGHapticGloveHandProfiles::GetRightHandProfile(UObject* Outer, USGHandProfile*& OutHandProfile)
{
FSGIC_FSGHandProfileImpl OutHandProfileImplContainer;
SGCoreImpl_FSGHapticGloveHandProfilesImpl_GetRightHandProfile(&OutHandProfileImplContainer);
OutHandProfile = USGHandProfile::NewHandProfile(Outer, MoveTemp(OutHandProfileImplContainer.HandProfileImpl));
}
void FSGHapticGloveHandProfiles::SetRightHandProfile(const USGHandProfile* HandProfile)
{
FSGIC_FSGHandProfileImpl HandProfileImplContainer{HandProfile->ToHandProfileImpl()};
SGCoreImpl_FSGHapticGloveHandProfilesImpl_SetRightHandProfile(&HandProfileImplContainer);
}
void FSGHapticGloveHandProfiles::GetProfile(UObject* Outer,
const bool bRightHanded, USGHandProfile*& OutHandProfile)
{
FSGIC_FSGHandProfileImpl OutHandProfileImplContainer;
SGCoreImpl_FSGHapticGloveHandProfilesImpl_GetProfile(bRightHanded, &OutHandProfileImplContainer);
OutHandProfile = USGHandProfile::NewHandProfile(Outer, MoveTemp(OutHandProfileImplContainer.HandProfileImpl));
}
void FSGHapticGloveHandProfiles::SetProfile(const USGHandProfile* HandProfile)
{
FSGIC_FSGHandProfileImpl HandProfileImplContainer{HandProfile->ToHandProfileImpl()};
SGCoreImpl_FSGHapticGloveHandProfilesImpl_SetProfile_HandProfileImpl(&HandProfileImplContainer);
}
void FSGHapticGloveHandProfiles::SetProfile(const USGHandProfile* HandProfile,
const bool bRightHanded)
{
FSGIC_FSGHandProfileImpl HandProfileImplContainer{HandProfile->ToHandProfileImpl()};
SGCoreImpl_FSGHapticGloveHandProfilesImpl_SetProfile_HandProfileImpl_bRightHanded(
&HandProfileImplContainer, bRightHanded);
}
void FSGHapticGloveHandProfiles::RestoreDefaults()
{
SGCoreImpl_FSGHapticGloveHandProfilesImpl_RestoreDefaults();
}
void FSGHapticGloveHandProfiles::RestoreDefaults(const bool bRightHanded)
{
SGCoreImpl_FSGHapticGloveHandProfilesImpl_RestoreDefaults_bRightHanded(bRightHanded);
}
void FSGHapticGloveHandProfiles::TryLoadingFromDisk()
{
SGCoreImpl_FSGHapticGloveHandProfilesImpl_TryLoadingFromDisk();
}
bool FSGHapticGloveHandProfiles::SaveLastRange(
const USGSensorRange* CurrentRange, const USGHapticGlove* ForGlove)
{
FSGIC_FSGSensorRangeImpl CurrentRangeContainer{CurrentRange->ToSensorRangeImpl()};
FSGIC_TSharedPtr_FSGHapticGloveImpl ForGloveContainer{ForGlove->ToHapticGloveImpl()};
return SGCoreImpl_FSGHapticGloveHandProfilesImpl_SaveLastRange(&CurrentRangeContainer, &ForGloveContainer);
}
bool FSGHapticGloveHandProfiles::LoadLastRange(UObject* Outer,
const USGHapticGlove* ForGlove, USGSensorRange*& OutLastRange)
{
FSGIC_TSharedPtr_FSGHapticGloveImpl ForGloveContainer{ForGlove->ToHapticGloveImpl()};
FSGIC_FSGSensorRangeImpl OutLastRangeContainer;
const bool bResult = SGCoreImpl_FSGHapticGloveHandProfilesImpl_LoadLastRange(
&ForGloveContainer, &OutLastRangeContainer);
OutLastRange = USGSensorRange::NewSensorRange(Outer, MoveTemp(OutLastRangeContainer.SensorRangeImpl));
return bResult;
}
@@ -1,236 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGHapticGloveQuickCalibration.h"
#include "SGHapticGloveCalibrationSequenceImplCast.h"
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGHandPose.h"
#include "SGCore/SGHandProfile.h"
#include "SGCore/SGSensorRange.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_FSGHandPoseImpl.h"
#include "SGInterop/SGIC_FSGHandProfileImpl.h"
#include "SGInterop/SGIC_FSGSensorRangeImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_TArray_FVector.h"
#include "SGInterop/SGIC_TSharedPtr_FSGHapticGloveImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl.h"
#include "SGUtils/SGArrayUtils.h"
USGHapticGloveQuickCalibration* USGHapticGloveQuickCalibration::NewHapticGloveQuickCalibration(UObject* Outer,
const FSGHapticGloveQuickCalibrationImpl& HapticGloveQuickCalibration)
{
USGHapticGloveQuickCalibration* Instance = NewObject<USGHapticGloveQuickCalibration>(Outer);
Instance->SetHapticGloveCalibrationSequenceImpl(HapticGloveQuickCalibration);
return Instance;
}
USGHapticGloveQuickCalibration* USGHapticGloveQuickCalibration::NewHapticGloveQuickCalibration(UObject* Outer,
TSharedRef<FSGHapticGloveQuickCalibrationImpl> HapticGloveQuickCalibration)
{
USGHapticGloveQuickCalibration* Instance = NewObject<USGHapticGloveQuickCalibration>(Outer);
Instance->SetHapticGloveCalibrationSequenceImpl(MoveTemp(HapticGloveQuickCalibration));
return Instance;
}
USGHapticGloveQuickCalibration* USGHapticGloveQuickCalibration::NewHapticGloveQuickCalibration(UObject* Outer)
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl OutSharedPtrContainer;
SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_ctor_MakeShared(&OutSharedPtrContainer);
return NewHapticGloveQuickCalibration(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGHapticGloveQuickCalibration* USGHapticGloveQuickCalibration::NewHapticGloveQuickCalibration(UObject* Outer,
const USGHapticGlove* GloveToCalibrate, float AutoEndTimeout)
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl OutSharedPtrContainer;
FSGIC_TSharedPtr_FSGHapticGloveImpl GloveToCalibrateContainer{GloveToCalibrate->ToHapticGloveImpl()};
SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_ctor_GloveToCalibrate_AutoEndTimeout_MakeShared(
&OutSharedPtrContainer, &GloveToCalibrateContainer, AutoEndTimeout);
return NewHapticGloveQuickCalibration(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
float USGHapticGloveQuickCalibration::GetDefaultAutoEndTimeout()
{
return SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_GetDefaultAutoEndTimeout();
}
USGHapticGloveQuickCalibration::USGHapticGloveQuickCalibration()
: USGHapticGloveCalibrationSequence()
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl OutSharedPtrContainer;
SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_ctor_MakeShared(&OutSharedPtrContainer);
SetHapticGloveCalibrationSequenceImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGHapticGloveQuickCalibration::USGHapticGloveQuickCalibration(
const USGHapticGlove* GloveToCalibrate, const float AutoEndTimeout)
: USGHapticGloveCalibrationSequence(GloveToCalibrate)
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl OutSharedPtrContainer;
FSGIC_TSharedPtr_FSGHapticGloveImpl GloveToCalibrateContainer{GloveToCalibrate->ToHapticGloveImpl()};
SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_ctor_GloveToCalibrate_AutoEndTimeout_MakeShared(
&OutSharedPtrContainer, &GloveToCalibrateContainer, AutoEndTimeout);
SetHapticGloveCalibrationSequenceImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGHapticGloveQuickCalibration::USGHapticGloveQuickCalibration(
const FSGHapticGloveQuickCalibrationImpl& HapticGloveQuickCalibrationImpl)
: USGHapticGloveCalibrationSequence(HapticGloveQuickCalibrationImpl)
{
}
USGHapticGloveQuickCalibration::USGHapticGloveQuickCalibration(
TSharedRef<FSGHapticGloveQuickCalibrationImpl> HapticGloveQuickCalibrationImpl)
: USGHapticGloveCalibrationSequence(MoveTemp(HapticGloveQuickCalibrationImpl))
{
}
USGHapticGloveQuickCalibration::~USGHapticGloveQuickCalibration() = default;
TSharedRef<FSGHapticGloveQuickCalibrationImpl> USGHapticGloveQuickCalibration::ToHapticGloveQuickCalibrationImpl() const
{
return FSGHapticGloveCalibrationSequenceImplCast::ToHapticGloveQuickCalibrationImpl(
ToHapticGloveCalibrationSequenceImpl());
}
float USGHapticGloveQuickCalibration::GetAutoEndTimeout() const
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl InstanceContainer{ToHapticGloveQuickCalibrationImpl()};
return SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_GetAutoEndTimeout(&InstanceContainer);
}
int32 USGHapticGloveQuickCalibration::GetSmoothingSamples() const
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl InstanceContainer{ToHapticGloveQuickCalibrationImpl()};
return SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_GetSmoothingSamples(&InstanceContainer);
}
USGSensorRange* USGHapticGloveQuickCalibration::GetSensorRange(UObject* Outer) const
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl InstanceContainer{ToHapticGloveQuickCalibrationImpl()};
FSGIC_FSGSensorRangeImpl OutRangeContainer;
SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_GetSensorRange(&InstanceContainer, &OutRangeContainer);
return USGSensorRange::NewSensorRange(Outer, MoveTemp(OutRangeContainer.SensorRangeImpl));
}
USGHandProfile* USGHapticGloveQuickCalibration::GetTemporaryProfile(UObject* Outer) const
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl InstanceContainer{ToHapticGloveQuickCalibrationImpl()};
FSGIC_FSGHandProfileImpl OutProfileContainer;
SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_GetTemporaryProfile(&InstanceContainer, &OutProfileContainer);
return USGHandProfile::NewHandProfile(Outer, MoveTemp(OutProfileContainer.HandProfileImpl));
}
bool USGHapticGloveQuickCalibration::CanAnimate() const
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl InstanceContainer{ToHapticGloveQuickCalibrationImpl()};
return SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_CanAnimate(&InstanceContainer);
}
bool USGHapticGloveQuickCalibration::AutoCompleted() const
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl InstanceContainer{ToHapticGloveQuickCalibrationImpl()};
return SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_AutoCompleted(&InstanceContainer);
}
void USGHapticGloveQuickCalibration::Reset()
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl InstanceContainer{ToHapticGloveQuickCalibrationImpl()};
SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_Reset(&InstanceContainer);
}
void USGHapticGloveQuickCalibration::Update(const float DeltaSeconds)
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl InstanceContainer{ToHapticGloveQuickCalibrationImpl()};
SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_Update(&InstanceContainer, DeltaSeconds);
}
void USGHapticGloveQuickCalibration::AddDataPoint(const TArray<FVector>& CalibrationPoints)
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl InstanceContainer{ToHapticGloveQuickCalibrationImpl()};
FSGIC_TArray_FVector CalibrationPointsContainer{CalibrationPoints};
SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_AddDataPoint(&InstanceContainer, &CalibrationPointsContainer);
}
void USGHapticGloveQuickCalibration::ConfirmCurrentStep()
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl InstanceContainer{ToHapticGloveQuickCalibrationImpl()};
SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_ConfirmCurrentStep(&InstanceContainer);
}
bool USGHapticGloveQuickCalibration::CompileRange(UObject* Outer, USGSensorRange*& OutSensorRange) const
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl InstanceContainer{ToHapticGloveQuickCalibrationImpl()};
FSGIC_FSGSensorRangeImpl OutSensorRangeContainer;
const bool bResult = SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_CompileRange(
&InstanceContainer, &OutSensorRangeContainer);
OutSensorRange = USGSensorRange::NewSensorRange(Outer, MoveTemp(OutSensorRangeContainer.SensorRangeImpl));
return bResult;
}
bool USGHapticGloveQuickCalibration::GetHandPose(UObject* Outer,
const bool bRightHanded, USGHandPose*& OutCurrentHandPose) const
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl InstanceContainer{ToHapticGloveQuickCalibrationImpl()};
FSGIC_FSGHandPoseImpl OutCurrentHandPoseContainer;
const bool bResult = SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_GetHandPose(
&InstanceContainer, bRightHanded, &OutCurrentHandPoseContainer);
OutCurrentHandPose = USGHandPose::NewHandPose(Outer, MoveTemp(OutCurrentHandPoseContainer.HandPoseImpl));
return bResult;
}
FString USGHapticGloveQuickCalibration::GetCurrentInstruction(const FString& NextStepKey) const
{
FSGIC_TSharedPtr_FSGHapticGloveQuickCalibrationImpl InstanceContainer{ToHapticGloveQuickCalibrationImpl()};
FSGIC_FString OutInstructionContainer;
FSGIC_FString NextStepKeyContainer{NextStepKey};
SGCoreImpl_FSGHapticGloveQuickCalibrationImpl_GetCurrentInstruction(
&InstanceContainer, &OutInstructionContainer, &NextStepKeyContainer);
return MoveTemp(OutInstructionContainer.String);
}
@@ -0,0 +1,730 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGNova2Glove.h"
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGBasicHandModel.h"
#include "SGCore/SGCustomWaveform.h"
#include "SGCore/SGDeviceImplCast.h"
#include "SGCore/SGHandInterpolator.h"
#include "SGCore/SGHandPose.h"
#include "SGCore/SGNovaGloveInfo.h"
#include "SGCore/SGNova2GloveSensorData.h"
#include "SGCore/SGSensorNormalization.h"
#include "SGCore/SGThresholdCommand.h"
#include "SGCoreImpl/SGDeviceImpl.h"
#include "SGCoreImpl/SGHapticGloveImpl.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGCoreImpl/SGNova2GloveImpl.h"
#include "SGInterop/SGIC_ESGDeviceType.h"
#include "SGInterop/SGIC_ESGHapticGloveCalibrationState.h"
#include "SGInterop/SGIC_ESGHapticLocation.h"
#include "SGInterop/SGIC_ESGNova2VibroMotor.h"
#include "SGInterop/SGIC_ESGPositionalTrackingHardware.h"
#include "SGInterop/SGIC_FQuat.h"
#include "SGInterop/SGIC_FSGBasicHandModelImpl.h"
#include "SGInterop/SGIC_FSGCustomWaveformImpl.h"
#include "SGInterop/SGIC_FSGHandInterpolatorImpl.h"
#include "SGInterop/SGIC_FSGHandPoseImpl.h"
#include "SGInterop/SGIC_FSGNova2GloveImpl.h"
#include "SGInterop/SGIC_FSGNovaGloveInfoImpl.h"
#include "SGInterop/SGIC_FSGNova2GloveSensorDataImpl.h"
#include "SGInterop/SGIC_FSGSensorNormalizationImpl.h"
#include "SGInterop/SGIC_FSGThresholdCommandImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_FVector.h"
#include "SGInterop/SGIC_TArray_FSGNova2GloveImpl.h"
#include "SGInterop/SGIC_TArray_FVector.h"
#include "SGInterop/SGIC_TArray_TArray_FVector.h"
#include "SGInterop/SGIC_TArray_float.h"
#include "SGInterop/SGIC_TSharedPtr_FSGNova2GloveImpl.h"
USGNova2Glove* USGNova2Glove::NewNova2Glove(UObject* Outer, const FSGNova2GloveImpl& Nova2GloveImpl)
{
USGNova2Glove* Instance = NewObject<USGNova2Glove>(Outer);
Instance->SetSGDeviceImpl(Nova2GloveImpl);
return Instance;
}
USGNova2Glove* USGNova2Glove::NewNova2Glove(UObject* Outer, TSharedRef<FSGNova2GloveImpl> Nova2GloveImpl)
{
USGNova2Glove* Instance = NewObject<USGNova2Glove>(Outer);
Instance->SetSGDeviceImpl(MoveTemp(Nova2GloveImpl));
return Instance;
}
USGNova2Glove* USGNova2Glove::NewNova2Glove(UObject* Outer)
{
FSGIC_TSharedPtr_FSGNova2GloveImpl OutSharedPtrContainer;
SGCoreImpl_FSGNova2GloveImpl_ctor_MakeShared(&OutSharedPtrContainer);
return NewNova2Glove(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGNova2Glove* USGNova2Glove::NewNova2Glove(UObject* Outer, const USGNovaGloveInfo& DeviceInfo)
{
FSGIC_TSharedPtr_FSGNova2GloveImpl OutSharedPtrContainer;
FSGIC_FSGNovaGloveInfoImpl DeviceInfoContainer{DeviceInfo.ToNovaGloveInfoImpl()};
SGCoreImpl_FSGNova2GloveImpl_ctor_DeviceInfo_MakeShared(&OutSharedPtrContainer, &DeviceInfoContainer);
return NewNova2Glove(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGDevice* USGNova2Glove::Parse(UObject* Outer, const FString& ConstantsString)
{
FSGIC_FSGNova2GloveImpl OutNova2GloveImplContainer;
FSGIC_FString ConstantsStringContainer{ConstantsString};
SGCoreImpl_FSGNova2GloveImpl_Parse(&OutNova2GloveImplContainer, &ConstantsStringContainer);
return NewNova2Glove(Outer, MoveTemp(OutNova2GloveImplContainer.Nova2GloveImpl));
}
TArray<USGNova2Glove*> USGNova2Glove::GetNova2Gloves(UObject* Outer)
{
FSGIC_TArray_FSGNova2GloveImpl OutGlovesContainer;
SGCoreImpl_FSGNova2GloveImpl_GetNova2Gloves(&OutGlovesContainer);
TArray<USGNova2Glove*> Gloves;
for (const FSGNova2GloveImpl& Nova2GloveImpl: OutGlovesContainer.Array)
{
USGNova2Glove* Nova2Glove = USGNova2Glove::NewNova2Glove(Outer, Nova2GloveImpl);
Gloves.Add(Nova2Glove);
}
return MoveTemp(Gloves);
}
bool USGNova2Glove::GetNova2Glove(UObject* Outer, USGNova2Glove*& OutGlove)
{
FSGIC_FSGNova2GloveImpl OutGloveContainer;
const bool bResult = SGCoreImpl_FSGNova2GloveImpl_GetNova2Glove_OutGlove(&OutGloveContainer);
if (bResult)
{
OutGlove = NewNova2Glove(Outer, MoveTemp(OutGloveContainer.Nova2GloveImpl));
}
return bResult;
}
bool USGNova2Glove::GetNova2Glove(UObject* Outer, const bool bRightHanded, USGNova2Glove*& OutGlove)
{
FSGIC_FSGNova2GloveImpl OutGloveContainer;
const bool bResult = SGCoreImpl_FSGNova2GloveImpl_GetNova2Glove_bRightHanded_OutGlove(
bRightHanded, &OutGloveContainer);
if (bResult)
{
OutGlove = NewNova2Glove(Outer, MoveTemp(OutGloveContainer.Nova2GloveImpl));
}
return bResult;
}
void USGNova2Glove::CalculateGloveLocation(
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded, const FString& HardwareVersion,
FVector& OutGlovePosition, FQuat& OutGloveRotation)
{
FSGIC_FVector ReferencePositionContainer{ReferencePosition};
FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation};
FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware};
FSGIC_FString HardwareVersionContainer{HardwareVersion};
FSGIC_FVector OutGlovePositionContainer;
FSGIC_FQuat OutGloveRotationContainer;
SGCoreImpl_FSGNova2GloveImpl_CalculateGloveLocation(
&ReferencePositionContainer, &ReferenceRotationContainer,
&TrackingHardwareContainer, bRightHanded, &HardwareVersionContainer,
&OutGlovePositionContainer, &OutGloveRotationContainer);
OutGlovePosition = MoveTemp(OutGlovePositionContainer.Vector);
OutGloveRotation = MoveTemp(OutGloveRotationContainer.Quat);
}
void USGNova2Glove::CalculateGloveLocation(
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded, const FString& HardwareVersion,
FVector& OutGlovePosition, FRotator& OutGloveRotation)
{
FSGIC_FVector ReferencePositionContainer{ReferencePosition};
FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()};
FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware};
FSGIC_FString HardwareVersionContainer{HardwareVersion};
FSGIC_FVector OutGlovePositionContainer;
FSGIC_FQuat OutGloveRotationContainer;
SGCoreImpl_FSGNova2GloveImpl_CalculateGloveLocation(
&ReferencePositionContainer, &ReferenceRotationContainer,
&TrackingHardwareContainer, bRightHanded, &HardwareVersionContainer,
&OutGlovePositionContainer, &OutGloveRotationContainer);
OutGlovePosition = MoveTemp(OutGlovePositionContainer.Vector);
OutGloveRotation = OutGloveRotationContainer.Quat.Rotator();
}
void USGNova2Glove::CalculateWristLocation(
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded, const FString& HardwareVersion,
FVector& OutWristPosition, FQuat& OutWristRotation)
{
FSGIC_FVector ReferencePositionContainer{ReferencePosition};
FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation};
FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware};
FSGIC_FString HardwareVersionContainer{HardwareVersion};
FSGIC_FVector OutWristPositionContainer;
FSGIC_FQuat OutWristRotationContainer;
SGCoreImpl_FSGNova2GloveImpl_CalculateWristLocation(
&ReferencePositionContainer, &ReferenceRotationContainer,
&TrackingHardwareContainer, bRightHanded, &HardwareVersionContainer,
&OutWristPositionContainer, &OutWristRotationContainer);
OutWristPosition = MoveTemp(OutWristPositionContainer.Vector);
OutWristRotation = MoveTemp(OutWristRotationContainer.Quat);
}
void USGNova2Glove::CalculateWristLocation(
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded, const FString& HardwareVersion,
FVector& OutWristPosition, FRotator& OutWristRotation)
{
FSGIC_FVector ReferencePositionContainer{ReferencePosition};
FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()};
FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware};
FSGIC_FString HardwareVersionContainer{HardwareVersion};
FSGIC_FVector OutWristPositionContainer;
FSGIC_FQuat OutWristRotationContainer;
SGCoreImpl_FSGNova2GloveImpl_CalculateWristLocation(
&ReferencePositionContainer, &ReferenceRotationContainer,
&TrackingHardwareContainer, bRightHanded, &HardwareVersionContainer,
&OutWristPositionContainer, &OutWristRotationContainer);
OutWristPosition = MoveTemp(OutWristPositionContainer.Vector);
OutWristRotation = OutWristRotationContainer.Quat.Rotator();
}
ANSICHAR USGNova2Glove::GetStreamByte()
{
return SGCoreImpl_FSGNova2GloveImpl_GetStreamByte();
}
TArray<float> USGNova2Glove::GetNova2SensorRanges()
{
FSGIC_TArray_float OutNova2SensorRangesContainer;
SGCoreImpl_FSGNova2GloveImpl_GetNova2SensorRanges(&OutNova2SensorRangesContainer);
return MoveTemp(OutNova2SensorRangesContainer.Array);
}
TArray<float> USGNova2Glove::ToNormalizedValues(const USGNova2GloveSensorData* SensorData)
{
FSGIC_TArray_float OutNormalizedValuesContainer;
FSGIC_FSGNova2GloveSensorDataImpl SensorDataContainer{SensorData->ToNova2GloveSensorDataImpl()};
SGCoreImpl_FSGNova2GloveImpl_ToNormalizedValues_SensorData(
&OutNormalizedValuesContainer, &SensorDataContainer);
return MoveTemp(OutNormalizedValuesContainer.Array);
}
TArray<float> USGNova2Glove::ToNormalizedValues(
UObject* Outer, const USGNova2GloveSensorData* SensorData, USGSensorNormalization*& OutSensorNormalizer)
{
FSGIC_TArray_float OutNormalizedValuesContainer;
FSGIC_FSGNova2GloveSensorDataImpl SensorDataContainer{SensorData->ToNova2GloveSensorDataImpl()};
FSGIC_FSGSensorNormalizationImpl OutSensorNormalizerContainer;
SGCoreImpl_FSGNova2GloveImpl_ToNormalizedValues_SensorData_OutSensorNormalizer(
&OutNormalizedValuesContainer, &SensorDataContainer, &OutSensorNormalizerContainer);
OutSensorNormalizer = USGSensorNormalization::NewSensorNormalization(
Outer, MoveTemp(OutSensorNormalizerContainer.SensorNormalizationImpl));
return MoveTemp(OutNormalizedValuesContainer.Array);
}
TArray<TArray<FVector>> USGNova2Glove::CalculateHandAngles(
const TArray<float>& NormalizedValues, const USGHandInterpolator* Interpolator, const bool bInfluenceIndex)
{
FSGIC_TArray_TArray_FVector OutHandAnglesContainer;
FSGIC_TArray_float NormalizedValuesContainer{NormalizedValues};
FSGIC_FSGHandInterpolatorImpl InterpolatorContainer{Interpolator->ToHandInterpolatorImpl()};
SGCoreImpl_FSGNova2GloveImpl_CalculateHandAngles(
&OutHandAnglesContainer, &NormalizedValuesContainer, &InterpolatorContainer, bInfluenceIndex);
return MoveTemp(OutHandAnglesContainer.Array);
}
TArray<TArray<FVector>> USGNova2Glove::ToNormalizedAngles(
const TArray<float>& NormalizedData, const USGNovaGloveInfo* GloveInfo)
{
FSGIC_TArray_TArray_FVector OutHandAnglesContainer;
FSGIC_TArray_float NormalizedDataContainer{NormalizedData};
FSGIC_FSGNovaGloveInfoImpl GloveInfoContainer{GloveInfo->ToNovaGloveInfoImpl()};
SGCoreImpl_FSGNova2GloveImpl_ToNormalizedAngles(
&OutHandAnglesContainer, &NormalizedDataContainer, &GloveInfoContainer);
return MoveTemp(OutHandAnglesContainer.Array);
}
USGNova2Glove::USGNova2Glove()
: USGHapticGlove()
{
FSGIC_TSharedPtr_FSGNova2GloveImpl OutSharedPtrContainer;
SGCoreImpl_FSGNova2GloveImpl_ctor_MakeShared(&OutSharedPtrContainer);
SetSGDeviceImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGNova2Glove::USGNova2Glove(const USGNovaGloveInfo& DeviceInfo)
: USGHapticGlove()
{
FSGIC_TSharedPtr_FSGNova2GloveImpl OutSharedPtrContainer;
FSGIC_FSGNovaGloveInfoImpl DeviceInfoContainer{DeviceInfo.ToNovaGloveInfoImpl()};
SGCoreImpl_FSGNova2GloveImpl_ctor_DeviceInfo_MakeShared(&OutSharedPtrContainer, &DeviceInfoContainer);
SetSGDeviceImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGNova2Glove::USGNova2Glove(const FSGDeviceImpl& SGDeviceImpl)
: USGHapticGlove(SGDeviceImpl)
{
}
USGNova2Glove::USGNova2Glove(const FSGHapticGloveImpl& HapticGloveImpl)
: USGHapticGlove(HapticGloveImpl)
{
}
USGNova2Glove::USGNova2Glove(const FSGNova2GloveImpl& Nova2GloveImpl)
: USGHapticGlove(Nova2GloveImpl)
{
}
USGNova2Glove::USGNova2Glove(const TSharedRef<FSGDeviceImpl> SGDeviceImpl)
: USGHapticGlove(SGDeviceImpl)
{
}
USGNova2Glove::USGNova2Glove(const TSharedRef<FSGHapticGloveImpl> HapticGloveImpl)
: USGHapticGlove(HapticGloveImpl)
{
}
USGNova2Glove::USGNova2Glove(const TSharedRef<FSGNova2GloveImpl> Nova2GloveImpl)
: USGHapticGlove(Nova2GloveImpl)
{
}
USGNova2Glove::~USGNova2Glove() = default;
TSharedRef<FSGNova2GloveImpl> USGNova2Glove::ToNova2GloveImpl() const
{
return FSGDeviceImplCast::ToNova2GloveImpl(ToSGDeviceImpl());
}
ESGDeviceType USGNova2Glove::GetDeviceType() const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_ESGDeviceType OutTypeContainer;
SGCoreImpl_FSGNova2GloveImpl_GetDeviceType(&InstanceContainer, &OutTypeContainer);
return OutTypeContainer.Type;
}
FString USGNova2Glove::GetDeviceId() const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_FString OutIdContainer;
SGCoreImpl_FSGNova2GloveImpl_GetDeviceId(&InstanceContainer, &OutIdContainer);
return MoveTemp(OutIdContainer.String);
}
FString USGNova2Glove::GetHardwareVersion() const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_FString OutVersionContainer;
SGCoreImpl_FSGNova2GloveImpl_GetHardwareVersion(&InstanceContainer, &OutVersionContainer);
return MoveTemp(OutVersionContainer.String);
}
int32 USGNova2Glove::GetFirmwareVersion() const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
return SGCoreImpl_FSGNova2GloveImpl_GetFirmwareVersion(&InstanceContainer);
}
int32 USGNova2Glove::GetSubFirmwareVersion() const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
return SGCoreImpl_FSGNova2GloveImpl_GetSubFirmwareVersion(&InstanceContainer);
}
bool USGNova2Glove::HasBattery() const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
return SGCoreImpl_FSGNova2GloveImpl_HasBattery(&InstanceContainer);
}
bool USGNova2Glove::IsCharging()
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
const bool bResult = SGCoreImpl_FSGNova2GloveImpl_IsCharging(&InstanceContainer);
return bResult;
}
bool USGNova2Glove::GetBatteryLevel(float& OutBatteryLevel)
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
const bool bResult = SGCoreImpl_FSGNova2GloveImpl_GetBatteryLevel(&InstanceContainer, &OutBatteryLevel);
return bResult;
}
bool USGNova2Glove::IsRight() const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
return SGCoreImpl_FSGNova2GloveImpl_IsRight(&InstanceContainer);
}
bool USGNova2Glove::GetImuRotation(FQuat& OutImu)
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_FQuat OutImuContainer;
const bool bResult = SGCoreImpl_FSGNova2GloveImpl_GetImuRotation(&InstanceContainer, &OutImuContainer);
if (bResult)
{
OutImu = MoveTemp(OutImuContainer.Quat);
}
return bResult;
}
bool USGNova2Glove::GetImuRotation(FRotator& OutImu)
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_FQuat OutImuContainer;
const bool bResult = SGCoreImpl_FSGNova2GloveImpl_GetImuRotation(&InstanceContainer, &OutImuContainer);
if (bResult)
{
OutImu = OutImuContainer.Quat.Rotator();
}
return bResult;
}
bool USGNova2Glove::GetHandPose(UObject* Outer, const USGBasicHandModel* HandGeometry, USGHandPose*& OutHandPose) const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_FSGBasicHandModelImpl HandModelContainer{HandGeometry->ToBasicHandModelImpl()};
FSGIC_FSGHandPoseImpl OutHandPoseContainer;
const bool bResult = SGCoreImpl_FSGNova2GloveImpl_GetHandPose(
&InstanceContainer, &HandModelContainer, &OutHandPoseContainer);
if (bResult)
{
OutHandPose = USGHandPose::NewHandPose(Outer, MoveTemp(OutHandPoseContainer.HandPoseImpl));
}
return bResult;
}
bool USGNova2Glove::GetHandAngles(TArray<TArray<FVector>>& OutHandAngles) const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_TArray_TArray_FVector OutHandAnglesContainer;
const bool bResult = SGCoreImpl_FSGNova2GloveImpl_GetHandAngles(&InstanceContainer, &OutHandAnglesContainer);
OutHandAngles = MoveTemp(OutHandAnglesContainer.Array);
return bResult;
}
ESGHapticGloveCalibrationState USGNova2Glove::GetCalibrationState() const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_ESGHapticGloveCalibrationState OutHapticGloveCalibrationStateContainer;
SGCoreImpl_FSGNova2GloveImpl_GetCalibrationState(&InstanceContainer, &OutHapticGloveCalibrationStateContainer);
return MoveTemp(OutHapticGloveCalibrationStateContainer.State);
}
void USGNova2Glove::EndCalibration()
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
SGCoreImpl_FSGNova2GloveImpl_EndCalibration(&InstanceContainer);
}
void USGNova2Glove::ResetCalibration()
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
SGCoreImpl_FSGNova2GloveImpl_ResetCalibration(&InstanceContainer);
}
void USGNova2Glove::StopHaptics()
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
SGCoreImpl_FSGNova2GloveImpl_StopHaptics(&InstanceContainer);
}
void USGNova2Glove::StopVibrations()
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
SGCoreImpl_FSGNova2GloveImpl_StopVibrations(&InstanceContainer);
}
bool USGNova2Glove::SendHaptics()
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
return SGCoreImpl_FSGNova2GloveImpl_SendHaptics(&InstanceContainer);
}
bool USGNova2Glove::SupportsCustomWaveform(ESGHapticLocation AtLocation) const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
return SGCoreImpl_FSGNova2GloveImpl_SendHaptics(&InstanceContainer);
}
bool USGNova2Glove::SendCustomWaveform(USGCustomWaveform* OutWaveform, ESGHapticLocation Location)
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
return SGCoreImpl_FSGNova2GloveImpl_SendHaptics(&InstanceContainer);
}
bool USGNova2Glove::QueueForceFeedbackLevels(const TArray<float>& Levels01)
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_TArray_float Levels01Container{Levels01};
return SGCoreImpl_FSGNova2GloveImpl_QueueForceFeedbackLevels(&InstanceContainer, &Levels01Container);
}
bool USGNova2Glove::QueueForceFeedbackLevel(const int32 Finger, const float Level01)
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
return SGCoreImpl_FSGNova2GloveImpl_QueueForceFeedbackLevel(&InstanceContainer, Finger, Level01);
}
bool USGNova2Glove::QueueSqueezeLevel(const float SqueezeLevel01)
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
return SGCoreImpl_FSGNova2GloveImpl_QueueSqueezeLevel(&InstanceContainer, SqueezeLevel01);
}
void USGNova2Glove::GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware,
FVector& OutGlovePosition, FQuat& OutGloveRotation) const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_FVector ReferencePositionContainer{ReferencePosition};
FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation};
FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware};
FSGIC_FVector OutGlovePositionContainer;
FSGIC_FQuat OutGloveRotationContainer;
SGCoreImpl_FSGNova2GloveImpl_GetGloveLocation(
&InstanceContainer,
&ReferencePositionContainer, &ReferenceRotationContainer,
&TrackingHardwareContainer,
&OutGlovePositionContainer, &OutGloveRotationContainer);
OutGlovePosition = MoveTemp(OutGlovePositionContainer.Vector);
OutGloveRotation = MoveTemp(OutGloveRotationContainer.Quat);
}
void USGNova2Glove::GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware,
FVector& OutGlovePosition, FRotator& OutGloveRotation) const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_FVector ReferencePositionContainer{ReferencePosition};
FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()};
FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware};
FSGIC_FVector OutGlovePositionContainer;
FSGIC_FQuat OutGloveRotationContainer;
SGCoreImpl_FSGNova2GloveImpl_GetGloveLocation(
&InstanceContainer,
&ReferencePositionContainer, &ReferenceRotationContainer,
&TrackingHardwareContainer,
&OutGlovePositionContainer, &OutGloveRotationContainer);
OutGlovePosition = MoveTemp(OutGlovePositionContainer.Vector);
OutGloveRotation = OutGloveRotationContainer.Quat.Rotator();
}
void USGNova2Glove::GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FQuat& OutWristRotation) const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_FVector ReferencePositionContainer{ReferencePosition};
FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation};
FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware};
FSGIC_FVector OutWristPositionContainer;
FSGIC_FQuat OutWristRotationContainer;
SGCoreImpl_FSGNova2GloveImpl_GetWristLocation(
&InstanceContainer,
&ReferencePositionContainer, &ReferenceRotationContainer,
&TrackingHardwareContainer,
&OutWristPositionContainer, &OutWristRotationContainer);
OutWristPosition = MoveTemp(OutWristPositionContainer.Vector);
OutWristRotation = MoveTemp(OutWristRotationContainer.Quat);
}
void USGNova2Glove::GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FRotator& OutWristRotation) const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_FVector ReferencePositionContainer{ReferencePosition};
FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()};
FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware};
FSGIC_FVector OutWristPositionContainer;
FSGIC_FQuat OutWristRotationContainer;
SGCoreImpl_FSGNova2GloveImpl_GetWristLocation(
&InstanceContainer,
&ReferencePositionContainer, &ReferenceRotationContainer,
&TrackingHardwareContainer,
&OutWristPositionContainer, &OutWristRotationContainer);
OutWristPosition = MoveTemp(OutWristPositionContainer.Vector);
OutWristRotation = OutWristRotationContainer.Quat.Rotator();
}
USGNovaGloveInfo* USGNova2Glove::GetGloveInfo(UObject* Outer) const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_FSGNovaGloveInfoImpl OutGloveInfoContainer;
SGCoreImpl_FSGNova2GloveImpl_GetGloveInfo(&InstanceContainer, &OutGloveInfoContainer);
return USGNovaGloveInfo::NewNovaGloveInfo(Outer, MoveTemp(OutGloveInfoContainer.NovaGloveInfoImpl));
}
bool USGNova2Glove::DoesIndexInfluenceOthers() const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
return SGCoreImpl_FSGNova2GloveImpl_DoesIndexInfluenceOthers(&InstanceContainer);
}
void USGNova2Glove::SetIndexInfluencesOthers(const bool bInfluenceOthers)
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
SGCoreImpl_FSGNova2GloveImpl_SetIndexInfluencesOthers(&InstanceContainer, bInfluenceOthers);
}
bool USGNova2Glove::SupportsOnBoardNormalization() const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
return SGCoreImpl_FSGNova2GloveImpl_SupportsOnBoardNormalization(&InstanceContainer);
}
bool USGNova2Glove::GetSensorData(UObject* Outer, USGNova2GloveSensorData*& OutSensorData)
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_FSGNova2GloveSensorDataImpl OutSensorDataContainer;
const bool bResult = SGCoreImpl_FSGNova2GloveImpl_GetSensorData(&InstanceContainer, &OutSensorDataContainer);
if (bResult)
{
OutSensorData = USGNova2GloveSensorData::NewNova2GloveSensorData(
Outer, MoveTemp(OutSensorDataContainer.Nova2GloveSensorDataImpl));
}
return bResult;
}
bool USGNova2Glove::GetNormalizedInput(TArray<float>& OutNormalizedValues) const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_TArray_float OutNormalizedValuesContainer;
const bool bResult = SGCoreImpl_FSGNova2GloveImpl_GetNormalizedInput(
&InstanceContainer, &OutNormalizedValuesContainer);
if (bResult)
{
OutNormalizedValues = MoveTemp(OutNormalizedValuesContainer.Array);
}
return bResult;
}
bool USGNova2Glove::SendRawData()
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
return SGCoreImpl_FSGNova2GloveImpl_SendRawData(&InstanceContainer);
}
bool USGNova2Glove::SendNormalizedData()
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
return SGCoreImpl_FSGNova2GloveImpl_SendNormalizedData(&InstanceContainer);
}
ESGNova2VibroMotor USGNova2Glove::ToNovaMotor(const ESGHapticLocation Location) const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_ESGNova2VibroMotor OutVibroMotorContainer;
FSGIC_ESGHapticLocation LocationContainer{Location};
SGCoreImpl_FSGNova2GloveImpl_ToNovaMotor(&InstanceContainer, &OutVibroMotorContainer, &LocationContainer);
return OutVibroMotorContainer.Motor;
}
int32 USGNova2Glove::ChannelIndex(const ESGNova2VibroMotor Motor) const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_ESGNova2VibroMotor MotorContainer{Motor};
return SGCoreImpl_FSGNova2GloveImpl_ChannelIndex(&InstanceContainer, &MotorContainer);
}
void USGNova2Glove::ValidateWaveform(USGCustomWaveform* OutWaveform, const ESGNova2VibroMotor Motor) const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_FSGCustomWaveformImpl OutWaveformContainer{OutWaveform->ToCustomWaveformImpl()};
FSGIC_ESGNova2VibroMotor MotorContainer{Motor};
SGCoreImpl_FSGNova2GloveImpl_ValidateWaveform(&InstanceContainer, &OutWaveformContainer, &MotorContainer);
}
bool USGNova2Glove::SendCustomWaveform_Nova2(
USGCustomWaveform* OutWaveform, const ESGNova2VibroMotor Motor, const bool bValidateWaveform)
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_FSGCustomWaveformImpl OutWaveformContainer{OutWaveform->ToCustomWaveformImpl()};
FSGIC_ESGNova2VibroMotor MotorContainer{Motor};
return SGCoreImpl_FSGNova2GloveImpl_SendCustomWaveform_Nova2(
&InstanceContainer, &OutWaveformContainer, &MotorContainer, bValidateWaveform);
}
FString USGNova2Glove::ToString() const
{
FSGIC_TSharedPtr_FSGNova2GloveImpl InstanceContainer{ToNova2GloveImpl()};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGNova2GloveImpl_ToString(&InstanceContainer, &OutStringContainer);
return MoveTemp(OutStringContainer.String);;
}
@@ -0,0 +1,379 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGNova2GloveSensorData.h"
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGNovaGloveInfo.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGCoreImpl/SGNova2GloveSensorDataImpl.h"
#include "SGInterop/SGIC_ESGFinger.h"
#include "SGInterop/SGIC_ESGNormalizationState.h"
#include "SGInterop/SGIC_ESGNova2SensorLocation.h"
#include "SGInterop/SGIC_FQuat.h"
#include "SGInterop/SGIC_FSGNova2GloveSensorDataImpl.h"
#include "SGInterop/SGIC_FSGNovaGloveInfoImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_TArray_TArray_FVector.h"
#include "SGUtils/SGArrayUtils.h"
struct USGNova2GloveSensorData::FImpl
{
/************************
* Member variables
************************/
FSGNova2GloveSensorDataImpl Nova2GloveSensorDataImpl;
/************************
* Owner object
************************/
USGNova2GloveSensorData* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGNova2GloveSensorData* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGNova2GloveSensorData* USGNova2GloveSensorData::NewNova2GloveSensorData(
UObject* Outer, const FSGNova2GloveSensorDataImpl& Nova2GloveSensorDataImpl)
{
USGNova2GloveSensorData* Instance = NewObject<USGNova2GloveSensorData>(Outer);
Instance->SetNova2GloveSensorDataImpl(Nova2GloveSensorDataImpl);
return Instance;
}
USGNova2GloveSensorData* USGNova2GloveSensorData::NewNova2GloveSensorData(UObject* Outer)
{
FSGIC_FSGNova2GloveSensorDataImpl OutNova2GloveSensorDataImplContainer;
SGCoreImpl_FSGNova2GloveSensorDataImpl_ctor(&OutNova2GloveSensorDataImplContainer);
return NewNova2GloveSensorData(Outer, MoveTemp(OutNova2GloveSensorDataImplContainer.Nova2GloveSensorDataImpl));
}
USGNova2GloveSensorData* USGNova2GloveSensorData::NewNova2GloveSensorData(
UObject* Outer, const ESGNormalizationState NormalizationState,
const TArray<TArray<FVector>>& Values, const int32 ParsedValues,
const FQuat& ImuRotation, const bool bImuParsed,
const float BatteryLevel, const bool bCharging)
{
FSGIC_FSGNova2GloveSensorDataImpl OutNova2GloveSensorDataImplContainer;
FSGIC_ESGNormalizationState NormalizationStateContainer{NormalizationState};
FSGIC_TArray_TArray_FVector ValuesContainer{Values};
FSGIC_FQuat ImuRotationContainer{ImuRotation};
SGCoreImpl_FSGNova2GloveSensorDataImpl_ctor_NormalizationState_Values_ParsedValues_ImuRotation_bImuParsed_BatteryLevel_bCharging(
&OutNova2GloveSensorDataImplContainer, &NormalizationStateContainer,
&ValuesContainer, ParsedValues,
&ImuRotationContainer, bImuParsed, BatteryLevel, bCharging);
return NewNova2GloveSensorData(Outer, MoveTemp(OutNova2GloveSensorDataImplContainer.Nova2GloveSensorDataImpl));
}
USGNova2GloveSensorData* USGNova2GloveSensorData::NewNova2GloveSensorData(
UObject* Outer, const ESGNormalizationState NormalizationState,
const TArray<FSGVectorArray>& Values, const int32 ParsedValues,
const FQuat& ImuRotation, const bool bImuParsed, const float BatteryLevel, const bool bCharging)
{
FSGIC_FSGNova2GloveSensorDataImpl OutNova2GloveSensorDataImplContainer;
FSGIC_ESGNormalizationState NormalizationStateContainer{NormalizationState};
FSGIC_TArray_TArray_FVector ValuesContainer{
FSGArrayUtils::FromNestedBPArray<FVector, FSGVectorArray, &FSGVectorArray::VectorArray>(Values)
};
FSGIC_FQuat ImuRotationContainer{ImuRotation};
SGCoreImpl_FSGNova2GloveSensorDataImpl_ctor_NormalizationState_Values_ParsedValues_ImuRotation_bImuParsed_BatteryLevel_bCharging(
&OutNova2GloveSensorDataImplContainer, &NormalizationStateContainer,
&ValuesContainer, ParsedValues,
&ImuRotationContainer, bImuParsed, BatteryLevel, bCharging);
return NewNova2GloveSensorData(Outer, MoveTemp(OutNova2GloveSensorDataImplContainer.Nova2GloveSensorDataImpl));
}
USGNova2GloveSensorData* USGNova2GloveSensorData::NewNova2GloveSensorData(
UObject* Outer, const ESGNormalizationState NormalizationState,
const TArray<TArray<FVector>>& Values, const int32 ParsedValues,
const FRotator& ImuRotation, const bool bImuParsed, const float BatteryLevel, const bool bCharging)
{
FSGIC_FSGNova2GloveSensorDataImpl OutNova2GloveSensorDataImplContainer;
FSGIC_ESGNormalizationState NormalizationStateContainer{NormalizationState};
FSGIC_TArray_TArray_FVector ValuesContainer{Values};
FSGIC_FQuat ImuRotationContainer{ImuRotation.Quaternion()};
SGCoreImpl_FSGNova2GloveSensorDataImpl_ctor_NormalizationState_Values_ParsedValues_ImuRotation_bImuParsed_BatteryLevel_bCharging(
&OutNova2GloveSensorDataImplContainer, &NormalizationStateContainer,
&ValuesContainer, ParsedValues,
&ImuRotationContainer, bImuParsed, BatteryLevel, bCharging);
return NewNova2GloveSensorData(Outer, MoveTemp(OutNova2GloveSensorDataImplContainer.Nova2GloveSensorDataImpl));
}
USGNova2GloveSensorData* USGNova2GloveSensorData::NewNova2GloveSensorData(
UObject* Outer, const ESGNormalizationState NormalizationState,
const TArray<FSGVectorArray>& Values, const int32 ParsedValues,
const FRotator& ImuRotation, const bool bImuParsed, const float BatteryLevel, const bool bCharging)
{
FSGIC_FSGNova2GloveSensorDataImpl OutNova2GloveSensorDataImplContainer;
FSGIC_ESGNormalizationState NormalizationStateContainer{NormalizationState};
FSGIC_TArray_TArray_FVector ValuesContainer{
FSGArrayUtils::FromNestedBPArray<FVector, FSGVectorArray, &FSGVectorArray::VectorArray>(Values)
};
FSGIC_FQuat ImuRotationContainer{ImuRotation.Quaternion()};
SGCoreImpl_FSGNova2GloveSensorDataImpl_ctor_NormalizationState_Values_ParsedValues_ImuRotation_bImuParsed_BatteryLevel_bCharging(
&OutNova2GloveSensorDataImplContainer, &NormalizationStateContainer,
&ValuesContainer, ParsedValues,
&ImuRotationContainer, bImuParsed, BatteryLevel, bCharging);
return NewNova2GloveSensorData(Outer, MoveTemp(OutNova2GloveSensorDataImplContainer.Nova2GloveSensorDataImpl));
}
USGNova2GloveSensorData* USGNova2GloveSensorData::Parse(UObject* Outer,
const FString& RawData, const USGNovaGloveInfo* GloveInfo)
{
FSGIC_FSGNova2GloveSensorDataImpl OutNova2GloveSensorDataImplContainer;
FSGIC_FString RawDataString{RawData};
FSGIC_FSGNovaGloveInfoImpl GloveInfoContainer{GloveInfo->ToNovaGloveInfoImpl()};
SGCoreImpl_FSGNova2GloveSensorDataImpl_Parse(&OutNova2GloveSensorDataImplContainer,
&RawDataString, &GloveInfoContainer);
return NewNova2GloveSensorData(Outer, MoveTemp(OutNova2GloveSensorDataImplContainer.Nova2GloveSensorDataImpl));
}
USGNova2GloveSensorData::USGNova2GloveSensorData()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGNova2GloveSensorDataImpl OutNova2GloveSensorDataImplContainer;
SGCoreImpl_FSGNova2GloveSensorDataImpl_ctor(&OutNova2GloveSensorDataImplContainer);
Pimpl->Nova2GloveSensorDataImpl = MoveTemp(OutNova2GloveSensorDataImplContainer.Nova2GloveSensorDataImpl);
}
USGNova2GloveSensorData::USGNova2GloveSensorData(const ESGNormalizationState NormalizationState,
const TArray<TArray<FVector>>& Values, const int32 ParsedValues,
const FQuat& ImuRotation, const bool bImuParsed,
const float BatteryLevel, const bool bCharging)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGNova2GloveSensorDataImpl OutNova2GloveSensorDataImplContainer;
FSGIC_ESGNormalizationState NormalizationStateContainer{NormalizationState};
FSGIC_TArray_TArray_FVector ValuesContainer{Values};
FSGIC_FQuat ImuRotationContainer{ImuRotation};
SGCoreImpl_FSGNova2GloveSensorDataImpl_ctor_NormalizationState_Values_ParsedValues_ImuRotation_bImuParsed_BatteryLevel_bCharging(
&OutNova2GloveSensorDataImplContainer, &NormalizationStateContainer,
&ValuesContainer, ParsedValues,
&ImuRotationContainer, bImuParsed, BatteryLevel, bCharging);
Pimpl->Nova2GloveSensorDataImpl = MoveTemp(OutNova2GloveSensorDataImplContainer.Nova2GloveSensorDataImpl);
}
USGNova2GloveSensorData::USGNova2GloveSensorData(const ESGNormalizationState NormalizationState,
const TArray<FSGVectorArray>& Values, const int32 ParsedValues,
const FQuat& ImuRotation, const bool bImuParsed,
const float BatteryLevel, const bool bCharging)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGNova2GloveSensorDataImpl OutNova2GloveSensorDataImplContainer;
FSGIC_ESGNormalizationState NormalizationStateContainer{NormalizationState};
FSGIC_TArray_TArray_FVector ValuesContainer{
FSGArrayUtils::FromNestedBPArray<FVector, FSGVectorArray, &FSGVectorArray::VectorArray>(Values)
};
FSGIC_FQuat ImuRotationContainer{ImuRotation};
SGCoreImpl_FSGNova2GloveSensorDataImpl_ctor_NormalizationState_Values_ParsedValues_ImuRotation_bImuParsed_BatteryLevel_bCharging(
&OutNova2GloveSensorDataImplContainer, &NormalizationStateContainer,
&ValuesContainer, ParsedValues,
&ImuRotationContainer, bImuParsed, BatteryLevel, bCharging);
Pimpl->Nova2GloveSensorDataImpl = MoveTemp(OutNova2GloveSensorDataImplContainer.Nova2GloveSensorDataImpl);
}
USGNova2GloveSensorData::USGNova2GloveSensorData(const ESGNormalizationState NormalizationState,
const TArray<TArray<FVector>>& Values, const int32 ParsedValues,
const FRotator& ImuRotation, const bool bImuParsed,
const float BatteryLevel, const bool bCharging)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGNova2GloveSensorDataImpl OutNova2GloveSensorDataImplContainer;
FSGIC_ESGNormalizationState NormalizationStateContainer{NormalizationState};
FSGIC_TArray_TArray_FVector ValuesContainer{Values};
FSGIC_FQuat ImuRotationContainer{ImuRotation.Quaternion()};
SGCoreImpl_FSGNova2GloveSensorDataImpl_ctor_NormalizationState_Values_ParsedValues_ImuRotation_bImuParsed_BatteryLevel_bCharging(
&OutNova2GloveSensorDataImplContainer, &NormalizationStateContainer,
&ValuesContainer, ParsedValues,
&ImuRotationContainer, bImuParsed, BatteryLevel, bCharging);
Pimpl->Nova2GloveSensorDataImpl = MoveTemp(OutNova2GloveSensorDataImplContainer.Nova2GloveSensorDataImpl);
}
USGNova2GloveSensorData::USGNova2GloveSensorData(const ESGNormalizationState NormalizationState,
const TArray<FSGVectorArray>& Values, const int32 ParsedValues,
const FRotator& ImuRotation, const bool bImuParsed,
const float BatteryLevel, const bool bCharging)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGNova2GloveSensorDataImpl OutNova2GloveSensorDataImplContainer;
FSGIC_ESGNormalizationState NormalizationStateContainer{NormalizationState};
FSGIC_TArray_TArray_FVector ValuesContainer{
FSGArrayUtils::FromNestedBPArray<FVector, FSGVectorArray, &FSGVectorArray::VectorArray>(Values)
};
FSGIC_FQuat ImuRotationContainer{ImuRotation.Quaternion()};
SGCoreImpl_FSGNova2GloveSensorDataImpl_ctor_NormalizationState_Values_ParsedValues_ImuRotation_bImuParsed_BatteryLevel_bCharging(
&OutNova2GloveSensorDataImplContainer, &NormalizationStateContainer,
&ValuesContainer, ParsedValues,
&ImuRotationContainer, bImuParsed, BatteryLevel, bCharging);
Pimpl->Nova2GloveSensorDataImpl = MoveTemp(OutNova2GloveSensorDataImplContainer.Nova2GloveSensorDataImpl);
}
USGNova2GloveSensorData::USGNova2GloveSensorData(const FSGNova2GloveSensorDataImpl& Nova2GloveSensorDataImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
SetNova2GloveSensorDataImpl(Nova2GloveSensorDataImpl);
}
USGNova2GloveSensorData::~USGNova2GloveSensorData() = default;
void USGNova2GloveSensorData::SetNova2GloveSensorDataImpl(const FSGNova2GloveSensorDataImpl& Nova2GloveSensorDataImpl)
{
FSGIC_FSGNova2GloveSensorDataImpl OutNova2GloveSensorDataContainer;
FSGIC_FSGNova2GloveSensorDataImpl RhsContainer{Nova2GloveSensorDataImpl};
SGCoreImpl_FSGNova2GloveSensorDataImpl_ctor_copy(&OutNova2GloveSensorDataContainer, &RhsContainer);
Pimpl->Nova2GloveSensorDataImpl = MoveTemp(OutNova2GloveSensorDataContainer.Nova2GloveSensorDataImpl);
}
const FSGNova2GloveSensorDataImpl& USGNova2GloveSensorData::ToNova2GloveSensorDataImpl() const
{
return Pimpl->Nova2GloveSensorDataImpl;
}
ESGNormalizationState USGNova2GloveSensorData::GetSensorState() const
{
FSGIC_FSGNova2GloveSensorDataImpl InstanceContainer{ToNova2GloveSensorDataImpl()};
FSGIC_ESGNormalizationState OutNormalizationState;
SGCoreImpl_FSGNova2GloveSensorDataImpl_GetSensorState(&InstanceContainer, &OutNormalizationState);
return OutNormalizationState.State;
}
TArray<TArray<FVector>> USGNova2GloveSensorData::GetSensorValues() const
{
FSGIC_FSGNova2GloveSensorDataImpl InstanceContainer{ToNova2GloveSensorDataImpl()};
FSGIC_TArray_TArray_FVector OutValuesContainer;
SGCoreImpl_FSGNova2GloveSensorDataImpl_GetSensorValues(&InstanceContainer, &OutValuesContainer);
return MoveTemp(OutValuesContainer.Array);
}
float USGNova2GloveSensorData::GetSensorValue(const ESGFinger Finger, const ESGNova2SensorLocation Location) const
{
FSGIC_FSGNova2GloveSensorDataImpl InstanceContainer{ToNova2GloveSensorDataImpl()};
FSGIC_ESGFinger FingerContainer{Finger};
FSGIC_ESGNova2SensorLocation LocationContainer{Location};
return SGCoreImpl_FSGNova2GloveSensorDataImpl_GetSensorValue(
&InstanceContainer, &FingerContainer, &LocationContainer);
}
int32 USGNova2GloveSensorData::GetParsedValues() const
{
FSGIC_FSGNova2GloveSensorDataImpl InstanceContainer{ToNova2GloveSensorDataImpl()};
return SGCoreImpl_FSGNova2GloveSensorDataImpl_GetParsedValues(&InstanceContainer);
}
FQuat USGNova2GloveSensorData::GetImuRotationQ() const
{
FSGIC_FSGNova2GloveSensorDataImpl InstanceContainer{ToNova2GloveSensorDataImpl()};
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGNova2GloveSensorDataImpl_GetImuRotation(&InstanceContainer, &OutRotationContainer);
return MoveTemp(OutRotationContainer.Quat);
}
FRotator USGNova2GloveSensorData::GetImuRotation() const
{
FSGIC_FSGNova2GloveSensorDataImpl InstanceContainer{ToNova2GloveSensorDataImpl()};
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGNova2GloveSensorDataImpl_GetImuRotation(&InstanceContainer, &OutRotationContainer);
return OutRotationContainer.Quat.Rotator();
}
bool USGNova2GloveSensorData::IsImuParsed() const
{
FSGIC_FSGNova2GloveSensorDataImpl InstanceContainer{ToNova2GloveSensorDataImpl()};
return SGCoreImpl_FSGNova2GloveSensorDataImpl_IsImuParsed(&InstanceContainer);
}
float USGNova2GloveSensorData::GetBatteryLevel() const
{
FSGIC_FSGNova2GloveSensorDataImpl InstanceContainer{ToNova2GloveSensorDataImpl()};
return SGCoreImpl_FSGNova2GloveSensorDataImpl_GetBatteryLevel(&InstanceContainer);
}
bool USGNova2GloveSensorData::IsCharging() const
{
FSGIC_FSGNova2GloveSensorDataImpl InstanceContainer{ToNova2GloveSensorDataImpl()};
return SGCoreImpl_FSGNova2GloveSensorDataImpl_IsCharging(&InstanceContainer);
}
bool USGNova2GloveSensorData::Equals(const USGNova2GloveSensorData* Nova2GloveSensorData) const
{
FSGIC_FSGNova2GloveSensorDataImpl InstanceContainer{ToNova2GloveSensorDataImpl()};
FSGIC_FSGNova2GloveSensorDataImpl Nova2GloveSensorDataContainer{Nova2GloveSensorData->ToNova2GloveSensorDataImpl()};
return SGCoreImpl_FSGNova2GloveSensorDataImpl_Equals(&InstanceContainer, &Nova2GloveSensorDataContainer);
}
FString USGNova2GloveSensorData::ToString() const
{
FSGIC_FSGNova2GloveSensorDataImpl InstanceContainer{ToNova2GloveSensorDataImpl()};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGNova2GloveSensorDataImpl_ToString(&InstanceContainer, &OutStringContainer);
return MoveTemp(OutStringContainer.String);
}
USGNova2GloveSensorData::FImpl::FImpl(USGNova2GloveSensorData* InOwner)
: Owner(InOwner)
{
}
USGNova2GloveSensorData::FImpl::~FImpl() = default;
void USGNova2GloveSensorData::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -38,36 +38,39 @@
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGBasicHandModel.h"
#include "SGCore/SGBuzzCommand.h"
#include "SGCore/SGCustomWaveform.h"
#include "SGCore/SGDeviceImplCast.h"
#include "SGCore/SGForceFeedbackCommand.h"
#include "SGCore/SGHandInterpolator.h"
#include "SGCore/SGHandPose.h"
#include "SGCore/SGHandProfile.h"
#include "SGCore/SGNovaGloveHandProfile.h"
#include "SGCore/SGNovaGloveInfo.h"
#include "SGCore/SGNovaGloveSensorData.h"
#include "SGCore/SGThumperCommand.h"
#include "SGCore/SGSensorNormalization.h"
#include "SGCore/SGThresholdCommand.h"
#include "SGCoreImpl/SGDeviceImpl.h"
#include "SGCoreImpl/SGHapticGloveImpl.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGCoreImpl/SGNovaGloveImpl.h"
#include "SGInterop/SGIC_ESGDeviceType.h"
#include "SGInterop/SGIC_ESGHapticGloveCalibrationState.h"
#include "SGInterop/SGIC_ESGHapticLocation.h"
#include "SGInterop/SGIC_ESGNovaVibroMotor.h"
#include "SGInterop/SGIC_ESGPositionalTrackingHardware.h"
#include "SGInterop/SGIC_FQuat.h"
#include "SGInterop/SGIC_FSGBasicHandModelImpl.h"
#include "SGInterop/SGIC_FSGBuzzCommandImpl.h"
#include "SGInterop/SGIC_FSGForceFeedbackCommandImpl.h"
#include "SGInterop/SGIC_FSGCustomWaveformImpl.h"
#include "SGInterop/SGIC_FSGHandInterpolatorImpl.h"
#include "SGInterop/SGIC_FSGHandPoseImpl.h"
#include "SGInterop/SGIC_FSGHandProfileImpl.h"
#include "SGInterop/SGIC_FSGNovaGloveHandProfileImpl.h"
#include "SGInterop/SGIC_FSGNovaGloveImpl.h"
#include "SGInterop/SGIC_FSGNovaGloveInfoImpl.h"
#include "SGInterop/SGIC_FSGNovaGloveSensorDataImpl.h"
#include "SGInterop/SGIC_FSGThumperCommandImpl.h"
#include "SGInterop/SGIC_FSGSensorNormalizationImpl.h"
#include "SGInterop/SGIC_FSGThresholdCommandImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_FVector.h"
#include "SGInterop/SGIC_TArray_FSGNovaGloveImpl.h"
#include "SGInterop/SGIC_TArray_FVector.h"
#include "SGInterop/SGIC_TArray_TArray_FVector.h"
#include "SGInterop/SGIC_TArray_float.h"
#include "SGInterop/SGIC_TSharedPtr_FSGNovaGloveImpl.h"
USGNovaGlove* USGNovaGlove::NewNovaGlove(UObject* Outer, const FSGNovaGloveImpl& NovaGloveImpl)
@@ -101,33 +104,6 @@ USGNovaGlove* USGNovaGlove::NewNovaGlove(UObject* Outer, const USGNovaGloveInfo&
return NewNovaGlove(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
ANSICHAR USGNovaGlove::GetHapticsByte()
{
return SGCoreImpl_FSGNovaGloveImpl_GetHapticsByte();
}
FVector USGNovaGlove::GetMinCalibrationRange()
{
FSGIC_FVector OutRangeContainer;
SGCoreImpl_FSGNovaGloveImpl_GetMinCalibrationRange(&OutRangeContainer);
return MoveTemp(OutRangeContainer.Vector);
}
USGHandPose* USGNovaGlove::CalculateHandPose(UObject* Outer,
const USGBasicHandModel* HandModel,
const USGNovaGloveSensorData* NovaData,
const USGNovaGloveHandProfile* Profile)
{
FSGIC_FSGHandPoseImpl OutPoseContainer;
FSGIC_FSGBasicHandModelImpl HandModelContainer{HandModel->ToBasicHandModelImpl()};
FSGIC_FSGNovaGloveSensorDataImpl NovaDataContainer{NovaData->ToNovaGloveSensorDataImpl()};
FSGIC_FSGNovaGloveHandProfileImpl ProfileContainer{Profile->ToNovaGloveHandProfileImpl()};
SGCoreImpl_FSGNovaGloveImpl_CalculateHandPose(
&OutPoseContainer, &HandModelContainer, &NovaDataContainer, &ProfileContainer);
return USGHandPose::NewHandPose(Outer, MoveTemp(OutPoseContainer.HandPoseImpl));
}
USGDevice* USGNovaGlove::Parse(UObject* Outer, const FString& ConstantsString)
{
FSGIC_FSGNovaGloveImpl OutNovaGloveImplContainer;
@@ -177,30 +153,10 @@ bool USGNovaGlove::GetNovaGlove(UObject* Outer, const bool bRightHanded, USGNova
return bResult;
}
TArray<FVector> USGNovaGlove::GetCalibrationValues(const USGNovaGloveSensorData* SensorData)
{
FSGIC_TArray_FVector OutValuesContainer;
FSGIC_FSGNovaGloveSensorDataImpl SensorDataContainer{SensorData->ToNovaGloveSensorDataImpl()};
SGCoreImpl_FSGNovaGloveImpl_GetCalibrationValues_SensorData(&OutValuesContainer, &SensorDataContainer);
return MoveTemp(OutValuesContainer.Array);
}
void USGNovaGlove::CalibrateInterpolation(UObject* Outer,
const TArray<FVector>& MinValues, const TArray<FVector>& MaxValues,
USGNovaGloveHandProfile*& OutProfile)
{
FSGIC_TArray_FVector MinValuesContainer{MinValues};
FSGIC_TArray_FVector MaxValuesContainer{MaxValues};
FSGIC_FSGNovaGloveHandProfileImpl OutProfileContainer;
SGCoreImpl_FSGNovaGloveImpl_CalibrateInterpolation(
&MinValuesContainer, &MaxValuesContainer, &OutProfileContainer);
OutProfile = USGNovaGloveHandProfile::NewNovaGloveHandProfile(
Outer, MoveTemp(OutProfileContainer.NovaGloveHandProfileImpl));
}
void USGNovaGlove::CalculateGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded,
FVector& OutGlovePosition, FQuat& OutGloveRotation)
void USGNovaGlove::CalculateGloveLocation(
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded,
FVector& OutGlovePosition, FQuat& OutGloveRotation)
{
FSGIC_FVector ReferencePositionContainer{ReferencePosition};
FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation};
@@ -217,9 +173,10 @@ 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)
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()};
@@ -236,9 +193,10 @@ void USGNovaGlove::CalculateGloveLocation(const FVector& ReferencePosition, cons
OutGloveRotation = OutGloveRotationContainer.Quat.Rotator();
}
void USGNovaGlove::CalculateWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded,
FVector& OutWristPosition, FQuat& OutWristRotation)
void USGNovaGlove::CalculateWristLocation(
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware, const bool bRightHanded,
FVector& OutWristPosition, FQuat& OutWristRotation)
{
FSGIC_FVector ReferencePositionContainer{ReferencePosition};
FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation};
@@ -255,9 +213,10 @@ 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)
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()};
@@ -274,29 +233,80 @@ void USGNovaGlove::CalculateWristLocation(const FVector& ReferencePosition, cons
OutWristRotation = OutWristRotationContainer.Quat.Rotator();
}
FString USGNovaGlove::ToBytes(const USGThumperCommand* ThumperCommand)
ANSICHAR USGNovaGlove::GetHapticsByte()
{
FSGIC_FSGThumperCommandImpl ThumperCommandContainer{ThumperCommand->ToThumperCommandImpl()};
FSGIC_FString OutBytesContainer;
SGCoreImpl_FSGNovaGloveImpl_ToBytes_ThumperCommand(&OutBytesContainer, &ThumperCommandContainer);
return MoveTemp(OutBytesContainer.String);;
return SGCoreImpl_FSGNovaGloveImpl_GetHapticsByte();
}
FString USGNovaGlove::ToBytes(const USGForceFeedbackCommand* ForceFeedbackCommand)
ANSICHAR USGNovaGlove::GetThresholdsByte()
{
FSGIC_FSGForceFeedbackCommandImpl ForceFeedbackCommandContainer{
ForceFeedbackCommand->ToForceFeedbackCommandImpl().Get()};
FSGIC_FString OutBytesContainer;
SGCoreImpl_FSGNovaGloveImpl_ToBytes_ForceFeedbackCommand(&OutBytesContainer, &ForceFeedbackCommandContainer);
return MoveTemp(OutBytesContainer.String);;
return SGCoreImpl_FSGNovaGloveImpl_GetThresholdsByte();
}
FString USGNovaGlove::ToBytes(const USGBuzzCommand* BuzzCommand)
ANSICHAR USGNovaGlove::GetIgnoreThresholdsByte()
{
FSGIC_FSGBuzzCommandImpl BuzzCommandContainer{BuzzCommand->ToBuzzCommandImpl().Get()};
FSGIC_FString OutBytesContainer;
SGCoreImpl_FSGNovaGloveImpl_ToBytes_BuzzCommand(&OutBytesContainer, &BuzzCommandContainer);
return MoveTemp(OutBytesContainer.String);;
return SGCoreImpl_FSGNovaGloveImpl_GetIgnoreThresholdsByte();
}
TArray<float> USGNovaGlove::GetNovaSensorRanges()
{
FSGIC_TArray_float OutNovaSensorRangesContainer;
SGCoreImpl_FSGNovaGloveImpl_GetNovaSensorRanges(&OutNovaSensorRangesContainer);
return MoveTemp(OutNovaSensorRangesContainer.Array);
}
TArray<float> USGNovaGlove::ToNormalizedValues(const USGNovaGloveSensorData* SensorData)
{
FSGIC_TArray_float OutNormalizedValuesContainer;
FSGIC_FSGNovaGloveSensorDataImpl SensorDataContainer{SensorData->ToNovaGloveSensorDataImpl()};
SGCoreImpl_FSGNovaGloveImpl_ToNormalizedValues_SensorData(
&OutNormalizedValuesContainer, &SensorDataContainer);
return MoveTemp(OutNormalizedValuesContainer.Array);
}
TArray<float> USGNovaGlove::ToNormalizedValues(
UObject* Outer, const USGNovaGloveSensorData* SensorData, USGSensorNormalization*& OutSensorNormalizer)
{
FSGIC_TArray_float OutNormalizedValuesContainer;
FSGIC_FSGNovaGloveSensorDataImpl SensorDataContainer{SensorData->ToNovaGloveSensorDataImpl()};
FSGIC_FSGSensorNormalizationImpl OutSensorNormalizerContainer;
SGCoreImpl_FSGNovaGloveImpl_ToNormalizedValues_SensorData_OutSensorNormalizer(
&OutNormalizedValuesContainer, &SensorDataContainer, &OutSensorNormalizerContainer);
OutSensorNormalizer = USGSensorNormalization::NewSensorNormalization(
Outer, MoveTemp(OutSensorNormalizerContainer.SensorNormalizationImpl));
return MoveTemp(OutNormalizedValuesContainer.Array);
}
TArray<TArray<FVector>> USGNovaGlove::CalculateHandAngles(
const TArray<float>& NormalizedValues, const USGHandInterpolator* Interpolator)
{
FSGIC_TArray_TArray_FVector OutHandAnglesContainer;
FSGIC_TArray_float NormalizedValuesContainer{NormalizedValues};
FSGIC_FSGHandInterpolatorImpl InterpolatorContainer{Interpolator->ToHandInterpolatorImpl()};
SGCoreImpl_FSGNovaGloveImpl_CalculateHandAngles(
&OutHandAnglesContainer, &NormalizedValuesContainer, &InterpolatorContainer);
return MoveTemp(OutHandAnglesContainer.Array);
}
FString USGNovaGlove::ToNovaCommandAsFlexion(const USGThresholdCommand* Thresholds)
{
FSGIC_FString OutStringContainer;
FSGIC_FSGThresholdCommandImpl ThresholdsContainer{Thresholds->ToThresholdCommandImpl()};
SGCoreImpl_FSGNovaGloveImpl_ToNovaCommandAsFlexion(&OutStringContainer, &ThresholdsContainer);
return MoveTemp(OutStringContainer.String);
}
FString USGNovaGlove::ToNovaCommandAsRaw(
const USGThresholdCommand* Thresholds, const USGSensorNormalization* Interpolator)
{
FSGIC_FString OutStringContainer;
FSGIC_FSGThresholdCommandImpl ThresholdsContainer{Thresholds->ToThresholdCommandImpl()};
FSGIC_FSGSensorNormalizationImpl InterpolatorContainer{Interpolator->ToSensorNormalizationImpl()};
SGCoreImpl_FSGNovaGloveImpl_ToNovaCommandAsRaw(
&OutStringContainer, &ThresholdsContainer, &InterpolatorContainer);
return MoveTemp(OutStringContainer.String);
}
USGNovaGlove::USGNovaGlove()
@@ -391,6 +401,12 @@ int32 USGNovaGlove::GetSubFirmwareVersion() const
return SGCoreImpl_FSGNovaGloveImpl_GetSubFirmwareVersion(&InstanceContainer);
}
void USGNovaGlove::SetDeviceIndex(int32 NewIndex)
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
return SGCoreImpl_FSGNovaGloveImpl_SetDeviceIndex(&InstanceContainer, NewIndex);
}
bool USGNovaGlove::HasBattery() const
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
@@ -411,21 +427,13 @@ bool USGNovaGlove::GetBatteryLevel(float& OutBatteryLevel)
return bResult;
}
bool USGNovaGlove::GetSensorData(UObject* Outer, USGNovaGloveSensorData*& OutSensorData)
bool USGNovaGlove::IsRight() const
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_FSGNovaGloveSensorDataImpl OutSensorDataContainer;
const bool bResult = SGCoreImpl_FSGNovaGloveImpl_GetSensorData(&InstanceContainer, &OutSensorDataContainer);
if (bResult)
{
OutSensorData = USGNovaGloveSensorData::NewNovaGloveSensorData(
Outer, MoveTemp(OutSensorDataContainer.NovaGloveSensorDataImpl));
}
return bResult;
return SGCoreImpl_FSGNovaGloveImpl_IsRight(&InstanceContainer);
}
bool USGNovaGlove::GetImuRotation(FQuat& OutImu)
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
@@ -454,16 +462,13 @@ bool USGNovaGlove::GetImuRotation(FRotator& OutImu)
return bResult;
}
bool USGNovaGlove::GetHandPose(
UObject* Outer, const USGBasicHandModel* HandModel, const USGNovaGloveHandProfile* Profile,
USGHandPose*& OutHandPose)
bool USGNovaGlove::GetHandPose(UObject* Outer, const USGBasicHandModel* HandGeometry, USGHandPose*& OutHandPose) const
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_FSGBasicHandModelImpl HandModelContainer{HandModel->ToBasicHandModelImpl()};
FSGIC_FSGNovaGloveHandProfileImpl ProfileContainer{Profile->ToNovaGloveHandProfileImpl()};
FSGIC_FSGBasicHandModelImpl HandModelContainer{HandGeometry->ToBasicHandModelImpl()};
FSGIC_FSGHandPoseImpl OutHandPoseContainer;
const bool bResult = SGCoreImpl_FSGNovaGloveImpl_GetHandPose_HandModel_Profile_OutHandPose(
&InstanceContainer, &HandModelContainer, &ProfileContainer, &OutHandPoseContainer);
const bool bResult = SGCoreImpl_FSGNovaGloveImpl_GetHandPose(
&InstanceContainer, &HandModelContainer, &OutHandPoseContainer);
if (bResult)
{
@@ -473,105 +478,77 @@ bool USGNovaGlove::GetHandPose(
return bResult;
}
bool USGNovaGlove::GetHandPose(UObject* Outer, const USGBasicHandModel* HandGeometry, const USGHandProfile* HandProfile,
USGHandPose*& OutHandPose)
bool USGNovaGlove::GetHandAngles(TArray<TArray<FVector>>& OutHandAngles) const
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_FSGBasicHandModelImpl HandGeometryContainer{HandGeometry->ToBasicHandModelImpl()};
FSGIC_FSGHandProfileImpl ProfileContainer{HandProfile->ToHandProfileImpl()};
FSGIC_FSGHandPoseImpl OutHandPoseContainer;
const bool bResult = SGCoreImpl_FSGNovaGloveImpl_GetHandPose_HandGeometry_HandProfile_OutHandPose(
&InstanceContainer, &HandGeometryContainer, &ProfileContainer, &OutHandPoseContainer);
if (bResult)
{
OutHandPose = USGHandPose::NewHandPose(Outer, MoveTemp(OutHandPoseContainer.HandPoseImpl));
}
FSGIC_TArray_TArray_FVector OutHandAnglesContainer;
const bool bResult = SGCoreImpl_FSGNovaGloveImpl_GetHandAngles(&InstanceContainer, &OutHandAnglesContainer);
OutHandAngles = MoveTemp(OutHandAnglesContainer.Array);
return bResult;
}
bool USGNovaGlove::GetHandPose(UObject* Outer, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose)
ESGHapticGloveCalibrationState USGNovaGlove::GetCalibrationState() const
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_FSGHandProfileImpl ProfileContainer{HandProfile->ToHandProfileImpl()};
FSGIC_FSGHandPoseImpl OutHandPoseContainer;
const bool bResult = SGCoreImpl_FSGNovaGloveImpl_GetHandPose_HandProfile_OutHandPose(
&InstanceContainer, &ProfileContainer, &OutHandPoseContainer);
if (bResult)
{
OutHandPose = USGHandPose::NewHandPose(Outer, MoveTemp(OutHandPoseContainer.HandPoseImpl));
}
return bResult;
FSGIC_ESGHapticGloveCalibrationState OutHapticGloveCalibrationStateContainer;
SGCoreImpl_FSGNovaGloveImpl_GetCalibrationState(&InstanceContainer, &OutHapticGloveCalibrationStateContainer);
return MoveTemp(OutHapticGloveCalibrationStateContainer.State);
}
void USGNovaGlove::SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand,
const USGBuzzCommand* BuzzCommand,
const USGThumperCommand* ThumperCommand)
void USGNovaGlove::EndCalibration()
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_FSGForceFeedbackCommandImpl ForceFeedbackCommandContainer{
ForceFeedbackCommand->ToForceFeedbackCommandImpl().Get()};
FSGIC_FSGBuzzCommandImpl BuzzCommandContainer{BuzzCommand->ToBuzzCommandImpl().Get()};
FSGIC_FSGThumperCommandImpl ThumperCommandContainer{ThumperCommand->ToThumperCommandImpl()};
SGCoreImpl_FSGNovaGloveImpl_SendHaptics_ForceFeedbackCommand_BuzzCommand_ThumperCommand(
&InstanceContainer, &ForceFeedbackCommandContainer, &BuzzCommandContainer, &ThumperCommandContainer);
SGCoreImpl_FSGNovaGloveImpl_EndCalibration(&InstanceContainer);
}
void USGNovaGlove::SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand)
void USGNovaGlove::ResetCalibration()
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_FSGForceFeedbackCommandImpl ForceFeedbackCommandContainer{
ForceFeedbackCommand->ToForceFeedbackCommandImpl().Get()};
SGCoreImpl_FSGNovaGloveImpl_SendHaptics_ForceFeedbackCommand(&InstanceContainer, &ForceFeedbackCommandContainer);
SGCoreImpl_FSGNovaGloveImpl_ResetCalibration(&InstanceContainer);
}
void USGNovaGlove::SendHaptics(const USGBuzzCommand* BuzzCommand)
void USGNovaGlove::StopHaptics()
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_FSGBuzzCommandImpl BuzzCommandContainer{BuzzCommand->ToBuzzCommandImpl().Get()};
SGCoreImpl_FSGNovaGloveImpl_SendHaptics_ForceFeedbackCommand(&InstanceContainer, &BuzzCommandContainer);
SGCoreImpl_FSGNovaGloveImpl_StopHaptics(&InstanceContainer);
}
void USGNovaGlove::SendHaptics(const USGThumperCommand* ThumperCommand)
void USGNovaGlove::StopVibrations()
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_FSGThumperCommandImpl ThumperCommandContainer{ThumperCommand->ToThumperCommandImpl()};
SGCoreImpl_FSGNovaGloveImpl_SendHaptics_ForceFeedbackCommand(&InstanceContainer, &ThumperCommandContainer);
SGCoreImpl_FSGNovaGloveImpl_StopVibrations(&InstanceContainer);
}
bool USGNovaGlove::GetCalibrationValues(TArray<FVector>& OutValues)
bool USGNovaGlove::SendHaptics()
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_TArray_FVector OutValuesContainer;
const bool bResult = SGCoreImpl_FSGNovaGloveImpl_GetCalibrationValues_OutValues(
&InstanceContainer, &OutValuesContainer);
if (bResult)
{
OutValues = MoveTemp(OutValuesContainer.Array);
}
return bResult;
return SGCoreImpl_FSGNovaGloveImpl_SendHaptics(&InstanceContainer);
}
void USGNovaGlove::ApplyCalibration(UObject* Outer, USGHandProfile*& OutProfile) const
bool USGNovaGlove::SupportsCustomWaveform(ESGHapticLocation AtLocation) const
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_FSGHandProfileImpl OutProfileContainer;
SGCoreImpl_FSGNovaGloveImpl_ApplyCalibration_HandProfile(&InstanceContainer, &OutProfileContainer);
OutProfile = USGHandProfile::NewHandProfile(Outer, MoveTemp(OutProfileContainer.HandProfileImpl));
return SGCoreImpl_FSGNovaGloveImpl_SendHaptics(&InstanceContainer);
}
void USGNovaGlove::ApplyCalibration(UObject* Outer, USGNovaGloveHandProfile*& OutProfile) const
bool USGNovaGlove::SendCustomWaveform(USGCustomWaveform* OutWaveform, ESGHapticLocation Location)
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_FSGNovaGloveHandProfileImpl OutProfileContainer;
SGCoreImpl_FSGNovaGloveImpl_ApplyCalibration_NovaGloveHandProfile(&InstanceContainer, &OutProfileContainer);
OutProfile = USGNovaGloveHandProfile::NewNovaGloveHandProfile(
Outer, MoveTemp(OutProfileContainer.NovaGloveHandProfileImpl));
return SGCoreImpl_FSGNovaGloveImpl_SendHaptics(&InstanceContainer);
}
bool USGNovaGlove::QueueForceFeedbackLevels(const TArray<float>& Levels01)
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_TArray_float Levels01Container{Levels01};
return SGCoreImpl_FSGNovaGloveImpl_QueueForceFeedbackLevels(&InstanceContainer, &Levels01Container);
}
bool USGNovaGlove::QueueForceFeedbackLevel(const int32 Finger, const float Level01)
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
return SGCoreImpl_FSGNovaGloveImpl_QueueForceFeedbackLevel(&InstanceContainer, Finger, Level01);
}
void USGNovaGlove::GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
@@ -656,6 +633,139 @@ void USGNovaGlove::GetWristLocation(const FVector& ReferencePosition, const FRot
OutWristRotation = OutWristRotationContainer.Quat.Rotator();
}
USGNovaGloveInfo* USGNovaGlove::GetGloveInfo(UObject* Outer) const
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_FSGNovaGloveInfoImpl OutGloveInfoContainer;
SGCoreImpl_FSGNovaGloveImpl_GetGloveInfo(&InstanceContainer, &OutGloveInfoContainer);
return USGNovaGloveInfo::NewNovaGloveInfo(Outer, MoveTemp(OutGloveInfoContainer.NovaGloveInfoImpl));
}
bool USGNovaGlove::SupportsThresholds() const
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
return SGCoreImpl_FSGNovaGloveImpl_SupportsThresholds(&InstanceContainer);
}
bool USGNovaGlove::SupportsCustomWaveforms() const
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
return SGCoreImpl_FSGNovaGloveImpl_SupportsCustomWaveforms(&InstanceContainer);
}
bool USGNovaGlove::SupportsOnBoardNormalization() const
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
return SGCoreImpl_FSGNovaGloveImpl_SupportsOnBoardNormalization(&InstanceContainer);
}
bool USGNovaGlove::GetSensorData(UObject* Outer, USGNovaGloveSensorData*& OutSensorData)
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_FSGNovaGloveSensorDataImpl OutSensorDataContainer;
const bool bResult = SGCoreImpl_FSGNovaGloveImpl_GetSensorData(&InstanceContainer, &OutSensorDataContainer);
if (bResult)
{
OutSensorData = USGNovaGloveSensorData::NewNovaGloveSensorData(
Outer, MoveTemp(OutSensorDataContainer.NovaGloveSensorDataImpl));
}
return bResult;
}
bool USGNovaGlove::GetNormalizedInput(TArray<float>& OutNormalizedValues) const
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_TArray_float OutNormalizedValuesContainer;
const bool bResult = SGCoreImpl_FSGNovaGloveImpl_GetNormalizedInput(
&InstanceContainer, &OutNormalizedValuesContainer);
if (bResult)
{
OutNormalizedValues = MoveTemp(OutNormalizedValuesContainer.Array);
}
return bResult;
}
FString USGNovaGlove::ToNovaCommand(
const TArray<float>& ForceFeedbackLevels, const TArray<float>& BuzzLevels, float WristLevel) const
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_FString OutStringContainer;
FSGIC_TArray_float ForceFeedbackLevelsContainer{ForceFeedbackLevels};
FSGIC_TArray_float BuzzLevelsContainer{BuzzLevels};
SGCoreImpl_FSGNovaGloveImpl_ToNovaCommand(&InstanceContainer, &OutStringContainer,
&ForceFeedbackLevelsContainer, &BuzzLevelsContainer, WristLevel);
return MoveTemp(OutStringContainer.String);
}
bool USGNovaGlove::QueueVibroLevels(const TArray<float>& Amplitudes)
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_TArray_float AmplitudesContainer{Amplitudes};
return SGCoreImpl_FSGNovaGloveImpl_QueueVibroLevels(&InstanceContainer, &AmplitudesContainer);
}
bool USGNovaGlove::QueueVibroLevel(const int32 Finger, const float Amplitude)
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
return SGCoreImpl_FSGNovaGloveImpl_QueueVibroLevel(&InstanceContainer, Finger, Amplitude);
}
bool USGNovaGlove::QueueWristLevel(const float Amplitude)
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
return SGCoreImpl_FSGNovaGloveImpl_QueueWristLevel(&InstanceContainer, Amplitude);
}
ESGNovaVibroMotor USGNovaGlove::ToNovaMotor(const ESGHapticLocation Location) const
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_ESGNovaVibroMotor OutVibroMotorContainer;
FSGIC_ESGHapticLocation LocationContainer{Location};
SGCoreImpl_FSGNovaGloveImpl_ToNovaMotor(&InstanceContainer, &OutVibroMotorContainer, &LocationContainer);
return OutVibroMotorContainer.Motor;
}
int32 USGNovaGlove::ChannelIndex(const ESGNovaVibroMotor Motor) const
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_ESGNovaVibroMotor MotorContainer{Motor};
return SGCoreImpl_FSGNovaGloveImpl_ChannelIndex(&InstanceContainer, &MotorContainer);
}
void USGNovaGlove::ValidateWaveform(USGCustomWaveform* OutWaveform, const ESGNovaVibroMotor Motor) const
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_FSGCustomWaveformImpl OutWaveformContainer{OutWaveform->ToCustomWaveformImpl()};
FSGIC_ESGNovaVibroMotor MotorContainer{Motor};
SGCoreImpl_FSGNovaGloveImpl_ValidateWaveform(&InstanceContainer, &OutWaveformContainer, &MotorContainer);
}
bool USGNovaGlove::SendCustomWaveform_Nova(
USGCustomWaveform* OutWaveform, const ESGNovaVibroMotor Motor, const bool bValidateWaveform)
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
FSGIC_FSGCustomWaveformImpl OutWaveformContainer{OutWaveform->ToCustomWaveformImpl()};
FSGIC_ESGNovaVibroMotor MotorContainer{Motor};
return SGCoreImpl_FSGNovaGloveImpl_SendCustomWaveform_Nova(
&InstanceContainer, &OutWaveformContainer, &MotorContainer, bValidateWaveform);
}
bool USGNovaGlove::QueueThresholdCommand_Flexion(const int32 Finger, const float FlexionThreshold)
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
return SGCoreImpl_FSGNovaGloveImpl_QueueThresholdCommand_Flexion(&InstanceContainer, Finger, FlexionThreshold);
}
bool USGNovaGlove::QueueClearThreshold(const int32 Finger)
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
return SGCoreImpl_FSGNovaGloveImpl_QueueClearThreshold(&InstanceContainer, Finger);
}
FString USGNovaGlove::ToString() const
{
FSGIC_TSharedPtr_FSGNovaGloveImpl InstanceContainer{ToNovaGloveImpl()};
@@ -1,72 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGNovaGloveCalibration.h"
#include "SGCore/SGNovaGloveHandProfile.h"
#include "SGCore/SGNovaGloveHandProfile.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_FSGNovaGloveHandProfileImpl.h"
#include "SGInterop/SGIC_TArray_FVector.h"
#include "SGInterop/SGIC_TArray_TArray_FVector.h"
void FSGNovaGloveCalibration::ApplyDefaultCalibrationInterpolationValues(const TArray<FVector>& RetractedValues,
const TArray<FVector>& ExtendedValues,
const USGNovaGloveHandProfile* Profile)
{
FSGIC_TArray_FVector RetractedValuesContainer{RetractedValues};
FSGIC_TArray_FVector ExtendedValuesContainer{ExtendedValues};
FSGIC_FSGNovaGloveHandProfileImpl ProfileContainer{Profile->ToNovaGloveHandProfileImpl()};
SGCoreImpl_FSGNovaGloveCalibrationImpl_ApplyDefaultCalibrationInterpolationValues(
&RetractedValuesContainer, &ExtendedValuesContainer, &ProfileContainer);
}
void FSGNovaGloveCalibration::ApplyInterpolationValues(const TArray<FVector>& RetractedValues,
const TArray<FVector>& ExtendedValues,
const TArray<TArray<FVector>>& RetractedAngles,
const TArray<TArray<FVector>>& ExtendedAngles,
const USGNovaGloveHandProfile* Profile)
{
FSGIC_TArray_FVector RetractedValuesContainer{RetractedValues};
FSGIC_TArray_FVector ExtendedValuesContainer{ExtendedValues};
FSGIC_TArray_TArray_FVector RetractedAnglesContainer{RetractedAngles};
FSGIC_TArray_TArray_FVector ExtendedAnglesContainer{ExtendedAngles};
FSGIC_FSGNovaGloveHandProfileImpl ProfileContainer{Profile->ToNovaGloveHandProfileImpl()};
SGCoreImpl_FSGNovaGloveCalibrationImpl_ApplyInterpolationValues(
&RetractedValuesContainer, &ExtendedValuesContainer,
&RetractedAnglesContainer, &ExtendedAnglesContainer,
&ProfileContainer);
}
@@ -1,208 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGNovaGloveHandProfile.h"
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGHandInterpolator.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGCoreImpl/SGNovaGloveHandProfileImpl.h"
#include "SGInterop/SGIC_FSGHandInterpolatorImpl.h"
#include "SGInterop/SGIC_FSGNovaGloveHandProfileImpl.h"
#include "SGInterop/SGIC_FString.h"
struct USGNovaGloveHandProfile::FImpl
{
/************************
* Member variables
************************/
FSGNovaGloveHandProfileImpl NovaGloveHandProfileImpl;
/************************
* Owner object
************************/
USGNovaGloveHandProfile* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGNovaGloveHandProfile* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGNovaGloveHandProfile* USGNovaGloveHandProfile::NewNovaGloveHandProfile(
UObject* Outer, const FSGNovaGloveHandProfileImpl& NovaGloveHandProfileImpl)
{
USGNovaGloveHandProfile* Instance = NewObject<USGNovaGloveHandProfile>(Outer);
Instance->SetNovaGloveHandProfileImpl(NovaGloveHandProfileImpl);
return Instance;
}
USGNovaGloveHandProfile* USGNovaGloveHandProfile::NewNovaGloveHandProfile(UObject* Outer)
{
FSGIC_FSGNovaGloveHandProfileImpl OutNovaGloveHandProfileImplContainer;
SGCoreImpl_FSGNovaGloveHandProfileImpl_ctor(&OutNovaGloveHandProfileImplContainer);
return NewNovaGloveHandProfile(Outer, MoveTemp(OutNovaGloveHandProfileImplContainer.NovaGloveHandProfileImpl));
}
USGNovaGloveHandProfile* USGNovaGloveHandProfile::NewNovaGloveHandProfile(
UObject* Outer, const bool bRightHanded, const USGHandInterpolator* Interpolator)
{
FSGIC_FSGNovaGloveHandProfileImpl OutNovaGloveHandProfileImplContainer;
FSGIC_FSGHandInterpolatorImpl InterpolatorContainer{Interpolator->ToHandInterpolatorImpl()};
SGCoreImpl_FSGNovaGloveHandProfileImpl_ctor_bRightHanded_Interpolator(
&OutNovaGloveHandProfileImplContainer, bRightHanded, &InterpolatorContainer);
return NewNovaGloveHandProfile(Outer, MoveTemp(OutNovaGloveHandProfileImplContainer.NovaGloveHandProfileImpl));
}
USGNovaGloveHandProfile* USGNovaGloveHandProfile::Default(UObject* Outer, const bool bRightHanded)
{
FSGIC_FSGNovaGloveHandProfileImpl OutNovaGloveHandProfileImplContainer;
SGCoreImpl_FSGNovaGloveHandProfileImpl_Default(&OutNovaGloveHandProfileImplContainer, bRightHanded);
return NewNovaGloveHandProfile(Outer, MoveTemp(OutNovaGloveHandProfileImplContainer.NovaGloveHandProfileImpl));
}
USGNovaGloveHandProfile* USGNovaGloveHandProfile::Deserialize(UObject* Outer, const FString& SerializedString)
{
FSGIC_FSGNovaGloveHandProfileImpl OutNovaGloveHandProfileImplContainer;
FSGIC_FString SerializedStringContainer{SerializedString};
SGCoreImpl_FSGNovaGloveHandProfileImpl_Deserialize(&OutNovaGloveHandProfileImplContainer,
&SerializedStringContainer);
return NewNovaGloveHandProfile(Outer, MoveTemp(OutNovaGloveHandProfileImplContainer.NovaGloveHandProfileImpl));
}
USGNovaGloveHandProfile::USGNovaGloveHandProfile()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGNovaGloveHandProfileImpl OutNovaGloveHandProfileImplContainer;
SGCoreImpl_FSGNovaGloveHandProfileImpl_ctor(&OutNovaGloveHandProfileImplContainer);
Pimpl->NovaGloveHandProfileImpl = MoveTemp(OutNovaGloveHandProfileImplContainer.NovaGloveHandProfileImpl);
}
USGNovaGloveHandProfile::USGNovaGloveHandProfile(const bool bRightHanded, const USGHandInterpolator* Interpolator)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGNovaGloveHandProfileImpl OutNovaGloveHandProfileImplContainer;
FSGIC_FSGHandInterpolatorImpl InterpolatorContainer{Interpolator->ToHandInterpolatorImpl()};
SGCoreImpl_FSGNovaGloveHandProfileImpl_ctor_bRightHanded_Interpolator(
&OutNovaGloveHandProfileImplContainer, bRightHanded, &InterpolatorContainer);
Pimpl->NovaGloveHandProfileImpl = MoveTemp(OutNovaGloveHandProfileImplContainer.NovaGloveHandProfileImpl);
}
USGNovaGloveHandProfile::USGNovaGloveHandProfile(const FSGNovaGloveHandProfileImpl& NovaGloveHandProfileImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
SetNovaGloveHandProfileImpl(NovaGloveHandProfileImpl);
}
USGNovaGloveHandProfile::~USGNovaGloveHandProfile() = default;
void USGNovaGloveHandProfile::SetNovaGloveHandProfileImpl(const FSGNovaGloveHandProfileImpl& NovaGloveHandProfileImpl)
{
FSGIC_FSGNovaGloveHandProfileImpl OutNovaGloveHandProfileContainer;
FSGIC_FSGNovaGloveHandProfileImpl RhsContainer{NovaGloveHandProfileImpl};
SGCoreImpl_FSGNovaGloveHandProfileImpl_ctor_copy(&OutNovaGloveHandProfileContainer, &RhsContainer);
Pimpl->NovaGloveHandProfileImpl = MoveTemp(OutNovaGloveHandProfileContainer.NovaGloveHandProfileImpl);
}
const FSGNovaGloveHandProfileImpl& USGNovaGloveHandProfile::ToNovaGloveHandProfileImpl() const
{
return Pimpl->NovaGloveHandProfileImpl;
}
bool USGNovaGloveHandProfile::IsRight() const
{
FSGIC_FSGNovaGloveHandProfileImpl InstanceContainer{ToNovaGloveHandProfileImpl()};
return SGCoreImpl_FSGNovaGloveHandProfileImpl_IsRight(&InstanceContainer);
}
USGHandInterpolator* USGNovaGloveHandProfile::GetInterpolationSet(UObject* Outer) const
{
FSGIC_FSGNovaGloveHandProfileImpl InstanceContainer{ToNovaGloveHandProfileImpl()};
FSGIC_FSGHandInterpolatorImpl OutSetContainer;
SGCoreImpl_FSGNovaGloveHandProfileImpl_GetInterpolationSet(&InstanceContainer, &OutSetContainer);
return USGHandInterpolator::NewHandInterpolator(Outer, MoveTemp(OutSetContainer.HandInterpolatorImpl));
}
bool USGNovaGloveHandProfile::Equals(const USGNovaGloveHandProfile* NovaGloveHandProfile) const
{
FSGIC_FSGNovaGloveHandProfileImpl InstanceContainer{ToNovaGloveHandProfileImpl()};
FSGIC_FSGNovaGloveHandProfileImpl NovaGloveHandProfileContainer{NovaGloveHandProfile->ToNovaGloveHandProfileImpl()};
return SGCoreImpl_FSGNovaGloveHandProfileImpl_Equals(&InstanceContainer, &NovaGloveHandProfileContainer);
}
void USGNovaGloveHandProfile::Reset()
{
FSGIC_FSGNovaGloveHandProfileImpl InstanceContainer{ToNovaGloveHandProfileImpl()};
SGCoreImpl_FSGNovaGloveHandProfileImpl_Reset(&InstanceContainer);
}
FString USGNovaGloveHandProfile::SGSerialize() const
{
FSGIC_FSGNovaGloveHandProfileImpl InstanceContainer{ToNovaGloveHandProfileImpl()};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGNovaGloveHandProfileImpl_Serialize(&InstanceContainer, &OutStringContainer);
return MoveTemp(OutStringContainer.String);
}
USGNovaGloveHandProfile::FImpl::FImpl(USGNovaGloveHandProfile* InOwner)
: Owner(InOwner)
{
}
USGNovaGloveHandProfile::FImpl::~FImpl() = default;
void USGNovaGloveHandProfile::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -235,6 +235,22 @@ int32 USGNovaGloveInfo::GetNumberOfSensors() const
return SGCoreImpl_FSGNovaGloveInfoImpl_GetNumberOfSensors(&InstanceContainer);
}
bool USGNovaGloveInfo::FirmwareNewerThan(
const int32 FirmwareMain, const int32 FirmwareSub, const bool bInclusive) const
{
FSGIC_FSGNovaGloveInfoImpl InstanceContainer{ToNovaGloveInfoImpl()};
return SGCoreImpl_FSGNovaGloveInfoImpl_FirmwareNewerThan(&InstanceContainer,
FirmwareMain, FirmwareSub, bInclusive);
}
bool USGNovaGloveInfo::FirmwareOlderThan(
const int32 FirmwareMain, const int32 FirmwareSub, const bool bInclusive) const
{
FSGIC_FSGNovaGloveInfoImpl InstanceContainer{ToNovaGloveInfoImpl()};
return SGCoreImpl_FSGNovaGloveInfoImpl_FirmwareOlderThan(&InstanceContainer,
FirmwareMain, FirmwareSub, bInclusive);
}
bool USGNovaGloveInfo::Equals(const USGNovaGloveInfo* NovaGloveInfo) const
{
FSGIC_FSGNovaGloveInfoImpl InstanceContainer{ToNovaGloveInfoImpl()};
@@ -40,6 +40,8 @@
#include "SGCore/SGNovaGloveInfo.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGCoreImpl/SGNovaGloveSensorDataImpl.h"
#include "SGInterop/SGIC_ESGFinger.h"
#include "SGInterop/SGIC_ESGNovaSensorLocation.h"
#include "SGInterop/SGIC_FQuat.h"
#include "SGInterop/SGIC_FSGNovaGloveInfoImpl.h"
#include "SGInterop/SGIC_FSGNovaGloveSensorDataImpl.h"
@@ -216,6 +218,21 @@ TArray<FVector> USGNovaGloveSensorData::GetSensorValues() const
return MoveTemp(OutValuesContainer.Array);
}
float USGNovaGloveSensorData::GetSensorValue(const ESGFinger Finger, const ESGNovaSensorLocation Location) const
{
FSGIC_FSGNovaGloveSensorDataImpl InstanceContainer{ToNovaGloveSensorDataImpl()};
FSGIC_ESGFinger FingerContainer{Finger};
FSGIC_ESGNovaSensorLocation LocationContainer{Location};
return SGCoreImpl_FSGNovaGloveSensorDataImpl_GetSensorValue(
&InstanceContainer, &FingerContainer, &LocationContainer);
}
int32 USGNovaGloveSensorData::GetParsedValues() const
{
FSGIC_FSGNovaGloveSensorDataImpl InstanceContainer{ToNovaGloveSensorDataImpl()};
return SGCoreImpl_FSGNovaGloveSensorDataImpl_GetParsedValues(&InstanceContainer);
}
FQuat USGNovaGloveSensorData::GetImuRotationQ() const
{
FSGIC_FSGNovaGloveSensorDataImpl InstanceContainer{ToNovaGloveSensorDataImpl()};
@@ -232,12 +249,6 @@ FRotator USGNovaGloveSensorData::GetImuRotation() const
return OutRotationContainer.Quat.Rotator();
}
int32 USGNovaGloveSensorData::GetParsedValues() const
{
FSGIC_FSGNovaGloveSensorDataImpl InstanceContainer{ToNovaGloveSensorDataImpl()};
return SGCoreImpl_FSGNovaGloveSensorDataImpl_GetParsedValues(&InstanceContainer);
}
bool USGNovaGloveSensorData::IsImuParsed() const
{
FSGIC_FSGNovaGloveSensorDataImpl InstanceContainer{ToNovaGloveSensorDataImpl()};
@@ -37,33 +37,37 @@
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGBuzzCommand.h"
#include "SGCore/SGDeviceImplCast.h"
#include "SGCore/SGForceFeedbackCommand.h"
#include "SGCore/SGHandInterpolator.h"
#include "SGCore/SGHandPose.h"
#include "SGCore/SGSenseGloveSensorNormalizer.h"
#include "SGCoreImpl/SGDeviceImpl.h"
#include "SGCoreImpl/SGHandInterpolatorImpl.h"
#include "SGCoreImpl/SGHandPoseImpl.h"
#include "SGCoreImpl/SGHapticGloveImpl.h"
#include "SGCoreImpl/SGHapticGloveImpl.h"
#include "SGCoreImpl/SGSenseGloveSensorNormalizerImpl.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGCoreImpl/SGSenseGloveImpl.h"
#include "SGInterop/SGIC_ESGDeviceType.h"
#include "SGInterop/SGIC_ESGFinger.h"
#include "SGInterop/SGIC_ESGHapticGloveCalibrationState.h"
#include "SGInterop/SGIC_ESGPositionalTrackingHardware.h"
#include "SGInterop/SGIC_ESGSenseGloveThumperCommand.h"
#include "SGInterop/SGIC_FQuat.h"
#include "SGInterop/SGIC_FSGBasicHandModelImpl.h"
#include "SGInterop/SGIC_FSGBuzzCommandImpl.h"
#include "SGInterop/SGIC_FSGForceFeedbackCommandImpl.h"
#include "SGInterop/SGIC_FSGHandInterpolatorImpl.h"
#include "SGInterop/SGIC_FSGHandPoseImpl.h"
#include "SGInterop/SGIC_FSGHandProfileImpl.h"
#include "SGInterop/SGIC_FSGSenseGloveHandProfileImpl.h"
#include "SGInterop/SGIC_FSGSenseGloveImpl.h"
#include "SGInterop/SGIC_FSGSenseGloveInfoImpl.h"
#include "SGInterop/SGIC_FSGSenseGlovePoseImpl.h"
#include "SGInterop/SGIC_FSGSenseGloveSensorDataImpl.h"
#include "SGInterop/SGIC_FSGThumperCommandImpl.h"
#include "SGInterop/SGIC_FSGSenseGloveSensorNormalizerImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_FVector.h"
#include "SGInterop/SGIC_TArray_FSGSenseGloveImpl.h"
#include "SGInterop/SGIC_TArray_float.h"
#include "SGInterop/SGIC_TArray_FVector.h"
#include "SGInterop/SGIC_TArray_FSGSenseGloveImpl.h"
#include "SGInterop/SGIC_TArray_TArray_FVector.h"
#include "SGInterop/SGIC_TSharedPtr_FSGSenseGloveImpl.h"
@@ -98,57 +102,6 @@ USGSenseGlove* USGSenseGlove::NewSenseGlove(UObject* Outer, const USGSenseGloveI
return NewSenseGlove(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
ANSICHAR USGSenseGlove::GetHapticsByte()
{
return SGCoreImpl_FSGSenseGloveImpl_GetHapticsByte();
}
ANSICHAR USGSenseGlove::GetThumperByte()
{
return SGCoreImpl_FSGSenseGloveImpl_GetThumperByte();
}
USGSenseGlovePose* USGSenseGlove::CalculateGlovePose(UObject* Outer,
const USGSenseGloveSensorData* SensorData,
const USGSenseGloveInfo* GloveModel)
{
FSGIC_FSGSenseGlovePoseImpl OutPoseContainer;
FSGIC_FSGSenseGloveSensorDataImpl SensorDataContainer{SensorData->ToSenseGloveSensorDataImpl()};
FSGIC_FSGSenseGloveInfoImpl GloveModelContainer{GloveModel->ToSenseGloveInfoImpl()};
SGCoreImpl_FSGSenseGloveImpl_CalculateGlovePose_SensorData_GloveModel(
&OutPoseContainer, &SensorDataContainer, &GloveModelContainer);
return USGSenseGlovePose::NewSenseGlovePose(Outer, MoveTemp(OutPoseContainer.SenseGlovePoseImpl));
}
USGSenseGlovePose* USGSenseGlove::CalculateGlovePose(UObject* Outer,
const TArray<TArray<FVector>>& GloveAngles,
const USGSenseGloveInfo* GloveModel)
{
FSGIC_FSGSenseGlovePoseImpl OutPoseContainer;
FSGIC_TArray_TArray_FVector GloveAnglesContainer{GloveAngles};
FSGIC_FSGSenseGloveInfoImpl GloveModelContainer{GloveModel->ToSenseGloveInfoImpl()};
SGCoreImpl_FSGSenseGloveImpl_CalculateGlovePose_GloveAngles_GloveModel(
&OutPoseContainer, &GloveAnglesContainer, &GloveModelContainer);
return USGSenseGlovePose::NewSenseGlovePose(Outer, MoveTemp(OutPoseContainer.SenseGlovePoseImpl));
}
USGHandPose* USGSenseGlove::CalculateHandPose(UObject* Outer,
const USGSenseGlovePose* GlovePose,
const USGBasicHandModel* HandModel,
const USGSenseGloveHandProfile* Profile)
{
FSGIC_FSGHandPoseImpl OutPoseContainer;
FSGIC_FSGSenseGlovePoseImpl GlovePoseContainer{GlovePose->ToSenseGlovePoseImpl()};
FSGIC_FSGBasicHandModelImpl HandModelContainer{HandModel->ToBasicHandModelImpl()};
FSGIC_FSGSenseGloveHandProfileImpl ProfileContainer{Profile->ToSenseGloveHandProfileImpl()};
SGCoreImpl_FSGSenseGloveImpl_CalculateHandPose(
&OutPoseContainer, &GlovePoseContainer, &HandModelContainer, &ProfileContainer);
return USGHandPose::NewHandPose(Outer, MoveTemp(OutPoseContainer.HandPoseImpl));
}
USGDevice* USGSenseGlove::Parse(UObject* Outer, const FString& ConstantsString)
{
FSGIC_FSGSenseGloveImpl OutSenseGloveImplContainer;
@@ -198,27 +151,6 @@ bool USGSenseGlove::GetSenseGlove(UObject* Outer, const bool bRightHanded, USGSe
return bResult;
}
TArray<FVector> USGSenseGlove::GetCalibrationValues(const USGSenseGlovePose* GlovePose)
{
FSGIC_TArray_FVector OutValuesContainer;
FSGIC_FSGSenseGlovePoseImpl GlovePoseContainer{GlovePose->ToSenseGlovePoseImpl()};
SGCoreImpl_FSGSenseGloveImpl_GetCalibrationValues_GlovePose(&OutValuesContainer, &GlovePoseContainer);
return MoveTemp(OutValuesContainer.Array);
}
void USGSenseGlove::CalibrateInterpolation(UObject* Outer,
const TArray<FVector>& MinValues, const TArray<FVector>& MaxValues,
const bool bRightHanded, USGSenseGloveHandProfile*& OutProfile)
{
FSGIC_TArray_FVector MinValuesContainer{MinValues};
FSGIC_TArray_FVector MaxValuesContainer{MaxValues};
FSGIC_FSGSenseGloveHandProfileImpl OutProfileContainer;
SGCoreImpl_FSGSenseGloveImpl_CalibrateInterpolation(
&MinValuesContainer, &MaxValuesContainer, bRightHanded, &OutProfileContainer);
OutProfile = USGSenseGloveHandProfile::NewSenseGloveHandProfile(
Outer, MoveTemp(OutProfileContainer.SenseGloveHandProfileImpl));
}
void USGSenseGlove::CalculateGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware,
const bool bRightHanded, const ESGFinger MountedOn,
@@ -317,6 +249,95 @@ void USGSenseGlove::CalculateWristLocation(const FVector& ReferencePosition, con
OutWristRotation = OutWristRotationContainer.Quat.Rotator();
}
ANSICHAR USGSenseGlove::GetHapticsByte()
{
return SGCoreImpl_FSGSenseGloveImpl_GetHapticsByte();
}
ANSICHAR USGSenseGlove::GetThumperByte()
{
return SGCoreImpl_FSGSenseGloveImpl_GetThumperByte();
}
FVector USGSenseGlove::GetDefaultThimbleOffset()
{
FSGIC_FVector OutOffsetContainer;
SGCoreImpl_FSGSenseGloveImpl_GetDefaultThimbleOffset(&OutOffsetContainer);
return MoveTemp(OutOffsetContainer.Vector);
}
USGSenseGlovePose* USGSenseGlove::CalculateGlovePose(UObject* Outer,
const USGSenseGloveSensorData* SensorData,
const USGSenseGloveInfo* GloveModel)
{
FSGIC_FSGSenseGlovePoseImpl OutPoseContainer;
FSGIC_FSGSenseGloveSensorDataImpl SensorDataContainer{SensorData->ToSenseGloveSensorDataImpl()};
FSGIC_FSGSenseGloveInfoImpl GloveModelContainer{GloveModel->ToSenseGloveInfoImpl()};
SGCoreImpl_FSGSenseGloveImpl_CalculateGlovePose_SensorData_GloveModel(
&OutPoseContainer, &SensorDataContainer, &GloveModelContainer);
return USGSenseGlovePose::NewSenseGlovePose(Outer, MoveTemp(OutPoseContainer.SenseGlovePoseImpl));
}
USGSenseGlovePose* USGSenseGlove::CalculateGlovePose(UObject* Outer,
const TArray<TArray<FVector>>& GloveAngles,
const USGSenseGloveInfo* GloveModel)
{
FSGIC_FSGSenseGlovePoseImpl OutPoseContainer;
FSGIC_TArray_TArray_FVector GloveAnglesContainer{GloveAngles};
FSGIC_FSGSenseGloveInfoImpl GloveModelContainer{GloveModel->ToSenseGloveInfoImpl()};
SGCoreImpl_FSGSenseGloveImpl_CalculateGlovePose_GloveAngles_GloveModel(
&OutPoseContainer, &GloveAnglesContainer, &GloveModelContainer);
return USGSenseGlovePose::NewSenseGlovePose(Outer, MoveTemp(OutPoseContainer.SenseGlovePoseImpl));
}
void USGSenseGlove::NormalizeValues(
const TArray<FVector>& SumAngles, const USGSenseGloveSensorNormalizer* Normalizer,
TArray<float>& OutFlexions, TArray<float>& OutAbductions)
{
FSGIC_TArray_FVector SumAnglesContainer{SumAngles};
FSGIC_FSGSenseGloveSensorNormalizerImpl NormalizerContainer{Normalizer->ToSenseGloveSensorNormalizerImpl()};
FSGIC_TArray_float OutFlexionsContainer;
FSGIC_TArray_float OutAbductionsContainer;
SGCoreImpl_FSGSenseGloveImpl_NormalizeValues(
&SumAnglesContainer, &NormalizerContainer, &OutFlexionsContainer, &OutAbductionsContainer);
OutFlexions = MoveTemp(OutFlexionsContainer.Array);
OutAbductions = MoveTemp(OutAbductionsContainer.Array);
}
void USGSenseGlove::CalculateHandAngles(
const USGSenseGlovePose* GlovePose,
const USGSenseGloveSensorNormalizer* Normalizer, const USGHandInterpolator* NormalizedToAngles,
TArray<TArray<FVector>>& OutHandAngles)
{
FSGIC_FSGSenseGlovePoseImpl GlovePoseContainer{GlovePose->ToSenseGlovePoseImpl()};
FSGIC_FSGSenseGloveSensorNormalizerImpl NormalizerContainer{Normalizer->ToSenseGloveSensorNormalizerImpl()};
FSGIC_FSGHandInterpolatorImpl NormalizedToAnglesContainer{NormalizedToAngles->ToHandInterpolatorImpl()};
FSGIC_TArray_TArray_FVector OutHandAnglesContainer;
SGCoreImpl_FSGSenseGloveImpl_CalculateHandAngles(
&GlovePoseContainer, &NormalizerContainer, &NormalizedToAnglesContainer, &OutHandAnglesContainer);
OutHandAngles = MoveTemp(OutHandAnglesContainer.Array);
}
void USGSenseGlove::CalculateHandPose(
UObject* Outer,
const USGSenseGlovePose* GlovePose, const USGBasicHandModel* HandModel,
const USGSenseGloveSensorNormalizer* Normalizer, const USGHandInterpolator* NormalizedToAngles,
USGHandPose*& OutHandPose)
{
FSGIC_FSGSenseGlovePoseImpl GlovePoseContainer{GlovePose->ToSenseGlovePoseImpl()};
FSGIC_FSGSenseGloveSensorNormalizerImpl NormalizerContainer{Normalizer->ToSenseGloveSensorNormalizerImpl()};
FSGIC_FSGHandInterpolatorImpl NormalizedToAnglesContainer{NormalizedToAngles->ToHandInterpolatorImpl()};
FSGIC_FSGHandPoseImpl OutHandPoseContainer;
SGCoreImpl_FSGSenseGloveImpl_CalculateHandAngles(
&GlovePoseContainer, &NormalizerContainer, &NormalizedToAnglesContainer, &OutHandPoseContainer);
OutHandPose = USGHandPose::NewHandPose(Outer, MoveTemp(OutHandPoseContainer.HandPoseImpl));
}
USGSenseGlove::USGSenseGlove()
: USGHapticGlove()
{
@@ -368,21 +389,6 @@ TSharedRef<FSGSenseGloveImpl> USGSenseGlove::ToSenseGloveImpl() const
return FSGDeviceImplCast::ToSenseGloveImpl(ToSGDeviceImpl());
}
USGSenseGloveInfo* USGSenseGlove::GetGloveModel(UObject* Outer) const
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FSGSenseGloveInfoImpl OutModelContainer;
SGCoreImpl_FSGSenseGloveImpl_GetGloveModel(&InstanceContainer, &OutModelContainer);
return USGSenseGloveInfo::NewSenseGloveInfo(Outer, MoveTemp(OutModelContainer.SenseGloveInfoImpl));
}
bool USGSenseGlove::IsRight() const
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
return SGCoreImpl_FSGSenseGloveImpl_IsRight(&InstanceContainer);
}
ESGDeviceType USGSenseGlove::GetDeviceType() const
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
@@ -419,19 +425,10 @@ int32 USGSenseGlove::GetSubFirmwareVersion() const
return SGCoreImpl_FSGSenseGloveImpl_GetSubFirmwareVersion(&InstanceContainer);
}
bool USGSenseGlove::GetSensorData(UObject* Outer, USGSenseGloveSensorData*& OutSensorData) const
bool USGSenseGlove::IsRight() const
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FSGSenseGloveSensorDataImpl OutSensorDataContainer;
const bool bResult = SGCoreImpl_FSGSenseGloveImpl_GetSensorData(&InstanceContainer, &OutSensorDataContainer);
if (bResult)
{
OutSensorData = USGSenseGloveSensorData::NewSenseGloveSensorData(
Outer, MoveTemp(OutSensorDataContainer.SenseGloveSensorDataImpl));
}
return bResult;
return SGCoreImpl_FSGSenseGloveImpl_IsRight(&InstanceContainer);
}
bool USGSenseGlove::GetImuRotation(FQuat& OutImu)
@@ -462,48 +459,13 @@ bool USGSenseGlove::GetImuRotation(FRotator& OutImu)
return bResult;
}
bool USGSenseGlove::GetGlovePose(UObject* Outer, USGSenseGlovePose*& OutGlovePose)
bool USGSenseGlove::GetHandPose(UObject* Outer, const USGBasicHandModel* HandGeometry, USGHandPose*& OutHandPose) const
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FSGSenseGlovePoseImpl OutGlovePoseContainer;
const bool bResult = SGCoreImpl_FSGSenseGloveImpl_GetGlovePose_OutGlovePose(
&InstanceContainer, &OutGlovePoseContainer);
if (bResult)
{
OutGlovePose = USGSenseGlovePose::NewSenseGlovePose(Outer, MoveTemp(OutGlovePoseContainer.SenseGlovePoseImpl));
}
return bResult;
}
bool USGSenseGlove::GetGlovePose(
UObject* Outer, const USGSenseGloveSensorData* SensorData, USGSenseGlovePose*& OutGlovePose)
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FSGSenseGloveSensorDataImpl SensorDataContainer{SensorData->ToSenseGloveSensorDataImpl()};
FSGIC_FSGSenseGlovePoseImpl OutGlovePoseContainer;
const bool bResult = SGCoreImpl_FSGSenseGloveImpl_GetGlovePose_SensorData_OutGlovePose(
&InstanceContainer, &SensorDataContainer, &OutGlovePoseContainer);
if (bResult)
{
OutGlovePose = USGSenseGlovePose::NewSenseGlovePose(Outer, MoveTemp(OutGlovePoseContainer.SenseGlovePoseImpl));
}
return bResult;
}
bool USGSenseGlove::GetHandPose(
UObject* Outer, const USGBasicHandModel* HandModel, const USGSenseGloveHandProfile* Profile,
USGHandPose*& OutHandPose)
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FSGBasicHandModelImpl HandModelContainer{HandModel->ToBasicHandModelImpl()};
FSGIC_FSGSenseGloveHandProfileImpl ProfileContainer{Profile->ToSenseGloveHandProfileImpl()};
FSGIC_FSGBasicHandModelImpl HandModelContainer{HandGeometry->ToBasicHandModelImpl()};
FSGIC_FSGHandPoseImpl OutHandPoseContainer;
const bool bResult = SGCoreImpl_FSGSenseGloveImpl_GetHandPose_HandModel_Profile_OutHandPose(
&InstanceContainer, &HandModelContainer, &ProfileContainer, &OutHandPoseContainer);
const bool bResult = SGCoreImpl_FSGSenseGloveImpl_GetHandPose(
&InstanceContainer, &HandModelContainer, &OutHandPoseContainer);
if (bResult)
{
@@ -513,134 +475,64 @@ bool USGSenseGlove::GetHandPose(
return bResult;
}
bool USGSenseGlove::GetHandPose(
UObject* Outer, const USGBasicHandModel* HandGeometry, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose)
bool USGSenseGlove::GetHandAngles(TArray<TArray<FVector>>& OutHandAngles) const
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FSGBasicHandModelImpl HandGeometryContainer{HandGeometry->ToBasicHandModelImpl()};
FSGIC_FSGHandProfileImpl ProfileContainer{HandProfile->ToHandProfileImpl()};
FSGIC_FSGHandPoseImpl OutHandPoseContainer;
const bool bResult = SGCoreImpl_FSGSenseGloveImpl_GetHandPose_HandGeometry_HandProfile_OutHandPose(
&InstanceContainer, &HandGeometryContainer, &ProfileContainer, &OutHandPoseContainer);
if (bResult)
{
OutHandPose = USGHandPose::NewHandPose(Outer, MoveTemp(OutHandPoseContainer.HandPoseImpl));
}
FSGIC_TArray_TArray_FVector OutHandAnglesContainer;
const bool bResult = SGCoreImpl_FSGSenseGloveImpl_GetHandAngles(&InstanceContainer, &OutHandAnglesContainer);
OutHandAngles = MoveTemp(OutHandAnglesContainer.Array);
return bResult;
}
bool USGSenseGlove::GetHandPose(UObject* Outer, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose)
ESGHapticGloveCalibrationState USGSenseGlove::GetCalibrationState() const
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FSGHandProfileImpl ProfileContainer{HandProfile->ToHandProfileImpl()};
FSGIC_FSGHandPoseImpl OutHandPoseContainer;
const bool bResult = SGCoreImpl_FSGSenseGloveImpl_GetHandPose_HandProfile_OutHandPose(
&InstanceContainer, &ProfileContainer, &OutHandPoseContainer);
if (bResult)
{
OutHandPose = USGHandPose::NewHandPose(Outer, MoveTemp(OutHandPoseContainer.HandPoseImpl));
}
return bResult;
FSGIC_ESGHapticGloveCalibrationState OutHapticGloveCalibrationStateContainer;
SGCoreImpl_FSGSenseGloveImpl_GetCalibrationState(&InstanceContainer, &OutHapticGloveCalibrationStateContainer);
return MoveTemp(OutHapticGloveCalibrationStateContainer.State);
}
bool USGSenseGlove::SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand, const USGBuzzCommand* BuzzCommand,
ESGSenseGloveThumperCommand ThumperCommand)
void USGSenseGlove::EndCalibration()
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FSGForceFeedbackCommandImpl ForceFeedbackCommandContainer{
ForceFeedbackCommand->ToForceFeedbackCommandImpl().Get()
};
FSGIC_FSGBuzzCommandImpl BuzzCommandContainer{
BuzzCommand->ToBuzzCommandImpl().Get()
};
FSGIC_ESGSenseGloveThumperCommand ThumperCommandContainer{ThumperCommand};
const bool bResult =
SGCoreImpl_FSGSenseGloveImpl_SendHaptics_ForceFeedbackCommand_BuzzCommand_ESenseGloveThumperCommand(
&InstanceContainer, &ForceFeedbackCommandContainer, &BuzzCommandContainer, &ThumperCommandContainer);
return bResult;
SGCoreImpl_FSGSenseGloveImpl_EndCalibration(&InstanceContainer);
}
bool USGSenseGlove::SendHaptics(ESGSenseGloveThumperCommand ThumperCommand)
void USGSenseGlove::ResetCalibration()
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_ESGSenseGloveThumperCommand ThumperCommandContainer{ThumperCommand};
const bool bResult = SGCoreImpl_FSGSenseGloveImpl_SendHaptics_ThumperCommand(
&InstanceContainer, &ThumperCommandContainer);
return bResult;
SGCoreImpl_FSGSenseGloveImpl_ResetCalibration(&InstanceContainer);
}
void USGSenseGlove::SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand)
void USGSenseGlove::StopHaptics()
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FSGForceFeedbackCommandImpl ForceFeedbackCommandContainer{
ForceFeedbackCommand->ToForceFeedbackCommandImpl().Get()
};
SGCoreImpl_FSGSenseGloveImpl_SendHaptics_ForceFeedbackCommand(&InstanceContainer, &ForceFeedbackCommandContainer);
SGCoreImpl_FSGSenseGloveImpl_StopHaptics(&InstanceContainer);
}
void USGSenseGlove::SendHaptics(const USGBuzzCommand* BuzzCommand)
void USGSenseGlove::StopVibrations()
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FSGBuzzCommandImpl BuzzCommandContainer{BuzzCommand->ToBuzzCommandImpl().Get()};
SGCoreImpl_FSGSenseGloveImpl_SendHaptics_ForceFeedbackCommand(&InstanceContainer, &BuzzCommandContainer);
SGCoreImpl_FSGSenseGloveImpl_StopVibrations(&InstanceContainer);
}
void USGSenseGlove::SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand,
const USGBuzzCommand* BuzzCommand,
const USGThumperCommand* ThumperCommand)
bool USGSenseGlove::SendHaptics()
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FSGForceFeedbackCommandImpl ForceFeedbackCommandContainer{
ForceFeedbackCommand->ToForceFeedbackCommandImpl().Get()
};
FSGIC_FSGBuzzCommandImpl BuzzCommandContainer{BuzzCommand->ToBuzzCommandImpl().Get()};
FSGIC_FSGThumperCommandImpl ThumperCommandContainer{ThumperCommand->ToThumperCommandImpl()};
SGCoreImpl_FSGSenseGloveImpl_SendHaptics_ForceFeedbackCommand_BuzzCommand_ThumperCommand(
&InstanceContainer, &ForceFeedbackCommandContainer, &BuzzCommandContainer, &ThumperCommandContainer);
return SGCoreImpl_FSGSenseGloveImpl_SendHaptics(&InstanceContainer);
}
bool USGSenseGlove::GetCalibrationValues(TArray<FVector>& OutValues)
bool USGSenseGlove::QueueForceFeedbackLevels(const TArray<float>& Levels01)
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_TArray_FVector OutValuesContainer;
const bool bResult = SGCoreImpl_FSGSenseGloveImpl_GetCalibrationValues_OutValues(
&InstanceContainer, &OutValuesContainer);
if (bResult)
{
OutValues = MoveTemp(OutValuesContainer.Array);
}
return bResult;
FSGIC_TArray_float Levels01Container{Levels01};
return SGCoreImpl_FSGSenseGloveImpl_QueueForceFeedbackLevels(&InstanceContainer, &Levels01Container);
}
void USGSenseGlove::ResetCalibrationRange()
bool USGSenseGlove::QueueForceFeedbackLevel(const int32 Finger, const float Level01)
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
SGCoreImpl_FSGSenseGloveImpl_ResetCalibrationRange(&InstanceContainer);
}
void USGSenseGlove::ApplyCalibration(UObject* Outer, USGHandProfile*& OutProfile) const
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FSGHandProfileImpl OutProfileContainer;
SGCoreImpl_FSGSenseGloveImpl_ApplyCalibration_HandProfile(&InstanceContainer, &OutProfileContainer);
OutProfile = USGHandProfile::NewHandProfile(Outer, MoveTemp(OutProfileContainer.HandProfileImpl));
}
void USGSenseGlove::ApplyCalibration(UObject* Outer, USGSenseGloveHandProfile*& OutProfile) const
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FSGSenseGloveHandProfileImpl OutProfileContainer;
SGCoreImpl_FSGSenseGloveImpl_ApplyCalibration_SenseGloveHandProfile(&InstanceContainer, &OutProfileContainer);
OutProfile = USGSenseGloveHandProfile::NewSenseGloveHandProfile(
Outer, MoveTemp(OutProfileContainer.SenseGloveHandProfileImpl));
return SGCoreImpl_FSGSenseGloveImpl_QueueForceFeedbackLevel(&InstanceContainer, Finger, Level01);
}
void USGSenseGlove::GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
@@ -819,6 +711,105 @@ void USGSenseGlove::GetWristLocation(const FVector& ReferencePosition, const FRo
OutWristRotation = OutWristRotationContainer.Quat.Rotator();
}
USGSenseGloveInfo* USGSenseGlove::GetGloveInfo(UObject* Outer) const
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FSGSenseGloveInfoImpl OutGloveInfoContainer;
SGCoreImpl_FSGSenseGloveImpl_GetGloveInfo(&InstanceContainer, &OutGloveInfoContainer);
return USGSenseGloveInfo::NewSenseGloveInfo(Outer, MoveTemp(OutGloveInfoContainer.SenseGloveInfoImpl));
}
TArray<FVector> USGSenseGlove::GetFingerThimbleOffsets() const
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_TArray_FVector OutFingerThimbleOffsetsContainer;
SGCoreImpl_FSGSenseGloveImpl_GetFingerThimbleOffsets(&InstanceContainer, &OutFingerThimbleOffsetsContainer);
return MoveTemp(OutFingerThimbleOffsetsContainer.Array);
}
void USGSenseGlove::SetFingerThimbleOffset(const int32 Finger, const FVector& Offset)
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FVector OffsetContainer{Offset};
SGCoreImpl_FSGSenseGloveImpl_SetFingerThimbleOffset(&InstanceContainer, Finger, &OffsetContainer);
}
bool USGSenseGlove::SupportsWristActuator() const
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
return SGCoreImpl_FSGSenseGloveImpl_SupportsWristActuator(&InstanceContainer);
}
bool USGSenseGlove::GetSensorData(UObject* Outer, USGSenseGloveSensorData*& OutSensorData) const
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FSGSenseGloveSensorDataImpl OutSensorDataContainer;
const bool bResult = SGCoreImpl_FSGSenseGloveImpl_GetSensorData(&InstanceContainer, &OutSensorDataContainer);
if (bResult)
{
OutSensorData = USGSenseGloveSensorData::NewSenseGloveSensorData(
Outer, MoveTemp(OutSensorDataContainer.SenseGloveSensorDataImpl));
}
return bResult;
}
bool USGSenseGlove::GetGlovePose(UObject* Outer, USGSenseGlovePose*& OutGlovePose)
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FSGSenseGlovePoseImpl OutGlovePoseContainer;
const bool bResult = SGCoreImpl_FSGSenseGloveImpl_GetGlovePose_OutGlovePose(
&InstanceContainer, &OutGlovePoseContainer);
if (bResult)
{
OutGlovePose = USGSenseGlovePose::NewSenseGlovePose(
Outer, MoveTemp(OutGlovePoseContainer.SenseGlovePoseImpl));
}
return bResult;
}
bool USGSenseGlove::GetGlovePose(
UObject* Outer, const USGSenseGloveSensorData* SensorData, USGSenseGlovePose*& OutGlovePose)
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_FSGSenseGloveSensorDataImpl SensorDataContainer{SensorData->ToSenseGloveSensorDataImpl()};
FSGIC_FSGSenseGlovePoseImpl OutGlovePoseContainer;
const bool bResult = SGCoreImpl_FSGSenseGloveImpl_GetGlovePose_SensorData_OutGlovePose(
&InstanceContainer, &SensorDataContainer, &OutGlovePoseContainer);
if (bResult)
{
OutGlovePose = USGSenseGlovePose::NewSenseGlovePose(
Outer, MoveTemp(OutGlovePoseContainer.SenseGlovePoseImpl));
}
return bResult;
}
bool USGSenseGlove::QueueVibroLevels(const TArray<float>& Amplitudes)
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_TArray_float AmplitudesContainer{Amplitudes};
return SGCoreImpl_FSGSenseGloveImpl_QueueVibroLevels(&InstanceContainer, &AmplitudesContainer);
}
bool USGSenseGlove::QueueVibroLevel(const int32 Finger, const float Amplitude)
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
return SGCoreImpl_FSGSenseGloveImpl_QueueVibroLevel(&InstanceContainer, Finger, Amplitude);
}
bool USGSenseGlove::QueueThumperCommand(ESGSenseGloveThumperCommand Command)
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
FSGIC_ESGSenseGloveThumperCommand CommandContainer{Command};
return SGCoreImpl_FSGSenseGloveImpl_QueueThumperCommand(&InstanceContainer, &CommandContainer);
}
FString USGSenseGlove::ToString() const
{
FSGIC_TSharedPtr_FSGSenseGloveImpl InstanceContainer{ToSenseGloveImpl()};
@@ -1,256 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGSenseGloveHandProfile.h"
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGHandInterpolator.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGCoreImpl/SGSenseGloveHandProfileImpl.h"
#include "SGInterop/SGIC_ESGFingerSolver.h"
#include "SGInterop/SGIC_ESGThumbSolver.h"
#include "SGInterop/SGIC_FSGHandInterpolatorImpl.h"
#include "SGInterop/SGIC_FSGSenseGloveHandProfileImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_FVector.h"
#include "SGInterop/SGIC_TArray_FVector.h"
struct USGSenseGloveHandProfile::FImpl
{
/************************
* Member variables
************************/
FSGSenseGloveHandProfileImpl SenseGloveHandProfileImpl;
/************************
* Owner object
************************/
USGSenseGloveHandProfile* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGSenseGloveHandProfile* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGSenseGloveHandProfile* USGSenseGloveHandProfile::NewSenseGloveHandProfile(
UObject* Outer, const FSGSenseGloveHandProfileImpl& SenseGloveHandProfileImpl)
{
USGSenseGloveHandProfile* Instance = NewObject<USGSenseGloveHandProfile>(Outer);
Instance->SetSenseGloveHandProfileImpl(SenseGloveHandProfileImpl);
return Instance;
}
USGSenseGloveHandProfile* USGSenseGloveHandProfile::NewSenseGloveHandProfile(UObject* Outer)
{
FSGIC_FSGSenseGloveHandProfileImpl OutSenseGloveHandProfileImplContainer;
SGCoreImpl_FSGSenseGloveHandProfileImpl_ctor(&OutSenseGloveHandProfileImplContainer);
return NewSenseGloveHandProfile(Outer, MoveTemp(OutSenseGloveHandProfileImplContainer.SenseGloveHandProfileImpl));
}
USGSenseGloveHandProfile* USGSenseGloveHandProfile::NewSenseGloveHandProfile(
UObject* Outer, const bool bRightHanded, const USGHandInterpolator* Interpolator,
const ESGThumbSolver ThumbSolver, const ESGFingerSolver FingerSolver, const TArray<FVector>& FingerThimbleOffset)
{
FSGIC_FSGSenseGloveHandProfileImpl OutSenseGloveHandProfileImplContainer;
FSGIC_FSGHandInterpolatorImpl InterpolatorContainer{Interpolator->ToHandInterpolatorImpl()};
FSGIC_ESGThumbSolver ThumbSolverContainer{ThumbSolver};
FSGIC_ESGFingerSolver FingerSolverContainer{FingerSolver};
FSGIC_TArray_FVector FingerThimbleOffsetContainer{FingerThimbleOffset};
SGCoreImpl_FSGSenseGloveHandProfileImpl_ctor_bRightHanded_Interpolator_ThumbSolver_FingerSolver_FingerThimbleOffset(
&OutSenseGloveHandProfileImplContainer, bRightHanded, &InterpolatorContainer,
&ThumbSolverContainer, &FingerSolverContainer, &FingerThimbleOffsetContainer);
return NewSenseGloveHandProfile(Outer, MoveTemp(OutSenseGloveHandProfileImplContainer.SenseGloveHandProfileImpl));
}
USGSenseGloveHandProfile* USGSenseGloveHandProfile::Default(UObject* Outer, const bool bRightHanded)
{
FSGIC_FSGSenseGloveHandProfileImpl OutSenseGloveHandProfileImplContainer;
SGCoreImpl_FSGSenseGloveHandProfileImpl_Default(&OutSenseGloveHandProfileImplContainer, bRightHanded);
return NewSenseGloveHandProfile(Outer, MoveTemp(OutSenseGloveHandProfileImplContainer.SenseGloveHandProfileImpl));
}
USGSenseGloveHandProfile* USGSenseGloveHandProfile::Deserialize(UObject* Outer, const FString& SerializedString)
{
FSGIC_FSGSenseGloveHandProfileImpl OutSenseGloveHandProfileImplContainer;
FSGIC_FString SerializedStringContainer{SerializedString};
SGCoreImpl_FSGSenseGloveHandProfileImpl_Deserialize(&OutSenseGloveHandProfileImplContainer,
&SerializedStringContainer);
return NewSenseGloveHandProfile(Outer, MoveTemp(OutSenseGloveHandProfileImplContainer.SenseGloveHandProfileImpl));
}
FVector USGSenseGloveHandProfile::GetDefaultThimbleOffset()
{
FSGIC_FVector OutOffsetContainer;
SGCoreImpl_FSGSenseGloveHandProfileImpl_GetDefaultThimbleOffset(&OutOffsetContainer);
return MoveTemp(OutOffsetContainer.Vector);
}
USGSenseGloveHandProfile::USGSenseGloveHandProfile()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGSenseGloveHandProfileImpl OutSenseGloveHandProfileImplContainer;
SGCoreImpl_FSGSenseGloveHandProfileImpl_ctor(&OutSenseGloveHandProfileImplContainer);
Pimpl->SenseGloveHandProfileImpl = MoveTemp(OutSenseGloveHandProfileImplContainer.SenseGloveHandProfileImpl);
}
USGSenseGloveHandProfile::USGSenseGloveHandProfile(const bool bRightHanded, const USGHandInterpolator* Interpolator,
const ESGThumbSolver ThumbSolver, const ESGFingerSolver FingerSolver,
const TArray<FVector>& FingerThimbleOffset)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGSenseGloveHandProfileImpl OutSenseGloveHandProfileImplContainer;
FSGIC_FSGHandInterpolatorImpl InterpolatorContainer{Interpolator->ToHandInterpolatorImpl()};
FSGIC_ESGThumbSolver ThumbSolverContainer{ThumbSolver};
FSGIC_ESGFingerSolver FingerSolverContainer{FingerSolver};
FSGIC_TArray_FVector FingerThimbleOffsetContainer{FingerThimbleOffset};
SGCoreImpl_FSGSenseGloveHandProfileImpl_ctor_bRightHanded_Interpolator_ThumbSolver_FingerSolver_FingerThimbleOffset(
&OutSenseGloveHandProfileImplContainer, bRightHanded, &InterpolatorContainer,
&ThumbSolverContainer, &FingerSolverContainer, &FingerThimbleOffsetContainer);
Pimpl->SenseGloveHandProfileImpl = MoveTemp(OutSenseGloveHandProfileImplContainer.SenseGloveHandProfileImpl);
}
USGSenseGloveHandProfile::USGSenseGloveHandProfile(const FSGSenseGloveHandProfileImpl& SenseGloveHandProfileImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
SetSenseGloveHandProfileImpl(SenseGloveHandProfileImpl);
}
USGSenseGloveHandProfile::~USGSenseGloveHandProfile() = default;
void USGSenseGloveHandProfile::SetSenseGloveHandProfileImpl(
const FSGSenseGloveHandProfileImpl& SenseGloveHandProfileImpl)
{
FSGIC_FSGSenseGloveHandProfileImpl OutSenseGloveHandProfileContainer;
FSGIC_FSGSenseGloveHandProfileImpl RhsContainer{SenseGloveHandProfileImpl};
SGCoreImpl_FSGSenseGloveHandProfileImpl_ctor_copy(&OutSenseGloveHandProfileContainer, &RhsContainer);
Pimpl->SenseGloveHandProfileImpl = MoveTemp(OutSenseGloveHandProfileContainer.SenseGloveHandProfileImpl);
}
const FSGSenseGloveHandProfileImpl& USGSenseGloveHandProfile::ToSenseGloveHandProfileImpl() const
{
return Pimpl->SenseGloveHandProfileImpl;
}
bool USGSenseGloveHandProfile::IsRight() const
{
FSGIC_FSGSenseGloveHandProfileImpl InstanceContainer{ToSenseGloveHandProfileImpl()};
return SGCoreImpl_FSGSenseGloveHandProfileImpl_IsRight(&InstanceContainer);
}
USGHandInterpolator* USGSenseGloveHandProfile::GetInterpolationSet(UObject* Outer) const
{
FSGIC_FSGSenseGloveHandProfileImpl InstanceContainer{ToSenseGloveHandProfileImpl()};
FSGIC_FSGHandInterpolatorImpl OutSetContainer;
SGCoreImpl_FSGSenseGloveHandProfileImpl_GetInterpolationSet(&InstanceContainer, &OutSetContainer);
return USGHandInterpolator::NewHandInterpolator(Outer, MoveTemp(OutSetContainer.HandInterpolatorImpl));
}
ESGThumbSolver USGSenseGloveHandProfile::GetThumbSolver() const
{
FSGIC_FSGSenseGloveHandProfileImpl InstanceContainer{ToSenseGloveHandProfileImpl()};
FSGIC_ESGThumbSolver OutSolverContainer;
SGCoreImpl_FSGSenseGloveHandProfileImpl_GetThumbSolver(&InstanceContainer, &OutSolverContainer);
return OutSolverContainer.Solver;
}
ESGFingerSolver USGSenseGloveHandProfile::GetFingerSolver() const
{
FSGIC_FSGSenseGloveHandProfileImpl InstanceContainer{ToSenseGloveHandProfileImpl()};
FSGIC_ESGFingerSolver OutSolverContainer;
SGCoreImpl_FSGSenseGloveHandProfileImpl_GetFingerSolver(&InstanceContainer, &OutSolverContainer);
return OutSolverContainer.Solver;
}
TArray<FVector> USGSenseGloveHandProfile::GetFingerThimbleOffset() const
{
FSGIC_FSGSenseGloveHandProfileImpl InstanceContainer{ToSenseGloveHandProfileImpl()};
FSGIC_TArray_FVector OutOffsetContainer;
SGCoreImpl_FSGSenseGloveHandProfileImpl_GetFingerThimbleOffset(&InstanceContainer, &OutOffsetContainer);
return MoveTemp(OutOffsetContainer.Array);
}
bool USGSenseGloveHandProfile::Equals(const USGSenseGloveHandProfile* SenseGloveHandProfile) const
{
FSGIC_FSGSenseGloveHandProfileImpl InstanceContainer{ToSenseGloveHandProfileImpl()};
FSGIC_FSGSenseGloveHandProfileImpl SenseGloveHandProfileContainer{
SenseGloveHandProfile->ToSenseGloveHandProfileImpl()};
return SGCoreImpl_FSGSenseGloveHandProfileImpl_Equals(&InstanceContainer, &SenseGloveHandProfileContainer);
}
void USGSenseGloveHandProfile::Reset()
{
FSGIC_FSGSenseGloveHandProfileImpl InstanceContainer{ToSenseGloveHandProfileImpl()};
SGCoreImpl_FSGSenseGloveHandProfileImpl_Reset(&InstanceContainer);
}
FString USGSenseGloveHandProfile::SGSerialize() const
{
FSGIC_FSGSenseGloveHandProfileImpl InstanceContainer{ToSenseGloveHandProfileImpl()};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGSenseGloveHandProfileImpl_Serialize(&InstanceContainer, &OutStringContainer);
return MoveTemp(OutStringContainer.String);
}
USGSenseGloveHandProfile::FImpl::FImpl(USGSenseGloveHandProfile* InOwner)
: Owner(InOwner)
{
}
USGSenseGloveHandProfile::FImpl::~FImpl() = default;
void USGSenseGloveHandProfile::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -520,14 +520,6 @@ bool USGSenseGloveInfo::Equals(const USGSenseGloveInfo* SenseGloveInfo) const
return SGCoreImpl_FSGSenseGloveInfoImpl_Equals(&InstanceContainer, &SenseGloveInfoImplContainer);
}
FString USGSenseGloveInfo::ToString() const
{
FSGIC_FSGSenseGloveInfoImpl InstanceContainer{ToSenseGloveInfoImpl()};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGSenseGloveInfoImpl_ToString(&InstanceContainer, &OutStringContainer);
return MoveTemp(OutStringContainer.String);
}
FString USGSenseGloveInfo::ToString(const bool bShortNotation) const
{
FSGIC_FSGSenseGloveInfoImpl InstanceContainer{ToSenseGloveInfoImpl()};
@@ -536,6 +528,14 @@ FString USGSenseGloveInfo::ToString(const bool bShortNotation) const
return MoveTemp(OutStringContainer.String);
}
FString USGSenseGloveInfo::ToString() const
{
FSGIC_FSGSenseGloveInfoImpl InstanceContainer{ToSenseGloveInfoImpl()};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGSenseGloveInfoImpl_ToString(&InstanceContainer, &OutStringContainer);
return MoveTemp(OutStringContainer.String);
}
FString USGSenseGloveInfo::SGSerialize() const
{
FSGIC_FSGSenseGloveInfoImpl InstanceContainer{ToSenseGloveInfoImpl()};
@@ -37,11 +37,9 @@
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGSenseGloveHandProfile.h"
#include "SGCore/SGSenseGloveInfo.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGCoreImpl/SGSenseGlovePoseImpl.h"
#include "SGInterop/SGIC_FSGSenseGloveHandProfileImpl.h"
#include "SGInterop/SGIC_FSGSenseGloveInfoImpl.h"
#include "SGInterop/SGIC_FSGSenseGlovePoseImpl.h"
#include "SGInterop/SGIC_FString.h"
@@ -367,25 +365,14 @@ TArray<FVector> USGSenseGlovePose::GetTotalGloveAngles() const
return MoveTemp(OutAnglesContainer.Array);
}
TArray<FVector> USGSenseGlovePose::CalculateFingerTips(const USGSenseGloveHandProfile* SenseGloveHandProfile) const
TArray<FVector> USGSenseGlovePose::CalculateFingertips(const TArray<FVector>& FingerOffsets) const
{
FSGIC_FSGSenseGlovePoseImpl InstanceContainer{ToSenseGlovePoseImpl()};
FSGIC_TArray_FVector OutFingerTipsContainer;
FSGIC_FSGSenseGloveHandProfileImpl SenseGloveHandProfileImplContainer{
SenseGloveHandProfile->ToSenseGloveHandProfileImpl()};
SGCoreImpl_FSGSenseGlovePoseImpl_CalculateFingerTips_SenseGloveHandProfileImpl(
&InstanceContainer, &OutFingerTipsContainer, &SenseGloveHandProfileImplContainer);
return MoveTemp(OutFingerTipsContainer.Array);
}
TArray<FVector> USGSenseGlovePose::CalculateFingerTips(const TArray<FVector>& FingerOffsets) const
{
FSGIC_FSGSenseGlovePoseImpl InstanceContainer{ToSenseGlovePoseImpl()};
FSGIC_TArray_FVector OutFingerTipsContainer;
FSGIC_TArray_FVector OutFingertipsContainer;
FSGIC_TArray_FVector FingerOffsetsContainer{FingerOffsets};
SGCoreImpl_FSGSenseGlovePoseImpl_CalculateFingerTips_FingerOffsets(&InstanceContainer, &OutFingerTipsContainer,
&FingerOffsetsContainer);
return MoveTemp(OutFingerTipsContainer.Array);
SGCoreImpl_FSGSenseGlovePoseImpl_CalculateFingertips(&InstanceContainer, &OutFingertipsContainer,
&FingerOffsetsContainer);
return MoveTemp(OutFingertipsContainer.Array);
}
bool USGSenseGlovePose::Equals(const USGSenseGlovePose* SenseGlovePose) const
@@ -271,6 +271,24 @@ TArray<TArray<float>> USGSenseGloveSensorData::GetSensorAngles() const
return MoveTemp(OutAnglesContainer.Array);
}
TArray<float> USGSenseGloveSensorData::GetSensorAngles(const ESGFinger Finger) const
{
FSGIC_FSGSenseGloveSensorDataImpl InstanceContainer{ToSenseGloveSensorDataImpl()};
FSGIC_TArray_float OutAnglesContainer;
FSGIC_ESGFinger FingerContainer{Finger};
SGCoreImpl_FSGSenseGloveSensorDataImpl_GetSensorAngles_Finger(&InstanceContainer, &OutAnglesContainer,
&FingerContainer);
return MoveTemp(OutAnglesContainer.Array);
}
TArray<float> USGSenseGloveSensorData::GetAngleSequence() const
{
FSGIC_FSGSenseGloveSensorDataImpl InstanceContainer{ToSenseGloveSensorDataImpl()};
FSGIC_TArray_float OutSequenceContainer;
SGCoreImpl_FSGSenseGloveSensorDataImpl_GetAngleSequence(&InstanceContainer, &OutSequenceContainer);
return MoveTemp(OutSequenceContainer.Array);
}
FQuat USGSenseGloveSensorData::GetImuRotationQ() const
{
FSGIC_FSGSenseGloveSensorDataImpl InstanceContainer{ToSenseGloveSensorDataImpl()};
@@ -299,24 +317,6 @@ bool USGSenseGloveSensorData::IsImuParsed() const
return SGCoreImpl_FSGSenseGloveSensorDataImpl_IsImuParsed(&InstanceContainer);
}
TArray<float> USGSenseGloveSensorData::GetSensorAngles(const ESGFinger Finger) const
{
FSGIC_FSGSenseGloveSensorDataImpl InstanceContainer{ToSenseGloveSensorDataImpl()};
FSGIC_TArray_float OutAnglesContainer;
FSGIC_ESGFinger FingerContainer{Finger};
SGCoreImpl_FSGSenseGloveSensorDataImpl_GetSensorAngles_Finger(&InstanceContainer, &OutAnglesContainer,
&FingerContainer);
return MoveTemp(OutAnglesContainer.Array);
}
TArray<float> USGSenseGloveSensorData::GetAngleSequence() const
{
FSGIC_FSGSenseGloveSensorDataImpl InstanceContainer{ToSenseGloveSensorDataImpl()};
FSGIC_TArray_float OutSequenceContainer;
SGCoreImpl_FSGSenseGloveSensorDataImpl_GetAngleSequence(&InstanceContainer, &OutSequenceContainer);
return MoveTemp(OutSequenceContainer.Array);
}
bool USGSenseGloveSensorData::Equals(const USGSenseGloveSensorData* SenseGloveSensorData) const
{
FSGIC_FSGSenseGloveSensorDataImpl InstanceContainer{ToSenseGloveSensorDataImpl()};
@@ -0,0 +1,172 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGSenseGloveSensorNormalizer.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGCoreImpl/SGSenseGloveSensorNormalizerImpl.h"
#include "SGInterop/SGIC_FSGSenseGloveSensorNormalizerImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_TArray_bool.h"
#include "SGInterop/SGIC_TArray_float.h"
#include "SGUtils/SGArrayUtils.h"
struct USGSenseGloveSensorNormalizer::FImpl
{
/************************
* Member variables
************************/
FSGSenseGloveSensorNormalizerImpl SenseGloveSensorNormalizerImpl;
/************************
* Owner object
************************/
USGSenseGloveSensorNormalizer* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGSenseGloveSensorNormalizer* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGSenseGloveSensorNormalizer* USGSenseGloveSensorNormalizer::NewSenseGloveSensorNormalizer(
UObject* Outer, const FSGSenseGloveSensorNormalizerImpl& SenseGloveSensorNormalizerImpl)
{
USGSenseGloveSensorNormalizer* Instance = NewObject<USGSenseGloveSensorNormalizer>(Outer);
Instance->SetSenseGloveSensorNormalizerImpl(SenseGloveSensorNormalizerImpl);
return Instance;
}
USGSenseGloveSensorNormalizer* USGSenseGloveSensorNormalizer::NewSenseGloveSensorNormalizer(UObject* Outer)
{
FSGIC_FSGSenseGloveSensorNormalizerImpl OutSenseGloveSensorNormalizerImplContainer;
SGCoreImpl_FSGSenseGloveSensorNormalizerImpl_ctor(&OutSenseGloveSensorNormalizerImplContainer);
return NewSenseGloveSensorNormalizer(
Outer, MoveTemp(OutSenseGloveSensorNormalizerImplContainer.SenseGloveSensorNormalizerImpl));
}
USGSenseGloveSensorNormalizer* USGSenseGloveSensorNormalizer::NewSenseGloveSensorNormalizer(
UObject* Outer, const bool bRightHanded)
{
FSGIC_FSGSenseGloveSensorNormalizerImpl OutSenseGloveSensorNormalizerImplContainer;
SGCoreImpl_FSGSenseGloveSensorNormalizerImpl_ctor_bRightHanded(
&OutSenseGloveSensorNormalizerImplContainer, bRightHanded);
return NewSenseGloveSensorNormalizer(
Outer, MoveTemp(OutSenseGloveSensorNormalizerImplContainer.SenseGloveSensorNormalizerImpl));
}
USGSenseGloveSensorNormalizer::USGSenseGloveSensorNormalizer()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGSenseGloveSensorNormalizerImpl OutSenseGloveSensorNormalizerImplContainer;
SGCoreImpl_FSGSenseGloveSensorNormalizerImpl_ctor(&OutSenseGloveSensorNormalizerImplContainer);
Pimpl->SenseGloveSensorNormalizerImpl = MoveTemp(
OutSenseGloveSensorNormalizerImplContainer.SenseGloveSensorNormalizerImpl);
}
USGSenseGloveSensorNormalizer::USGSenseGloveSensorNormalizer(bool bRightHanded)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGSenseGloveSensorNormalizerImpl OutSenseGloveSensorNormalizerImplContainer;
SGCoreImpl_FSGSenseGloveSensorNormalizerImpl_ctor_bRightHanded(
&OutSenseGloveSensorNormalizerImplContainer, bRightHanded);
Pimpl->SenseGloveSensorNormalizerImpl =
MoveTemp(OutSenseGloveSensorNormalizerImplContainer.SenseGloveSensorNormalizerImpl);
}
USGSenseGloveSensorNormalizer::USGSenseGloveSensorNormalizer(
const FSGSenseGloveSensorNormalizerImpl& SenseGloveSensorNormalizerImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
SetSenseGloveSensorNormalizerImpl(SenseGloveSensorNormalizerImpl);
}
USGSenseGloveSensorNormalizer::~USGSenseGloveSensorNormalizer() = default;
void USGSenseGloveSensorNormalizer::SetSenseGloveSensorNormalizerImpl(
const FSGSenseGloveSensorNormalizerImpl& SenseGloveSensorNormalizerImpl)
{
FSGIC_FSGSenseGloveSensorNormalizerImpl OutSenseGloveSensorNormalizerContainer;
FSGIC_FSGSenseGloveSensorNormalizerImpl RhsContainer{SenseGloveSensorNormalizerImpl};
SGCoreImpl_FSGSenseGloveSensorNormalizerImpl_ctor_copy(&OutSenseGloveSensorNormalizerContainer, &RhsContainer);
Pimpl->SenseGloveSensorNormalizerImpl = MoveTemp(
OutSenseGloveSensorNormalizerContainer.SenseGloveSensorNormalizerImpl);
}
const FSGSenseGloveSensorNormalizerImpl& USGSenseGloveSensorNormalizer::ToSenseGloveSensorNormalizerImpl() const
{
return Pimpl->SenseGloveSensorNormalizerImpl;
}
float USGSenseGloveSensorNormalizer::NormalizeFlexion(const int32 Finger, const float SumFlexionAngles) const
{
FSGIC_FSGSenseGloveSensorNormalizerImpl InstanceContainer{ToSenseGloveSensorNormalizerImpl()};
return SGCoreImpl_FSGSenseGloveSensorNormalizerImpl_NormalizeFlexion(
&InstanceContainer, Finger, SumFlexionAngles);
}
float USGSenseGloveSensorNormalizer::NormalizeAbduction(const int32 Finger, const float SumAbductionAngles) const
{
FSGIC_FSGSenseGloveSensorNormalizerImpl InstanceContainer{ToSenseGloveSensorNormalizerImpl()};
return SGCoreImpl_FSGSenseGloveSensorNormalizerImpl_NormalizeAbduction(
&InstanceContainer, Finger, SumAbductionAngles);
}
USGSenseGloveSensorNormalizer::FImpl::FImpl(USGSenseGloveSensorNormalizer* InOwner)
: Owner(InOwner)
{
}
USGSenseGloveSensorNormalizer::FImpl::~FImpl() = default;
void USGSenseGloveSensorNormalizer::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -0,0 +1,228 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGSensorNormalization.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGCoreImpl/SGSensorNormalizationImpl.h"
#include "SGInterop/SGIC_FSGSensorNormalizationImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_TArray_bool.h"
#include "SGInterop/SGIC_TArray_float.h"
#include "SGUtils/SGArrayUtils.h"
struct USGSensorNormalization::FImpl
{
/************************
* Member variables
************************/
FSGSensorNormalizationImpl SensorNormalizationImpl;
/************************
* Owner object
************************/
USGSensorNormalization* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGSensorNormalization* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGSensorNormalization* USGSensorNormalization::NewSensorNormalization(
UObject* Outer, const FSGSensorNormalizationImpl& SensorNormalizationImpl)
{
USGSensorNormalization* Instance = NewObject<USGSensorNormalization>(Outer);
Instance->SetSensorNormalizationImpl(SensorNormalizationImpl);
return Instance;
}
USGSensorNormalization* USGSensorNormalization::NewSensorNormalization(UObject* Outer)
{
FSGIC_FSGSensorNormalizationImpl OutSensorNormalizationImplContainer;
SGCoreImpl_FSGSensorNormalizationImpl_ctor(&OutSensorNormalizationImplContainer);
return NewSensorNormalization(Outer, MoveTemp(OutSensorNormalizationImplContainer.SensorNormalizationImpl));
}
USGSensorNormalization* USGSensorNormalization::NewSensorNormalization(
UObject* Outer, const TArray<float>& MovementRanges)
{
FSGIC_FSGSensorNormalizationImpl OutSensorNormalizationImplContainer;
FSGIC_TArray_float MovementRangesContainer{MovementRanges};
SGCoreImpl_FSGSensorNormalizationImpl_ctor_MovementRanges(
&OutSensorNormalizationImplContainer, &MovementRangesContainer);
return NewSensorNormalization(Outer, MoveTemp(OutSensorNormalizationImplContainer.SensorNormalizationImpl));
}
USGSensorNormalization::USGSensorNormalization()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGSensorNormalizationImpl OutSensorNormalizationImplContainer;
SGCoreImpl_FSGSensorNormalizationImpl_ctor(&OutSensorNormalizationImplContainer);
Pimpl->SensorNormalizationImpl = MoveTemp(OutSensorNormalizationImplContainer.SensorNormalizationImpl);
}
USGSensorNormalization::USGSensorNormalization(const TArray<float>& MovementRanges)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGSensorNormalizationImpl OutSensorNormalizationImplContainer;
FSGIC_TArray_float MovementRangesContainer{MovementRanges};
SGCoreImpl_FSGSensorNormalizationImpl_ctor_MovementRanges(
&OutSensorNormalizationImplContainer, &MovementRangesContainer);
Pimpl->SensorNormalizationImpl = MoveTemp(OutSensorNormalizationImplContainer.SensorNormalizationImpl);
}
USGSensorNormalization::USGSensorNormalization(const FSGSensorNormalizationImpl& SensorNormalizationImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
SetSensorNormalizationImpl(SensorNormalizationImpl);
}
USGSensorNormalization::~USGSensorNormalization() = default;
void USGSensorNormalization::SetSensorNormalizationImpl(const FSGSensorNormalizationImpl& SensorNormalizationImpl)
{
FSGIC_FSGSensorNormalizationImpl OutSensorNormalizationContainer;
FSGIC_FSGSensorNormalizationImpl RhsContainer{SensorNormalizationImpl};
SGCoreImpl_FSGSensorNormalizationImpl_ctor_copy(&OutSensorNormalizationContainer, &RhsContainer);
Pimpl->SensorNormalizationImpl = MoveTemp(OutSensorNormalizationContainer.SensorNormalizationImpl);
}
const FSGSensorNormalizationImpl& USGSensorNormalization::ToSensorNormalizationImpl() const
{
return Pimpl->SensorNormalizationImpl;
}
bool USGSensorNormalization::CollectsNormalization() const
{
FSGIC_FSGSensorNormalizationImpl InstanceContainer{ToSensorNormalizationImpl()};
return SGCoreImpl_FSGSensorNormalizationImpl_CollectsNormalization(&InstanceContainer);
}
void USGSensorNormalization::SetCollectNormalization(const bool bCollectNormalization)
{
FSGIC_FSGSensorNormalizationImpl InstanceContainer{ToSensorNormalizationImpl()};
SGCoreImpl_FSGSensorNormalizationImpl_SetCollectNormalization(
&InstanceContainer, bCollectNormalization);
}
int32 USGSensorNormalization::GetLength() const
{
FSGIC_FSGSensorNormalizationImpl InstanceContainer{ToSensorNormalizationImpl()};
return SGCoreImpl_FSGSensorNormalizationImpl_GetLength(&InstanceContainer);
}
int32 USGSensorNormalization::GetMoveCount() const
{
FSGIC_FSGSensorNormalizationImpl InstanceContainer{ToSensorNormalizationImpl()};
return SGCoreImpl_FSGSensorNormalizationImpl_GetMoveCount(&InstanceContainer);
}
bool USGSensorNormalization::AllSensorsMoving() const
{
FSGIC_FSGSensorNormalizationImpl InstanceContainer{ToSensorNormalizationImpl()};
return SGCoreImpl_FSGSensorNormalizationImpl_AllSensorsMoving(&InstanceContainer);
}
void USGSensorNormalization::ResetNormalization()
{
FSGIC_FSGSensorNormalizationImpl InstanceContainer{ToSensorNormalizationImpl()};
return SGCoreImpl_FSGSensorNormalizationImpl_ResetNormalization(&InstanceContainer);
}
void USGSensorNormalization::UpdateNormalization(const float Value, const int32 Index)
{
FSGIC_FSGSensorNormalizationImpl InstanceContainer{ToSensorNormalizationImpl()};
return SGCoreImpl_FSGSensorNormalizationImpl_UpdateNormalization(
&InstanceContainer, Value, Index);
}
float USGSensorNormalization::NormalizeValue(const float Value, const int32 Index)
{
FSGIC_FSGSensorNormalizationImpl InstanceContainer{ToSensorNormalizationImpl()};
return SGCoreImpl_FSGSensorNormalizationImpl_NormalizeValue(
&InstanceContainer, Value, Index);
}
TArray<float> USGSensorNormalization::NormalizeValues(const TArray<float>& Values)
{
FSGIC_FSGSensorNormalizationImpl InstanceContainer{ToSensorNormalizationImpl()};
FSGIC_TArray_float ValuesContainer{Values};
FSGIC_TArray_float OutNormalizedValuesContainer;
SGCoreImpl_FSGSensorNormalizationImpl_NormalizeValues(
&InstanceContainer, &ValuesContainer, &OutNormalizedValuesContainer);
return MoveTemp(OutNormalizedValuesContainer.Array);
}
bool USGSensorNormalization::MovedEnough(const int32 Index) const
{
FSGIC_FSGSensorNormalizationImpl InstanceContainer{ToSensorNormalizationImpl()};
return SGCoreImpl_FSGSensorNormalizationImpl_MovedEnough(&InstanceContainer, Index);
}
float USGSensorNormalization::Denormalize(const float Value01, const int32 Index, const float FallbackValue) const
{
FSGIC_FSGSensorNormalizationImpl InstanceContainer{ToSensorNormalizationImpl()};
return SGCoreImpl_FSGSensorNormalizationImpl_Denormalize(
&InstanceContainer, Value01, Index, FallbackValue);
}
USGSensorNormalization::FImpl::FImpl(USGSensorNormalization* InOwner)
: Owner(InOwner)
{
}
USGSensorNormalization::FImpl::~FImpl() = default;
void USGSensorNormalization::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -1,262 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGSensorRange.h"
#include "Runtime/Launch/Resources/Version.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_FSGSensorRangeImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_FVector.h"
#include "SGInterop/SGIC_TArray_FVector.h"
struct USGSensorRange::FImpl
{
/************************
* Member variables
************************/
FSGSensorRangeImpl SensorRangeImpl;
/************************
* Owner object
************************/
USGSensorRange* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGSensorRange* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGSensorRange* USGSensorRange::NewSensorRange(UObject* Outer, const FSGSensorRangeImpl& SensorRangeImpl)
{
USGSensorRange* Instance = NewObject<USGSensorRange>(Outer);
Instance->SetSensorRangeImpl(SensorRangeImpl);
return Instance;
}
USGSensorRange* USGSensorRange::NewSensorRange(UObject* Outer)
{
FSGIC_FSGSensorRangeImpl OutSensorRangeImplContainer;
SGCoreImpl_FSGSensorRangeImpl_ctor(&OutSensorRangeImplContainer);
return NewSensorRange(Outer, MoveTemp(OutSensorRangeImplContainer.SensorRangeImpl));
}
USGSensorRange* USGSensorRange::NewSensorRange(UObject* Outer,
const TArray<FVector>& MinValues, const TArray<FVector>& MaxValues)
{
FSGIC_FSGSensorRangeImpl OutSensorRangeImplContainer;
FSGIC_TArray_FVector MinValuesContainer{MinValues};
FSGIC_TArray_FVector MaxValuesContainer{MaxValues};
SGCoreImpl_FSGSensorRangeImpl_ctor_MinValues_MaxValues(
&OutSensorRangeImplContainer, &MinValuesContainer, &MaxValuesContainer);
return NewSensorRange(Outer, MoveTemp(OutSensorRangeImplContainer.SensorRangeImpl));
}
USGSensorRange* USGSensorRange::ForCalibration(UObject* Outer)
{
FSGIC_FSGSensorRangeImpl OutSensorRangeImplContainer;
SGCoreImpl_FSGSensorRangeImpl_ForCalibration(&OutSensorRangeImplContainer);
return NewSensorRange(Outer, MoveTemp(OutSensorRangeImplContainer.SensorRangeImpl));
}
USGSensorRange* USGSensorRange::Deserialize(UObject* Outer, const FString& SerializedString)
{
FSGIC_FSGSensorRangeImpl OutSensorRangeImplContainer;
FSGIC_FString SerializedStringContainer{SerializedString};
SGCoreImpl_FSGSensorRangeImpl_Deserialize(&OutSensorRangeImplContainer, &SerializedStringContainer);
return NewSensorRange(Outer, MoveTemp(OutSensorRangeImplContainer.SensorRangeImpl));
}
void USGSensorRange::CheckMax(const FVector CurrentValues, FVector& OutMaxValues)
{
FSGIC_FVector CurrentValuesContainer{CurrentValues};
FSGIC_FVector OutMaxValuesContainer;
SGCoreImpl_FSGSensorRangeImpl_CheckMax(&CurrentValuesContainer, &OutMaxValuesContainer);
OutMaxValues = MoveTemp(OutMaxValuesContainer.Vector);
}
void USGSensorRange::CheckMin(const FVector& CurrentValues, FVector& OutMinValues)
{
FSGIC_FVector CurrentValuesContainer{CurrentValues};
FSGIC_FVector OutMinValuesContainer;
SGCoreImpl_FSGSensorRangeImpl_CheckMin(&CurrentValuesContainer, &OutMinValuesContainer);
OutMinValues = MoveTemp(OutMinValuesContainer.Vector);
}
USGSensorRange::USGSensorRange()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGSensorRangeImpl OutSensorRangeImplContainer;
SGCoreImpl_FSGSensorRangeImpl_ctor(&OutSensorRangeImplContainer);
Pimpl->SensorRangeImpl = MoveTemp(OutSensorRangeImplContainer.SensorRangeImpl);
}
USGSensorRange::USGSensorRange(const TArray<FVector>& MinValues, const TArray<FVector>& MaxValues)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGSensorRangeImpl OutSensorRangeImplContainer;
FSGIC_TArray_FVector MinValuesContainer{MinValues};
FSGIC_TArray_FVector MaxValuesContainer{MaxValues};
SGCoreImpl_FSGSensorRangeImpl_ctor_MinValues_MaxValues(
&OutSensorRangeImplContainer, &MinValuesContainer, &MaxValuesContainer);
Pimpl->SensorRangeImpl = MoveTemp(OutSensorRangeImplContainer.SensorRangeImpl);
}
USGSensorRange::USGSensorRange(const FSGSensorRangeImpl& SensorRangeImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
SetSensorRangeImpl(SensorRangeImpl);
}
USGSensorRange::~USGSensorRange() = default;
void USGSensorRange::SetSensorRangeImpl(const FSGSensorRangeImpl& SensorRangeImpl)
{
FSGIC_FSGSensorRangeImpl OutSensorRangeContainer;
FSGIC_FSGSensorRangeImpl RhsContainer{SensorRangeImpl};
SGCoreImpl_FSGSensorRangeImpl_ctor_copy(&OutSensorRangeContainer, &RhsContainer);
Pimpl->SensorRangeImpl = MoveTemp(OutSensorRangeContainer.SensorRangeImpl);
}
const FSGSensorRangeImpl& USGSensorRange::ToSensorRangeImpl() const
{
return Pimpl->SensorRangeImpl;
}
TArray<FVector> USGSensorRange::GetMinValues() const
{
FSGIC_FSGSensorRangeImpl InstanceContainer{ToSensorRangeImpl()};
FSGIC_TArray_FVector OutMinValuesContainer;
SGCoreImpl_FSGSensorRangeImpl_GetMinValues(&InstanceContainer, &OutMinValuesContainer);
return MoveTemp(OutMinValuesContainer.Array);
}
void USGSensorRange::SetMinValues(const TArray<FVector>& Values)
{
FSGIC_FSGSensorRangeImpl InstanceContainer{ToSensorRangeImpl()};
FSGIC_TArray_FVector MinValuesContainer{Values};
SGCoreImpl_FSGSensorRangeImpl_SetMinValues(&InstanceContainer, &MinValuesContainer);
}
TArray<FVector> USGSensorRange::GetMaxValues() const
{
FSGIC_FSGSensorRangeImpl InstanceContainer{ToSensorRangeImpl()};
FSGIC_TArray_FVector OutMaxValuesContainer;
SGCoreImpl_FSGSensorRangeImpl_GetMaxValues(&InstanceContainer, &OutMaxValuesContainer);
return MoveTemp(OutMaxValuesContainer.Array);
}
void USGSensorRange::SetMaxValues(const TArray<FVector>& Values)
{
FSGIC_FSGSensorRangeImpl InstanceContainer{ToSensorRangeImpl()};
FSGIC_TArray_FVector MaxValuesContainer{Values};
SGCoreImpl_FSGSensorRangeImpl_SetMaxValues(&InstanceContainer, &MaxValuesContainer);
}
TArray<FVector> USGSensorRange::GetRange() const
{
FSGIC_FSGSensorRangeImpl InstanceContainer{ToSensorRangeImpl()};
FSGIC_TArray_FVector OutRangeContainer;
SGCoreImpl_FSGSensorRangeImpl_GetRange(&InstanceContainer, &OutRangeContainer);
return MoveTemp(OutRangeContainer.Array);
}
void USGSensorRange::UpdateRange()
{
FSGIC_FSGSensorRangeImpl InstanceContainer{ToSensorRangeImpl()};
SGCoreImpl_FSGSensorRangeImpl_UpdateRange(&InstanceContainer);
}
void USGSensorRange::CheckForExtremes(const TArray<FVector>& OtherValues)
{
FSGIC_FSGSensorRangeImpl InstanceContainer{ToSensorRangeImpl()};
FSGIC_TArray_FVector OtherValuesContainer{OtherValues};
SGCoreImpl_FSGSensorRangeImpl_CheckForExtremes(&InstanceContainer, &OtherValuesContainer);
}
FString USGSensorRange::RangeString(const bool bYOnly) const
{
FSGIC_FSGSensorRangeImpl InstanceContainer{ToSensorRangeImpl()};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGSensorRangeImpl_RangeString(&InstanceContainer, &OutStringContainer, bYOnly);
return MoveTemp(OutStringContainer.String);
}
FString USGSensorRange::ToString(const bool bYOnly) const
{
FSGIC_FSGSensorRangeImpl InstanceContainer{ToSensorRangeImpl()};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGSensorRangeImpl_ToString(&InstanceContainer, &OutStringContainer, bYOnly);
return MoveTemp(OutStringContainer.String);
}
FString USGSensorRange::SGSerialize() const
{
FSGIC_FSGSensorRangeImpl InstanceContainer{ToSensorRangeImpl()};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGSensorRangeImpl_Serialize(&InstanceContainer, &OutStringContainer);
return MoveTemp(OutStringContainer.String);
}
USGSensorRange::FImpl::FImpl(USGSensorRange* InOwner)
: Owner(InOwner)
{
}
USGSensorRange::FImpl::~FImpl() = default;
void USGSensorRange::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -0,0 +1,225 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGThresholdCommand.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGCoreImpl/SGThresholdCommandImpl.h"
#include "SGInterop/SGIC_FSGThresholdCommandImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_TArray_bool.h"
#include "SGInterop/SGIC_TArray_float.h"
#include "SGUtils/SGArrayUtils.h"
struct USGThresholdCommand::FImpl
{
/************************
* Member variables
************************/
FSGThresholdCommandImpl ThresholdCommandImpl;
/************************
* Owner object
************************/
USGThresholdCommand* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGThresholdCommand* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGThresholdCommand* USGThresholdCommand::NewThresholdCommand(
UObject* Outer, const FSGThresholdCommandImpl& ThresholdCommandImpl)
{
USGThresholdCommand* Instance = NewObject<USGThresholdCommand>(Outer);
Instance->SetThresholdCommandImpl(ThresholdCommandImpl);
return Instance;
}
USGThresholdCommand* USGThresholdCommand::NewThresholdCommand(UObject* Outer)
{
FSGIC_FSGThresholdCommandImpl OutThresholdCommandImplContainer;
SGCoreImpl_FSGThresholdCommandImpl_ctor(&OutThresholdCommandImplContainer);
return NewThresholdCommand(Outer, MoveTemp(OutThresholdCommandImplContainer.ThresholdCommandImpl));
}
USGThresholdCommand* USGThresholdCommand::NewThresholdCommand(
UObject* Outer, const TArray<bool>& AffectedFingers, const TArray<float>& ThresholdValues)
{
FSGIC_FSGThresholdCommandImpl OutThresholdCommandImplContainer;
FSGIC_TArray_bool AffectedFingersContainer{AffectedFingers};
FSGIC_TArray_float ThresholdValuesContainer{ThresholdValues};
SGCoreImpl_FSGThresholdCommandImpl_ctor_AffectedFingers_ThresholdValues(
&OutThresholdCommandImplContainer, &AffectedFingersContainer, &ThresholdValuesContainer);
return NewThresholdCommand(Outer, MoveTemp(OutThresholdCommandImplContainer.ThresholdCommandImpl));
}
USGThresholdCommand::USGThresholdCommand()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGThresholdCommandImpl OutThresholdCommandImplContainer;
SGCoreImpl_FSGThresholdCommandImpl_ctor(&OutThresholdCommandImplContainer);
Pimpl->ThresholdCommandImpl = MoveTemp(OutThresholdCommandImplContainer.ThresholdCommandImpl);
}
USGThresholdCommand::USGThresholdCommand(const TArray<bool>& AffectedFingers, const TArray<float>& ThresholdValues)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGThresholdCommandImpl OutThresholdCommandImplContainer;
FSGIC_TArray_bool AffectedFingersContainer{AffectedFingers};
FSGIC_TArray_float ThresholdValuesContainer{ThresholdValues};
SGCoreImpl_FSGThresholdCommandImpl_ctor_AffectedFingers_ThresholdValues(
&OutThresholdCommandImplContainer, &AffectedFingersContainer, &ThresholdValuesContainer);
Pimpl->ThresholdCommandImpl = MoveTemp(OutThresholdCommandImplContainer.ThresholdCommandImpl);
}
USGThresholdCommand::USGThresholdCommand(const FSGThresholdCommandImpl& ThresholdCommandImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
SetThresholdCommandImpl(ThresholdCommandImpl);
}
USGThresholdCommand::~USGThresholdCommand() = default;
void USGThresholdCommand::SetThresholdCommandImpl(const FSGThresholdCommandImpl& ThresholdCommandImpl)
{
FSGIC_FSGThresholdCommandImpl OutThresholdCommandContainer;
FSGIC_FSGThresholdCommandImpl RhsContainer{ThresholdCommandImpl};
SGCoreImpl_FSGThresholdCommandImpl_ctor_copy(&OutThresholdCommandContainer, &RhsContainer);
Pimpl->ThresholdCommandImpl = MoveTemp(OutThresholdCommandContainer.ThresholdCommandImpl);
}
const FSGThresholdCommandImpl& USGThresholdCommand::ToThresholdCommandImpl() const
{
return Pimpl->ThresholdCommandImpl;
}
float USGThresholdCommand::GetThreshold(const int32 Finger) const
{
FSGIC_FSGThresholdCommandImpl InstanceContainer{ToThresholdCommandImpl()};
return SGCoreImpl_FSGThresholdCommandImpl_GetThreshold(&InstanceContainer, Finger);
}
void USGThresholdCommand::SetThreshold(const int32 Finger, const float ThresholdValue)
{
FSGIC_FSGThresholdCommandImpl InstanceContainer{ToThresholdCommandImpl()};
return SGCoreImpl_FSGThresholdCommandImpl_SetThreshold(&InstanceContainer, Finger, ThresholdValue);
}
TArray<float> USGThresholdCommand::GetThresholds() const
{
FSGIC_FSGThresholdCommandImpl InstanceContainer{ToThresholdCommandImpl()};
FSGIC_TArray_float ThresholdsContainer;
SGCoreImpl_FSGThresholdCommandImpl_GetThresholds(&InstanceContainer, &ThresholdsContainer);
return MoveTemp(ThresholdsContainer.Array);
}
void USGThresholdCommand::SetThresholds(const TArray<bool>& AffectedFingers, const TArray<float>& ThresholdValues)
{
FSGIC_FSGThresholdCommandImpl InstanceContainer{ToThresholdCommandImpl()};
FSGIC_TArray_bool AffectedFingersContainer{AffectedFingers};
FSGIC_TArray_float ThresholdValuesContainer{ThresholdValues};
SGCoreImpl_FSGThresholdCommandImpl_SetThresholds(
&InstanceContainer, &AffectedFingersContainer, &ThresholdValuesContainer);
}
bool USGThresholdCommand::GetFingerActive(const int32 Finger) const
{
FSGIC_FSGThresholdCommandImpl InstanceContainer{ToThresholdCommandImpl()};
return SGCoreImpl_FSGThresholdCommandImpl_GetFingerActive(&InstanceContainer, Finger);
}
TArray<bool> USGThresholdCommand::GetActiveFingers() const
{
FSGIC_FSGThresholdCommandImpl InstanceContainer{ToThresholdCommandImpl()};
FSGIC_TArray_bool OutActiveFingersContainer;
SGCoreImpl_FSGThresholdCommandImpl_GetActiveFingers(&InstanceContainer, &OutActiveFingersContainer);
return MoveTemp(OutActiveFingersContainer.Array);
}
void USGThresholdCommand::ClearThreshold(const int32 Finger)
{
FSGIC_FSGThresholdCommandImpl InstanceContainer{ToThresholdCommandImpl()};
SGCoreImpl_FSGThresholdCommandImpl_ClearThreshold(&InstanceContainer, Finger);
}
void USGThresholdCommand::ClearThresholds()
{
FSGIC_FSGThresholdCommandImpl InstanceContainer{ToThresholdCommandImpl()};
SGCoreImpl_FSGThresholdCommandImpl_ClearThresholds(&InstanceContainer);
}
bool USGThresholdCommand::Equals(const USGThresholdCommand* ThresholdCommand) const
{
FSGIC_FSGThresholdCommandImpl InstanceContainer{ToThresholdCommandImpl()};
FSGIC_FSGThresholdCommandImpl ThresholdCommandContainer{ThresholdCommand->ToThresholdCommandImpl()};
return SGCoreImpl_FSGThresholdCommandImpl_Equals(&InstanceContainer, &ThresholdCommandContainer);
}
FString USGThresholdCommand::ToString() const
{
FSGIC_FSGThresholdCommandImpl InstanceContainer{ToThresholdCommandImpl()};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGThresholdCommandImpl_ToString(&InstanceContainer, &OutStringContainer);
return MoveTemp(OutStringContainer.String);
}
USGThresholdCommand::FImpl::FImpl(USGThresholdCommand* InOwner)
: Owner(InOwner)
{
}
USGThresholdCommand::FImpl::~FImpl() = default;
void USGThresholdCommand::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -1,187 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGThumperCommand.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_FSGThumperCommandImpl.h"
struct USGThumperCommand::FImpl
{
/************************
* Member variables
************************/
FSGThumperCommandImpl ThumperCommandImpl;
/************************
* Owner object
************************/
USGThumperCommand* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGThumperCommand* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGThumperCommand* USGThumperCommand::NewThumperCommand(UObject* Outer, const FSGThumperCommandImpl& ThumperCommandImpl)
{
USGThumperCommand* Instance = NewObject<USGThumperCommand>(Outer);
Instance->SetThumperCommandImpl(ThumperCommandImpl);
return Instance;
}
USGThumperCommand* USGThumperCommand::NewThumperCommand(UObject* Outer)
{
FSGIC_FSGThumperCommandImpl OutThumperCommandImplContainer;
SGCoreImpl_FSGThumperCommandImpl_ctor(&OutThumperCommandImplContainer);
return NewThumperCommand(Outer, MoveTemp(OutThumperCommandImplContainer.ThumperCommandImpl));
}
USGThumperCommand* USGThumperCommand::NewThumperCommand(UObject* Outer, const int32 Magnitude)
{
FSGIC_FSGThumperCommandImpl OutThumperCommandImplContainer;
SGCoreImpl_FSGThumperCommandImpl_ctor_Magnitude(&OutThumperCommandImplContainer, Magnitude);
return NewThumperCommand(Outer, MoveTemp(OutThumperCommandImplContainer.ThumperCommandImpl));
}
USGThumperCommand* USGThumperCommand::Off(UObject* Outer)
{
FSGIC_FSGThumperCommandImpl OutContainer;
SGCoreImpl_FSGThumperCommandImpl_Off(&OutContainer);
return NewThumperCommand(Outer, OutContainer.ThumperCommandImpl);
}
USGThumperCommand::USGThumperCommand()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGThumperCommandImpl OutThumperCommandImplContainer;
SGCoreImpl_FSGThumperCommandImpl_ctor(&OutThumperCommandImplContainer);
Pimpl->ThumperCommandImpl = MoveTemp(OutThumperCommandImplContainer.ThumperCommandImpl);
}
USGThumperCommand::USGThumperCommand(const int32 Magnitude)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGThumperCommandImpl OutThumperCommandImplContainer;
SGCoreImpl_FSGThumperCommandImpl_ctor_Magnitude(&OutThumperCommandImplContainer, Magnitude);
Pimpl->ThumperCommandImpl = MoveTemp(OutThumperCommandImplContainer.ThumperCommandImpl);
}
USGThumperCommand::USGThumperCommand(const FSGThumperCommandImpl& ThumperCommandImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
SetThumperCommandImpl(ThumperCommandImpl);
}
USGThumperCommand::~USGThumperCommand() = default;
void USGThumperCommand::SetThumperCommandImpl(const FSGThumperCommandImpl& ThumperCommandImpl)
{
FSGIC_FSGThumperCommandImpl OutThumperCommandContainer;
FSGIC_FSGThumperCommandImpl RhsContainer{ThumperCommandImpl};
SGCoreImpl_FSGThumperCommandImpl_ctor_copy(&OutThumperCommandContainer, &RhsContainer);
Pimpl->ThumperCommandImpl = MoveTemp(RhsContainer.ThumperCommandImpl);
}
const FSGThumperCommandImpl& USGThumperCommand::ToThumperCommandImpl() const
{
return Pimpl->ThumperCommandImpl;
}
int32 USGThumperCommand::GetMagnitude() const
{
FSGIC_FSGThumperCommandImpl ThumperCommandImplContainer{ToThumperCommandImpl()};
return SGCoreImpl_FSGThumperCommandImpl_GetMagnitude(&ThumperCommandImplContainer);
}
void USGThumperCommand::SetMagnitude(const int32 Magnitude)
{
FSGIC_FSGThumperCommandImpl ThumperCommandImplContainer{ToThumperCommandImpl()};
SGCoreImpl_FSGThumperCommandImpl_SetMagnitude(&ThumperCommandImplContainer, Magnitude);
}
USGThumperCommand* USGThumperCommand::Copy(UObject* Outer) const
{
FSGIC_FSGThumperCommandImpl InstanceContainer{ToThumperCommandImpl()};
FSGIC_FSGThumperCommandImpl OutThumperCommandImplContainer;
SGCoreImpl_FSGThumperCommandImpl_Copy(&InstanceContainer, &OutThumperCommandImplContainer);
return NewThumperCommand(Outer, MoveTemp(OutThumperCommandImplContainer.ThumperCommandImpl));
}
USGThumperCommand* USGThumperCommand::Merge(UObject* Outer, const USGThumperCommand* ThumperCommand) const
{
FSGIC_FSGThumperCommandImpl InstanceContainer{ToThumperCommandImpl()};
FSGIC_FSGThumperCommandImpl ThumperCommandImplContainer{ThumperCommand->ToThumperCommandImpl()};
FSGIC_FSGThumperCommandImpl OutThumperCommandImplContainer;
SGCoreImpl_FSGThumperCommandImpl_Merge(&InstanceContainer, &OutThumperCommandImplContainer,
&ThumperCommandImplContainer);
return NewThumperCommand(Outer, MoveTemp(OutThumperCommandImplContainer.ThumperCommandImpl));
}
bool USGThumperCommand::Equals(const USGThumperCommand* ThumperCommand) const
{
FSGIC_FSGThumperCommandImpl InstanceContainer{ToThumperCommandImpl()};
FSGIC_FSGThumperCommandImpl ThumperCommandImplContainer{ThumperCommand->ToThumperCommandImpl()};
return SGCoreImpl_FSGThumperCommandImpl_Equals(&InstanceContainer, &ThumperCommandImplContainer);
}
USGThumperCommand::FImpl::FImpl(USGThumperCommand* InOwner)
: Owner(InOwner)
{
}
USGThumperCommand::FImpl::~FImpl() = default;
void USGThumperCommand::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -1,218 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGTimedBuzzCommand.h"
#include "SGFingerCommandImplCast.h"
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGBuzzCommand.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_ESGFinger.h"
#include "SGInterop/SGIC_FSGBuzzCommandImpl.h"
#include "SGInterop/SGIC_FSGFingerCommandImpl.h"
#include "SGInterop/SGIC_FSGTimedBuzzCommandImpl.h"
#include "SGInterop/SGIC_FString.h"
#include "SGInterop/SGIC_TSharedPtr_FSGTimedBuzzCommandImpl.h"
USGTimedBuzzCommand* USGTimedBuzzCommand::NewTimedBuzzCommand(
UObject* Outer, const FSGTimedBuzzCommandImpl& TimedBuzzCommandImpl)
{
USGTimedBuzzCommand* Instance = NewObject<USGTimedBuzzCommand>(Outer);
Instance->SetFingerCommandImpl(TimedBuzzCommandImpl);
return Instance;
}
USGTimedBuzzCommand* USGTimedBuzzCommand::NewTimedBuzzCommand(
UObject* Outer, TSharedRef<FSGTimedBuzzCommandImpl> TimedBuzzCommandImpl)
{
USGTimedBuzzCommand* Instance = NewObject<USGTimedBuzzCommand>(Outer);
Instance->SetFingerCommandImpl(MoveTemp(TimedBuzzCommandImpl));
return Instance;
}
USGTimedBuzzCommand* USGTimedBuzzCommand::NewTimedBuzzCommand(UObject* Outer)
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl OutSharedPtrContainer;
SGCoreImpl_FSGTimedBuzzCommandImpl_ctor(&OutSharedPtrContainer);
return NewTimedBuzzCommand(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGTimedBuzzCommand* USGTimedBuzzCommand::NewTimedBuzzCommand(
UObject* Outer,
const ESGFinger Finger, const int32 Magnitude, const float DurationSeconds, const float StartTimeSeconds)
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl OutSharedPtrContainer;
FSGIC_ESGFinger FingerContainer{Finger};
SGCoreImpl_FSGTimedBuzzCommandImpl_ctor_Finger_Magnitude_DurationSeconds_StartTimeSeconds_MakeShared(
&OutSharedPtrContainer, &FingerContainer, Magnitude, DurationSeconds, StartTimeSeconds);
return NewTimedBuzzCommand(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGTimedBuzzCommand* USGTimedBuzzCommand::NewTimedBuzzCommand(
UObject* Outer,
const USGBuzzCommand* BaseCommand, const float DurationSeconds, const float StartTimeSeconds)
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl OutSharedPtrContainer;
FSGIC_FSGBuzzCommandImpl BaseCommandContainer{BaseCommand->ToBuzzCommandImpl().Get()};
SGCoreImpl_FSGTimedBuzzCommandImpl_ctor_BaseCommand_DurationSeconds_StartTimeSeconds_MakeShared(
&OutSharedPtrContainer, &BaseCommandContainer, DurationSeconds, StartTimeSeconds);
return NewTimedBuzzCommand(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGTimedBuzzCommand::USGTimedBuzzCommand()
: USGBuzzCommand()
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl OutTimedBuzzCommandImplContainer;
SGCoreImpl_FSGTimedBuzzCommandImpl_ctor_MakeShared(&OutTimedBuzzCommandImplContainer);
SetFingerCommandImpl(OutTimedBuzzCommandImplContainer.Ptr.ToSharedRef());
}
USGTimedBuzzCommand::USGTimedBuzzCommand(const ESGFinger Finger, const int32 Magnitude,
const float DurationSeconds, const float StartTimeSeconds)
: USGBuzzCommand()
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl OutSharedPtrContainer;
FSGIC_ESGFinger FingerContainer{Finger};
SGCoreImpl_FSGTimedBuzzCommandImpl_ctor_Finger_Magnitude_DurationSeconds_StartTimeSeconds_MakeShared(
&OutSharedPtrContainer, &FingerContainer, Magnitude, DurationSeconds, StartTimeSeconds);
SetFingerCommandImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGTimedBuzzCommand::USGTimedBuzzCommand(const USGBuzzCommand* BaseCommand,
const float DurationSeconds, const float StartTimeSeconds)
: USGBuzzCommand()
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl OutSharedPtrContainer;
FSGIC_FSGBuzzCommandImpl BaseCommandContainer{BaseCommand->ToBuzzCommandImpl().Get()};
SGCoreImpl_FSGTimedBuzzCommandImpl_ctor_BaseCommand_DurationSeconds_StartTimeSeconds_MakeShared(
&OutSharedPtrContainer, &BaseCommandContainer, DurationSeconds, StartTimeSeconds);
SetFingerCommandImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
}
USGTimedBuzzCommand::USGTimedBuzzCommand(const FSGTimedBuzzCommandImpl& TimedBuzzCommandImpl)
: USGBuzzCommand(TimedBuzzCommandImpl)
{
}
USGTimedBuzzCommand::USGTimedBuzzCommand(TSharedRef<FSGTimedBuzzCommandImpl> TimedBuzzCommandImpl)
: USGBuzzCommand(MoveTemp(TimedBuzzCommandImpl))
{
}
USGTimedBuzzCommand::~USGTimedBuzzCommand() = default;
TSharedRef<FSGTimedBuzzCommandImpl> USGTimedBuzzCommand::ToTimedBuzzCommandImpl() const
{
return FSGFingerCommandImplCast::ToTimedBuzzCommandImpl(ToFingerCommandImpl());
}
USGBuzzCommand* USGTimedBuzzCommand::Copy(UObject* Outer) const
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl InstanceContainer{ToTimedBuzzCommandImpl()};
FSGIC_FSGBuzzCommandImpl OutBuzzCommandImplContainer;
SGCoreImpl_FSGTimedBuzzCommandImpl_Copy(&InstanceContainer, &OutBuzzCommandImplContainer);
return NewBuzzCommand(Outer, MoveTemp(OutBuzzCommandImplContainer.BuzzCommandImpl));
}
USGBuzzCommand* USGTimedBuzzCommand::Merge(UObject* Outer, const USGBuzzCommand* BuzzCommand) const
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl InstanceContainer{ToTimedBuzzCommandImpl()};
FSGIC_FSGBuzzCommandImpl BuzzCommandImplContainer{BuzzCommand->ToBuzzCommandImpl().Get()};
FSGIC_FSGBuzzCommandImpl OutBuzzCommandImplContainer;
SGCoreImpl_FSGTimedBuzzCommandImpl_Merge(&InstanceContainer, &OutBuzzCommandImplContainer,
&BuzzCommandImplContainer);
return NewBuzzCommand(Outer, MoveTemp(OutBuzzCommandImplContainer.BuzzCommandImpl));
}
USGBuzzCommand* USGTimedBuzzCommand::GetBaseCommand(UObject* Outer) const
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl InstanceContainer{ToTimedBuzzCommandImpl()};
FSGIC_FSGBuzzCommandImpl OutCommandContainer;
SGCoreImpl_FSGTimedBuzzCommandImpl_GetBaseCommand(&InstanceContainer, &OutCommandContainer);
return NewBuzzCommand(Outer, MoveTemp(OutCommandContainer.BuzzCommandImpl));
}
float USGTimedBuzzCommand::GetDuration() const
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl InstanceContainer{ToTimedBuzzCommandImpl()};
return SGCoreImpl_FSGTimedBuzzCommandImpl_GetDuration(&InstanceContainer);
}
float USGTimedBuzzCommand::GetElapsedTime() const
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl InstanceContainer{ToTimedBuzzCommandImpl()};
return SGCoreImpl_FSGTimedBuzzCommandImpl_GetElapsedTime(&InstanceContainer);
}
bool USGTimedBuzzCommand::HasTimeElapsed() const
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl InstanceContainer{ToTimedBuzzCommandImpl()};
return SGCoreImpl_FSGTimedBuzzCommandImpl_HasTimeElapsed(&InstanceContainer);
}
float USGTimedBuzzCommand::NormalizedTime(const bool bClamp01) const
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl InstanceContainer{ToTimedBuzzCommandImpl()};
return SGCoreImpl_FSGTimedBuzzCommandImpl_NormalizedTime(&InstanceContainer, bClamp01);
}
void USGTimedBuzzCommand::ResetTiming()
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl InstanceContainer{ToTimedBuzzCommandImpl()};
SGCoreImpl_FSGTimedBuzzCommandImpl_ResetTiming(&InstanceContainer);
}
void USGTimedBuzzCommand::UpdateTiming(const float DeltaSeconds)
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl InstanceContainer{ToTimedBuzzCommandImpl()};
SGCoreImpl_FSGTimedBuzzCommandImpl_UpdateTiming(&InstanceContainer, DeltaSeconds);
}
FString USGTimedBuzzCommand::ToString() const
{
FSGIC_TSharedPtr_FSGTimedBuzzCommandImpl InstanceContainer{ToTimedBuzzCommandImpl()};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGTimedBuzzCommandImpl_ToString(&InstanceContainer, &OutStringContainer);
return MoveTemp(OutStringContainer.String);
}
@@ -1,229 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGTimedThumpCommand.h"
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGThumperCommand.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_FSGThumperCommandImpl.h"
#include "SGInterop/SGIC_FSGTimedThumpCommandImpl.h"
#include "SGInterop/SGIC_FString.h"
struct USGTimedThumpCommand::FImpl
{
/************************
* Member variables
************************/
FSGTimedThumpCommandImpl TimedThumpCommandImpl;
/************************
* Owner object
************************/
USGTimedThumpCommand* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGTimedThumpCommand* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGTimedThumpCommand* USGTimedThumpCommand::NewTimedThumpCommand(
UObject* Outer, const FSGTimedThumpCommandImpl& TimedThumpCommandImpl)
{
USGTimedThumpCommand* Instance = NewObject<USGTimedThumpCommand>(Outer);
Instance->SetTimedThumpCommandImpl(TimedThumpCommandImpl);
return Instance;
}
USGTimedThumpCommand* USGTimedThumpCommand::NewTimedThumpCommand(UObject* Outer)
{
FSGIC_FSGTimedThumpCommandImpl OutTimedThumpCommandImplContainer;
SGCoreImpl_FSGTimedThumpCommandImpl_ctor(&OutTimedThumpCommandImplContainer);
return NewTimedThumpCommand(Outer, MoveTemp(OutTimedThumpCommandImplContainer.TimedThumpCommandImpl));
}
USGTimedThumpCommand* USGTimedThumpCommand::NewTimedThumpCommand(
UObject* Outer, const int32 Magnitude, const float DurationSeconds, const float StartTimeSeconds)
{
FSGIC_FSGTimedThumpCommandImpl OutTimedThumpCommandImplContainer;
SGCoreImpl_FSGTimedThumpCommandImpl_ctor_Magnitude_DurationSeconds_StartTimeSeconds(
&OutTimedThumpCommandImplContainer, Magnitude, DurationSeconds, StartTimeSeconds);
return NewTimedThumpCommand(Outer, MoveTemp(OutTimedThumpCommandImplContainer.TimedThumpCommandImpl));
}
USGTimedThumpCommand* USGTimedThumpCommand::NewTimedThumpCommand(
UObject* Outer, const USGThumperCommand* BaseCommand, const float DurationSeconds, const float StartTimeSeconds)
{
FSGIC_FSGTimedThumpCommandImpl OutTimedThumpCommandImplContainer;
FSGIC_FSGThumperCommandImpl BaseCommandContainer{BaseCommand->ToThumperCommandImpl()};
SGCoreImpl_FSGTimedThumpCommandImpl_ctor_BaseCommand_DurationSeconds_StartTimeSeconds(
&OutTimedThumpCommandImplContainer, &BaseCommandContainer, DurationSeconds, StartTimeSeconds);
return NewTimedThumpCommand(Outer, MoveTemp(OutTimedThumpCommandImplContainer.TimedThumpCommandImpl));
}
USGTimedThumpCommand::USGTimedThumpCommand()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGTimedThumpCommandImpl OutTimedThumpCommandImplContainer;
SGCoreImpl_FSGTimedThumpCommandImpl_ctor(&OutTimedThumpCommandImplContainer);
Pimpl->TimedThumpCommandImpl = MoveTemp(OutTimedThumpCommandImplContainer.TimedThumpCommandImpl);
}
USGTimedThumpCommand::USGTimedThumpCommand(const int32 Magnitude,
const float DurationSeconds, const float StartTimeSeconds)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGTimedThumpCommandImpl OutTimedThumpCommandImplContainer;
SGCoreImpl_FSGTimedThumpCommandImpl_ctor_Magnitude_DurationSeconds_StartTimeSeconds(
&OutTimedThumpCommandImplContainer, Magnitude, DurationSeconds, StartTimeSeconds);
Pimpl->TimedThumpCommandImpl = MoveTemp(OutTimedThumpCommandImplContainer.TimedThumpCommandImpl);
}
USGTimedThumpCommand::USGTimedThumpCommand(const USGThumperCommand* BaseCommand,
const float DurationSeconds, const float StartTimeSeconds)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
FSGIC_FSGTimedThumpCommandImpl OutTimedThumpCommandImplContainer;
FSGIC_FSGThumperCommandImpl BaseCommandContainer{BaseCommand->ToThumperCommandImpl()};
SGCoreImpl_FSGTimedThumpCommandImpl_ctor_BaseCommand_DurationSeconds_StartTimeSeconds(
&OutTimedThumpCommandImplContainer, &BaseCommandContainer, DurationSeconds, StartTimeSeconds);
Pimpl->TimedThumpCommandImpl = MoveTemp(OutTimedThumpCommandImplContainer.TimedThumpCommandImpl);
}
USGTimedThumpCommand::USGTimedThumpCommand(const FSGTimedThumpCommandImpl& TimedThumpCommandImpl)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
SetTimedThumpCommandImpl(TimedThumpCommandImpl);
}
USGTimedThumpCommand::~USGTimedThumpCommand() = default;
void USGTimedThumpCommand::SetTimedThumpCommandImpl(const FSGTimedThumpCommandImpl& TimedThumpCommandImpl)
{
FSGIC_FSGTimedThumpCommandImpl OutTimedThumpCommandContainer;
FSGIC_FSGTimedThumpCommandImpl RhsContainer{TimedThumpCommandImpl};
SGCoreImpl_FSGTimedThumpCommandImpl_ctor_copy(&OutTimedThumpCommandContainer, &RhsContainer);
Pimpl->TimedThumpCommandImpl = MoveTemp(OutTimedThumpCommandContainer.TimedThumpCommandImpl);
}
const FSGTimedThumpCommandImpl& USGTimedThumpCommand::ToTimedThumpCommandImpl() const
{
return Pimpl->TimedThumpCommandImpl;
}
int32 USGTimedThumpCommand::GetMagnitude() const
{
FSGIC_FSGTimedThumpCommandImpl InstanceContainer{ToTimedThumpCommandImpl()};
return SGCoreImpl_FSGTimedThumpCommandImpl_GetMagnitude(&InstanceContainer);
}
float USGTimedThumpCommand::GetDuration() const
{
FSGIC_FSGTimedThumpCommandImpl InstanceContainer{ToTimedThumpCommandImpl()};
return SGCoreImpl_FSGTimedThumpCommandImpl_GetDuration(&InstanceContainer);
}
float USGTimedThumpCommand::GetElapsedTime() const
{
FSGIC_FSGTimedThumpCommandImpl InstanceContainer{ToTimedThumpCommandImpl()};
return SGCoreImpl_FSGTimedThumpCommandImpl_GetElapsedTime(&InstanceContainer);
}
bool USGTimedThumpCommand::HasTimeElapsed() const
{
FSGIC_FSGTimedThumpCommandImpl InstanceContainer{ToTimedThumpCommandImpl()};
return SGCoreImpl_FSGTimedThumpCommandImpl_HasTimeElapsed(&InstanceContainer);
}
USGTimedThumpCommand* USGTimedThumpCommand::Copy(UObject* Outer, const bool bCopyElapsed) const
{
FSGIC_FSGTimedThumpCommandImpl InstanceContainer{ToTimedThumpCommandImpl()};
FSGIC_FSGTimedThumpCommandImpl OutTimedThumpCommandImplContainer;
SGCoreImpl_FSGTimedThumpCommandImpl_Copy(&InstanceContainer, &OutTimedThumpCommandImplContainer, bCopyElapsed);
return NewTimedThumpCommand(Outer, OutTimedThumpCommandImplContainer.TimedThumpCommandImpl);
}
void USGTimedThumpCommand::Update(const float DeltaSeconds)
{
FSGIC_FSGTimedThumpCommandImpl InstanceContainer{ToTimedThumpCommandImpl()};
SGCoreImpl_FSGTimedThumpCommandImpl_Update(&InstanceContainer, DeltaSeconds);
}
bool USGTimedThumpCommand::Equals(const USGTimedThumpCommand* TimedThumpCommand) const
{
FSGIC_FSGTimedThumpCommandImpl InstanceContainer{ToTimedThumpCommandImpl()};
FSGIC_FSGTimedThumpCommandImpl TimedThumpCommandImplContainer{TimedThumpCommand->ToTimedThumpCommandImpl()};
return SGCoreImpl_FSGTimedThumpCommandImpl_Equals(&InstanceContainer, &TimedThumpCommandImplContainer);
}
FString USGTimedThumpCommand::ToString() const
{
FSGIC_FSGTimedThumpCommandImpl InstanceContainer{ToTimedThumpCommandImpl()};
FSGIC_FString OutStringContainer;
SGCoreImpl_FSGTimedThumpCommandImpl_ToString(&InstanceContainer, &OutStringContainer);
return MoveTemp(OutStringContainer.String);
}
USGTimedThumpCommand::FImpl::FImpl(USGTimedThumpCommand* InOwner)
: Owner(InOwner)
{
}
USGTimedThumpCommand::FImpl::~FImpl() = default;
void USGTimedThumpCommand::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -248,31 +248,6 @@ FRotator FSGTracking::GetNovaToWristRotationOffset()
return OutOffsetContainer.Quat.Rotator();
}
void FSGTracking::GetNovaGloveWristOffset(const bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset)
{
FSGIC_FVector OutPositionOffsetContainer;
FSGIC_FQuat OutRotationOffsetContainer;
SGCoreImpl_FSGTrackingImpl_GetNovaGloveWristOffset(bRightHanded,
&OutPositionOffsetContainer, &OutRotationOffsetContainer);
OutPositionOffset = MoveTemp(OutPositionOffsetContainer.Vector);
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;
@@ -392,6 +367,115 @@ FRotator FSGTracking::GetLeftNovaPico2ToAttachRotation()
return OutRotationContainer.Quat.Rotator();
}
FVector FSGTracking::GetRightNovaQuestProToAttachPosition()
{
FSGIC_FVector OutPositionContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNovaQuestProToAttachPosition(&OutPositionContainer);
return MoveTemp(OutPositionContainer.Vector);
}
FQuat FSGTracking::GetRightNovaQuestProToAttachRotationQ()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNovaQuestProToAttachRotation(&OutRotationContainer);
return MoveTemp(OutRotationContainer.Quat);
}
FRotator FSGTracking::GetRightNovaQuestProToAttachRotation()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNovaQuestProToAttachRotation(&OutRotationContainer);
return OutRotationContainer.Quat.Rotator();
}
FVector FSGTracking::GetLeftNovaQuestProToAttachPosition()
{
FSGIC_FVector OutPositionContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNovaQuestProToAttachPosition(&OutPositionContainer);
return MoveTemp(OutPositionContainer.Vector);
}
FQuat FSGTracking::GetLeftNovaQuestProToAttachRotationQ()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNovaQuestProToAttachRotation(&OutRotationContainer);
return MoveTemp(OutRotationContainer.Quat);
}
FRotator FSGTracking::GetLeftNovaQuestProToAttachRotation()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNovaQuestProToAttachRotation(&OutRotationContainer);
return OutRotationContainer.Quat.Rotator();
}
FVector FSGTracking::GetRightNovaViveFocus3ToAttachPosition()
{
FSGIC_FVector OutPositionContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNovaViveFocus3ToAttachPosition(&OutPositionContainer);
return MoveTemp(OutPositionContainer.Vector);
}
FQuat FSGTracking::GetRightNovaViveFocus3ToAttachRotationQ()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNovaViveFocus3ToAttachRotation(&OutRotationContainer);
return MoveTemp(OutRotationContainer.Quat);
}
FRotator FSGTracking::GetRightNovaViveFocus3ToAttachRotation()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNovaViveFocus3ToAttachRotation(&OutRotationContainer);
return OutRotationContainer.Quat.Rotator();
}
FVector FSGTracking::GetLeftNovaViveFocus3ToAttachPosition()
{
FSGIC_FVector OutPositionContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNovaViveFocus3ToAttachPosition(&OutPositionContainer);
return MoveTemp(OutPositionContainer.Vector);
}
FQuat FSGTracking::GetLeftNovaViveFocus3ToAttachRotationQ()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNovaViveFocus3ToAttachRotation(&OutRotationContainer);
return MoveTemp(OutRotationContainer.Quat);
}
FRotator FSGTracking::GetLeftNovaViveFocus3ToAttachRotation()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNovaViveFocus3ToAttachRotation(&OutRotationContainer);
return OutRotationContainer.Quat.Rotator();
}
void FSGTracking::GetNovaGloveWristOffset(const bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset)
{
FSGIC_FVector OutPositionOffsetContainer;
FSGIC_FQuat OutRotationOffsetContainer;
SGCoreImpl_FSGTrackingImpl_GetNovaGloveWristOffset(bRightHanded,
&OutPositionOffsetContainer, &OutRotationOffsetContainer);
OutPositionOffset = MoveTemp(OutPositionOffsetContainer.Vector);
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();
}
void FSGTracking::GetNovaGloveTrackerOffset(const ESGPositionalTrackingHardware Hardware, const bool bRightHanded,
FVector& OutPositionOffset, FQuat& OutRotationOffset)
{
@@ -420,6 +504,276 @@ void FSGTracking::GetNovaGloveTrackerOffset(const ESGPositionalTrackingHardware
OutRotationOffset = OutRotationOffsetContainer.Quat.Rotator();
}
FVector FSGTracking::GetRightNova2ToWristPositionOffset()
{
FSGIC_FVector OutPositionContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNova2ToWristPositionOffset(&OutPositionContainer);
return MoveTemp(OutPositionContainer.Vector);
}
FQuat FSGTracking::GetRightNova2ToWristRotationOffsetQ()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNova2ToWristRotationOffset(&OutRotationContainer);
return MoveTemp(OutRotationContainer.Quat);
}
FRotator FSGTracking::GetRightNova2ToWristRotationOffset()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNova2ToWristRotationOffset(&OutRotationContainer);
return OutRotationContainer.Quat.Rotator();
}
FVector FSGTracking::GetLeftNova2ToWristPositionOffset()
{
FSGIC_FVector OutPositionContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNova2ToWristPositionOffset(&OutPositionContainer);
return MoveTemp(OutPositionContainer.Vector);
}
FQuat FSGTracking::GetLeftNova2ToWristRotationOffsetQ()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNova2ToWristRotationOffset(&OutRotationContainer);
return MoveTemp(OutRotationContainer.Quat);
}
FRotator FSGTracking::GetLeftNova2ToWristRotationOffset()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNova2ToWristRotationOffset(&OutRotationContainer);
return OutRotationContainer.Quat.Rotator();
}
FVector FSGTracking::GetRightNova2Quest2ToAttachPosition()
{
FSGIC_FVector OutPositionContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNova2Quest2ToAttachPosition(&OutPositionContainer);
return MoveTemp(OutPositionContainer.Vector);
}
FQuat FSGTracking::GetRightNova2Quest2ToAttachRotationQ()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNova2Quest2ToAttachRotation(&OutRotationContainer);
return MoveTemp(OutRotationContainer.Quat);
}
FRotator FSGTracking::GetRightNova2Quest2ToAttachRotation()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNova2Quest2ToAttachRotation(&OutRotationContainer);
return OutRotationContainer.Quat.Rotator();
}
FVector FSGTracking::GetLeftNova2Quest2ToAttachPosition()
{
FSGIC_FVector OutPositionContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNova2Quest2ToAttachPosition(&OutPositionContainer);
return MoveTemp(OutPositionContainer.Vector);
}
FQuat FSGTracking::GetLeftNova2Quest2ToAttachRotationQ()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNova2Quest2ToAttachRotation(&OutRotationContainer);
return MoveTemp(OutRotationContainer.Quat);
}
FRotator FSGTracking::GetLeftNova2Quest2ToAttachRotation()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNova2Quest2ToAttachRotation(&OutRotationContainer);
return OutRotationContainer.Quat.Rotator();
}
FVector FSGTracking::GetRightNova2QuestProToAttachPosition()
{
FSGIC_FVector OutPositionContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNovaQuest2ToAttachPosition(&OutPositionContainer);
return MoveTemp(OutPositionContainer.Vector);
}
FQuat FSGTracking::GetRightNova2QuestProToAttachRotationQ()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNova2QuestProToAttachRotation(&OutRotationContainer);
return MoveTemp(OutRotationContainer.Quat);
}
FRotator FSGTracking::GetRightNova2QuestProToAttachRotation()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNova2QuestProToAttachRotation(&OutRotationContainer);
return OutRotationContainer.Quat.Rotator();
}
FVector FSGTracking::GetLeftNova2QuestProToAttachPosition()
{
FSGIC_FVector OutPositionContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNovaQuest2ToAttachPosition(&OutPositionContainer);
return MoveTemp(OutPositionContainer.Vector);
}
FQuat FSGTracking::GetLeftNova2QuestProToAttachRotationQ()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNova2QuestProToAttachRotation(&OutRotationContainer);
return MoveTemp(OutRotationContainer.Quat);
}
FRotator FSGTracking::GetLeftNova2QuestProToAttachRotation()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNova2QuestProToAttachRotation(&OutRotationContainer);
return OutRotationContainer.Quat.Rotator();
}
FVector FSGTracking::GetRightNova2ViveTrackerToAttachPosition()
{
FSGIC_FVector OutPositionContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNova2ViveTrackerToAttachPosition(&OutPositionContainer);
return MoveTemp(OutPositionContainer.Vector);
}
FQuat FSGTracking::GetRightNova2ViveTrackerToAttachRotationQ()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNova2ViveTrackerToAttachRotation(&OutRotationContainer);
return MoveTemp(OutRotationContainer.Quat);
}
FRotator FSGTracking::GetRightNova2ViveTrackerToAttachRotation()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNova2ViveTrackerToAttachRotation(&OutRotationContainer);
return OutRotationContainer.Quat.Rotator();
}
FVector FSGTracking::GetLeftNova2ViveTrackerToAttachPosition()
{
FSGIC_FVector OutPositionContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNova2ViveTrackerToAttachPosition(&OutPositionContainer);
return MoveTemp(OutPositionContainer.Vector);
}
FQuat FSGTracking::GetLeftNova2ViveTrackerToAttachRotationQ()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNova2ViveTrackerToAttachRotation(&OutRotationContainer);
return MoveTemp(OutRotationContainer.Quat);
}
FRotator FSGTracking::GetLeftNova2ViveTrackerToAttachRotation()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNova2ViveTrackerToAttachRotation(&OutRotationContainer);
return OutRotationContainer.Quat.Rotator();
}
FVector FSGTracking::GetRightNova2ViveWristTrackerToAttachPosition()
{
FSGIC_FVector OutPositionContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNova2ViveWristTrackerToAttachPosition(&OutPositionContainer);
return MoveTemp(OutPositionContainer.Vector);
}
FQuat FSGTracking::GetRightNova2ViveWristTrackerToAttachRotationQ()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNova2ViveWristTrackerToAttachRotation(&OutRotationContainer);
return MoveTemp(OutRotationContainer.Quat);
}
FRotator FSGTracking::GetRightNova2ViveWristTrackerToAttachRotation()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetRightNova2ViveWristTrackerToAttachRotation(&OutRotationContainer);
return OutRotationContainer.Quat.Rotator();
}
FVector FSGTracking::GetLeftNova2ViveWristTrackerToAttachPosition()
{
FSGIC_FVector OutPositionContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNova2ViveWristTrackerToAttachPosition(&OutPositionContainer);
return MoveTemp(OutPositionContainer.Vector);
}
FQuat FSGTracking::GetLeftNova2ViveWristTrackerToAttachRotationQ()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNova2ViveWristTrackerToAttachRotation(&OutRotationContainer);
return MoveTemp(OutRotationContainer.Quat);
}
FRotator FSGTracking::GetLeftNova2ViveWristTrackerToAttachRotation()
{
FSGIC_FQuat OutRotationContainer;
SGCoreImpl_FSGTrackingImpl_GetLeftNova2ViveWristTrackerToAttachRotation(&OutRotationContainer);
return OutRotationContainer.Quat.Rotator();
}
void FSGTracking::GetNova2GloveWristOffset(const bool bRightHanded, const FString& HardwareVersion,
FVector& OutPositionOffset, FQuat& OutRotationOffset)
{
FSGIC_FString HardwareVersionContainer{HardwareVersion};
FSGIC_FVector OutPositionOffsetContainer;
FSGIC_FQuat OutRotationOffsetContainer;
SGCoreImpl_FSGTrackingImpl_GetNova2GloveWristOffset(
bRightHanded, &HardwareVersionContainer,
&OutPositionOffsetContainer, &OutRotationOffsetContainer);
OutPositionOffset = MoveTemp(OutPositionOffsetContainer.Vector);
OutRotationOffset = MoveTemp(OutRotationOffsetContainer.Quat);
}
void FSGTracking::GetNova2GloveWristOffset(const bool bRightHanded, const FString& HardwareVersion,
FVector& OutPositionOffset, FRotator& OutRotationOffset)
{
FSGIC_FString HardwareVersionContainer{HardwareVersion};
FSGIC_FVector OutPositionOffsetContainer;
FSGIC_FQuat OutRotationOffsetContainer;
SGCoreImpl_FSGTrackingImpl_GetNova2GloveWristOffset(
bRightHanded, &HardwareVersionContainer,
&OutPositionOffsetContainer, &OutRotationOffsetContainer);
OutPositionOffset = MoveTemp(OutPositionOffsetContainer.Vector);
OutRotationOffset = OutRotationOffsetContainer.Quat.Rotator();
}
void FSGTracking::GetNova2GloveTrackerOffset(const ESGPositionalTrackingHardware Hardware, const bool bRightHanded,
const FString& HardwareVersion,
FVector& OutPositionOffset, FQuat& OutRotationOffset)
{
FSGIC_ESGPositionalTrackingHardware HardwareContainer{Hardware};
FSGIC_FString HardwareVersionContainer{HardwareVersion};
FSGIC_FVector OutPositionOffsetContainer;
FSGIC_FQuat OutRotationOffsetContainer;
SGCoreImpl_FSGTrackingImpl_GetNova2GloveTrackerOffset(
&HardwareContainer, bRightHanded, &HardwareVersionContainer,
&OutPositionOffsetContainer, &OutRotationOffsetContainer);
OutPositionOffset = MoveTemp(OutPositionOffsetContainer.Vector);
OutRotationOffset = MoveTemp(OutRotationOffsetContainer.Quat);
}
void FSGTracking::GetNova2GloveTrackerOffset(const ESGPositionalTrackingHardware Hardware, const bool bRightHanded,
const FString& HardwareVersion,
FVector& OutPositionOffset, FRotator& OutRotationOffset)
{
FSGIC_ESGPositionalTrackingHardware HardwareContainer{Hardware};
FSGIC_FString HardwareVersionContainer{HardwareVersion};
FSGIC_FVector OutPositionOffsetContainer;
FSGIC_FQuat OutRotationOffsetContainer;
SGCoreImpl_FSGTrackingImpl_GetNova2GloveTrackerOffset(
&HardwareContainer, bRightHanded, &HardwareVersionContainer,
&OutPositionOffsetContainer, &OutRotationOffsetContainer);
OutPositionOffset = MoveTemp(OutPositionOffsetContainer.Vector);
OutRotationOffset = OutRotationOffsetContainer.Quat.Rotator();
}
FString FSGTracking::ToString(const ESGPositionalTrackingHardware Hardware)
{
FSGIC_FString OutStringContainer;
@@ -81,6 +81,11 @@ public:
*/
static float GetThumbJointLimit(bool bRightHanded, int32 Joint, int32 Movement, bool bMax);
/*
* Limit a value between specific joint angles.
*/
static float ClampJointAngle(float Value, int32 Finger, bool bRightHand, int32 Joint, int32 Movement);
/**
* Convert a total finger flexion in degrees into a 0..1 representation.
*/
@@ -38,6 +38,12 @@
#pragma once
#include "Containers/UnrealString.h"
#include "HAL/Platform.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGCore/SGDevice.h"
#include "SGTypes/SGCoreTypes.h"
@@ -1,145 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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
*
* Buzz motor command specific for the Sense Glove.
*/
#pragma once
#include "HAL/Platform.h"
#include "Templates/SharedPointer.h"
#include "UObject/ObjectMacros.h"
#include "SGCore/SGFingerCommand.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGBuzzCommand.generated.h"
class FSGBuzzCommandImpl;
/**
* A vibration command for the Sense Glove, with levels for each finger.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGBuzzCommand : public USGFingerCommand
{
GENERATED_BODY()
public:
static USGBuzzCommand* NewBuzzCommand(UObject* Outer, const FSGBuzzCommandImpl& BuzzCommandImpl);
static USGBuzzCommand* NewBuzzCommand(UObject* Outer, TSharedRef<FSGBuzzCommandImpl> BuzzCommandImpl);
public:
/**
* The basic constructor.
*/
static USGBuzzCommand* NewBuzzCommand(UObject* Outer);
/**
* Create a new buzz motor command, where each finger level is contained inside an array of size 5.
*/
static USGBuzzCommand* NewBuzzCommand(UObject* Outer, const TArray<int32>& BuzzLevels);
/**
* Create a new Buzz Motor command, indicating the intensity for each finger.
*/
static USGBuzzCommand* NewBuzzCommand(UObject* Outer, int32 Thumb, int32 Index, int32 Middle, int32 Ring,
int32 Pinky);
/**
* Create a new Buzz Motor command, with only one finger being activated.
*/
static USGBuzzCommand* NewBuzzCommand(UObject* Outer, ESGFinger Finger, int32 BuzzLevel);
public:
/**
* A command that turns off all vibration motors of the Sense Glove.
*/
static USGBuzzCommand* Off(UObject* Outer);
public:
/**
* The basic constructor.
*/
USGBuzzCommand();
/**
* Create a new buzz motor command, where each finger level is contained inside an array of size 5.
*/
explicit USGBuzzCommand(const TArray<int32>& BuzzLevels);
/**
* Create a new Buzz Motor command, indicating the intensity for each finger.
*/
USGBuzzCommand(int32 Thumb, int32 Index, int32 Middle, int32 Ring, int32 Pinky);
/**
* Create a new Buzz Motor command, with only one finger being activated.
*/
USGBuzzCommand(ESGFinger Finger, int32 BuzzLevel);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGBuzzCommand(const FSGBuzzCommandImpl& BuzzCommandImpl);
protected:
/**
* The cast from underlying pointer type constructor.
*/
explicit USGBuzzCommand(TSharedRef<FSGBuzzCommandImpl> BuzzCommandImpl);
public:
/**
* The destructor.
*/
virtual ~USGBuzzCommand() override;
public:
/**
* The cast to underlying type method.
*/
TSharedRef<FSGBuzzCommandImpl> ToBuzzCommandImpl() const;
public:
/**
* Copy this Buzz Command into a new object.
*/
USGBuzzCommand* Copy(UObject* Outer) const;
/**
* Merge this command with another, taking the maximum value between the two.
*/
USGBuzzCommand* Merge(UObject* Outer, const USGBuzzCommand* BuzzCommand) const;
};
@@ -38,39 +38,22 @@
#include "SGCore/SGAnatomy.h"
#include "SGCore/SGBasicHandModel.h"
#include "SGCore/SGBetaDevice.h"
#include "SGCore/SGBuzzCommand.h"
#include "SGCore/SGCalibrationDataPoint.h"
#include "SGCore/SGDevice.h"
#include "SGCore/SGDeviceList.h"
#include "SGCore/SGDeviceModel.h"
#include "SGCore/SGForceFeedbackCommand.h"
#include "SGCore/SGFingerCommand.h"
#include "SGCore/SGHandInterpolator.h"
#include "SGCore/SGHandPose.h"
#include "SGCore/SGHandProfile.h"
#include "SGCore/SGHapticGlove.h"
#include "SGCore/SGHapticGloveCalibrationCheck.h"
#include "SGCore/SGHapticGloveCalibrationSequence.h"
#include "SGCore/SGHapticGloveHandProfiles.h"
#include "SGCore/SGHapticGloveCommandBuffer.h"
#include "SGCore/SGHapticGloveQuickCalibration.h"
#include "SGCore/SGInterpolationSet.h"
#include "SGCore/SGJointKinematics.h"
#include "SGCore/SGLibrary.h"
#include "SGCore/SGNovaGlove.h"
#include "SGCore/SGNovaGloveInfo.h"
#include "SGCore/SGNovaGloveCalibration.h"
#include "SGCore/SGNovaGloveHandProfile.h"
#include "SGCore/SGNovaGloveSensorData.h"
#include "SGCore/SGSenseCom.h"
#include "SGCore/SGSenseGlove.h"
#include "SGCore/SGSenseGloveInfo.h"
#include "SGCore/SGSenseGloveHandProfile.h"
#include "SGCore/SGSenseGlovePose.h"
#include "SGCore/SGSenseGloveSensorData.h"
#include "SGCore/SGSenseGloveVars.h"
#include "SGCore/SGSensorRange.h"
#include "SGCore/SGThumperCommand.h"
#include "SGCore/SGTimedBuzzCommand.h"
#include "SGCore/SGTimedThumpCommand.h"
#include "SGCore/SGTracking.h"
@@ -0,0 +1,305 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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
*
* Describes a vibration based on a number of parameters. Is sent to Nova Gloves
* to be generated on the hardware and played.
*/
#pragma once
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGCustomWaveform.generated.h"
class FSGCustomWaveformImpl;
/*
* A single vibration pulse for Nova Gloves.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGCustomWaveform final : public UObject
{
GENERATED_BODY()
public:
static USGCustomWaveform* NewCustomWaveform(
UObject* Outer, const FSGCustomWaveformImpl& CustomWaveformImpl);
public:
/**
* The default constructor.
*/
static USGCustomWaveform* NewCustomWaveform(UObject* Outer);
/**
* Create a new instance of CustomWaveform.
*/
static USGCustomWaveform* NewCustomWaveform(
UObject* Outer,
float Amplitude, float Duration);
/**
* Create a new instance of CustomWaveform.
*/
static USGCustomWaveform* NewCustomWaveform(
UObject* Outer,
float Amplitude, float Duration, float Frequency);
public:
/**
* Creates a string representation of the ESGWaveformType.
*
* @param Type
*/
static FString ToString(ESGWaveformType Type);
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
/**
* The default constructor.
*/
USGCustomWaveform();
/**
* Create a new instance of CustomWaveform.
*/
USGCustomWaveform(float Amplitude, float Duration);
/**
* Create a new instance of CustomWaveform.
*/
USGCustomWaveform(float Amplitude, float Duration, float Frequency);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGCustomWaveform(const FSGCustomWaveformImpl& CustomWaveformImpl);
public:
/**
* The destructor.
*/
virtual ~USGCustomWaveform() override;
protected:
/**
* Allows to set the underlying object after construction.
*/
void SetCustomWaveformImpl(const FSGCustomWaveformImpl& CustomWaveformImpl);
public:
/**
* The cast to underlying type method.
*/
const FSGCustomWaveformImpl& ToCustomWaveformImpl() const;
public:
/**
* Get the total amplitude of the wave-from, represented by 0 (off) or 1 (maximum value).
*/
float GetAmplitude() const;
/**
* Set the total amplitude of the wave-from, represented by 0 (off) or 1 (maximum value).
*
* @param Amplitude
*/
void SetAmplitude(float Amplitude);
/**
* Get the Type of waveform pattern that is used.
*/
ESGWaveformType GetWaveType() const;
/**
* Set the Type of waveform pattern that is used.
*
* @param Type
*/
void SetWaveType(ESGWaveformType Type);
/**
* Get whether or not this Waveform is infinitely repeating.
*/
bool IsInfinite() const;
/**
* Set whether or not this Waveform is infinitely repeating.
*
* @param bInfinite
*/
void SetInfinite(bool bInfinite);
/**
* Get the amount of times to repeat this waveform. 1 is the default. If set to 0, repeats indefinitely.
*/
int32 GetRepeatAmount() const;
/**
* Set the amount of times to repeat this waveform. 1 is the default. If set to 0, repeats indefinitely.
*
* @param Amount
*/
void SetRepeatAmount(int32 Amount);
/**
* Get time, in seconds, before the signal reaches its maximum amplitude. Limited to 0.01 - 1s. Set to 0 for an
* instant start. Linear only.
*/
float GetAttackTime() const;
/**
* Set time, in seconds, before the signal reaches its maximum amplitude. Limited to 0.01 - 1s. Set to 0 for an
* instant start. Linear only.
*
* @param Time
*/
void SetAttackTime(float Time);
/**
* Get time, in seconds, to keep the signal at one Amplitude. Limited to 0.01 - 1s.
*/
float GetSustainTime() const;
/**
* Set time, in seconds, to keep the signal at one Amplitude. Limited to 0.01 - 1s.
*
* @param Time
*/
void SetSustainTime(float Time);
/**
* Get time it takes for the effect to fade out after AttackTime+SustainTime has passed. Limited to 0.01 - 1s. Set
* to 0 for instant stop. Linear only.
*/
float GetDecayTime() const;
/**
* Set time it takes for the effect to fade out after AttackTime+SustainTime has passed. Limited to 0.01 - 1s. Set
* to 0 for instant stop. Linear only.
*
* @param Time
*/
void SetDecayTime(float Time);
/**
* Get the Wave-from Frequency at the start of the wave-from. Limited between [10 - 500Hz] for Nova Gloves.
*/
float GetFrequencyStart() const;
/**
* Set the Wave-from Frequency at the start of the wave-from. Limited between [10 - 500Hz] for Nova Gloves.
*
* @param Frequency
*/
void SetFrequencyStart(float Frequency);
/**
* Get the Wave-from Frequency at the end of the wave-from. Limited between [10 - 500Hz] for Nova Gloves.
*/
float GetFrequencyEnd() const;
/**
* Set the Wave-from Frequency at the end of the wave-from. Limited between [10 - 500Hz] for Nova Gloves.
*
* @param Frequency
*/
void SetFrequencyEnd(float Frequency);
/**
* Get value of [0..1], representing a percentage of total time (attack+sustain+decay). After that moment passes,
* we increase the frequency by FrequencySwitch factor.
*/
float GetFrequencySwitchTime() const;
/**
* Set value of [0..1], representing a percentage of total time (attack+sustain+decay). After that moment passes,
* we increase the frequency by FrequencySwitch factor.
*
* @param Time
*/
void SetFrequencySwitchTime(float Time);
/**
* After a certain % of the waveform (FrequencySwitchTime) plays, multiply the frequency by this factor [1x .. 3x].
*/
float GetFrequencySwitchFactor() const;
/**
* After a certain % of the waveform (FrequencySwitchTime) plays, multiply the frequency by this factor [1x .. 3x].
* param Time
*/
void SetFrequencySwitchFactor(float Time);
public:
/**
* The total command time of a single play of this pattern (not taking into account the RepeatAmount).
*/
float GetEffectTime() const;
/**
* Total time for the entire effect (effect time multiplied by the repeat amount).
*/
float GetTotalEffectTime() const;
/**
* If true, the frequency of this waveform jumps at any time during its playtime by FrequencySwitchFactor.
*/
bool FrequencyJumps() const;
public:
/**
* Check if this CustomWaveform is roughly equal to another.
*/
bool Equals(const USGCustomWaveform* CustomWaveform) const;
public:
/**
* Create a string representation of this CustomWaveform.
*/
FString ToString() const;
};
+90 -1
View File
@@ -37,6 +37,8 @@
#pragma once
#include "Containers/UnrealString.h"
#include "HAL/Platform.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
@@ -49,7 +51,9 @@ class FSGBetaDeviceImpl;
class FSGDeviceImpl;
class FSGHapticGloveImpl;
class FSGNovaGloveImpl;
class FSGNova2GloveImpl;
class FSGSenseGloveImpl;
class USGHapticChannelInfo;
/**
*
@@ -65,6 +69,32 @@ public:
*/
static void ParseFirmware(const FString& RawFirmware, int32& OutMainVersion, int32& OutSubVersion);
/**
* If true, my firmware is newer than the reference firmware.
*
* @param MyFirmwareMain
* @param MyFirmwareSub
* @param ReferenceMain
* @param ReferenceSub
* @param bInclusive
*/
static bool FirmwareNewerThan(int32 MyFirmwareMain, int32 MyFirmwareSub,
int32 ReferenceMain, int32 ReferenceSub,
bool bInclusive);
/**
* If true, my firmware is older than the reference firmware.
*
* @param MyFirmwareMain
* @param MyFirmwareSub
* @param ReferenceMain
* @param ReferenceSub
* @param bInclusive
*/
static bool FirmwareOlderThan(int32 MyFirmwareMain, int32 MyFirmwareSub,
int32 ReferenceMain, int32 ReferenceSub,
bool bInclusive);
/**
*
*/
@@ -103,6 +133,11 @@ public:
*/
explicit USGDevice(const FSGHapticGloveImpl& HapticGloveImpl);
/**
* The cast from underlying child type constructor.
*/
explicit USGDevice(const FSGNova2GloveImpl& Nova2GloveImpl);
/**
* The cast from underlying child type constructor.
*/
@@ -129,6 +164,11 @@ protected:
*/
explicit USGDevice(TSharedRef<FSGHapticGloveImpl> HapticGloveImpl);
/**
* The cast from underlying child pointer type constructor.
*/
explicit USGDevice(TSharedRef<FSGNova2GloveImpl> Nova2GloveImpl);
/**
* The cast from underlying child pointer type constructor.
*/
@@ -161,6 +201,11 @@ protected:
*/
void SetSGDeviceImpl(const FSGHapticGloveImpl& HapticGloveImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetSGDeviceImpl(const FSGNova2GloveImpl& Nova2GloveImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
@@ -186,6 +231,11 @@ protected:
*/
void SetSGDeviceImpl(TSharedRef<FSGHapticGloveImpl> HapticGloveImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetSGDeviceImpl(TSharedRef<FSGNova2GloveImpl> Nova2GloveImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
@@ -233,6 +283,24 @@ public:
*/
virtual FString GetFirmwareString() const;
/**
* Returns true if this glove's firmware is newer than certain version.
*
* @param FirmwareMain
* @param FirmwareSub
* @param bInclusive
*/
bool FirmwareNewerThan(int32 FirmwareMain, int32 FirmwareSub, bool bInclusive) const;
/**
* Returns true if this glove's firmware is older than certain version.
*
* @param FirmwareMain
* @param FirmwareSub
* @param bInclusive
*/
bool FirmwareOlderThan(int32 FirmwareMain, int32 FirmwareSub, bool bInclusive) const;
/**
* Retrieve this Device's Serial/Bluetooth address.
*/
@@ -266,7 +334,7 @@ public:
/**
* Change this device's index within the SenseCom. Warning: Can cause errors.
*/
void SetDeviceIndex(int32 NewIndex);
virtual void SetDeviceIndex(int32 NewIndex);
/**
* Returns true if this device is connected over a connection other than usb cable.
@@ -288,6 +356,27 @@ public:
*/
virtual bool GetBatteryLevel(float& OutLevel);
public:
/**
* Assign this Device's Haptic Channels. Should not be done outside the API unless you know what you're doing.
*
* @param Channels
*/
virtual void SetHapticChannels(const USGHapticChannelInfo* Channels);
/**
* The number of haptic channels this device can support.
*/
int32 GetHapticChannelCount() const;
/**
* How many channels of a specific type this SGDevice possesses.
*
* @param ChannelType
*/
int32 GetHapticChannelCount(ESGHapticChannelType ChannelType) const;
public:
/**
* Get a string representation of this SGDevice, used for debugging.
*/
@@ -38,7 +38,7 @@
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "UObject/Object.h"
#include "HAL/Platform.h"
#include "UObject/ObjectMacros.h"
#include "SGTypes/SGCoreTypes.h"
@@ -103,7 +103,7 @@ public:
/**
* Send a (raw) command to a specific device in the list.
*/
static bool SendHaptics(int32 IpcIndex, const FString& IpcAddress, const FString& Commands);
static bool SendHaptics(int32 IpcIndex, const FString& IpcAddress, int32 ChannelIndex, const FString& Commands);
/**
*
@@ -73,7 +73,8 @@ public:
public:
/**
* Parse a 32-bit integer value into a set of booleans (010010011) that indicate which (optional) functions this device has.
* Parse a 32-bit integer value into a set of booleans (010010011) that indicate which (optional) functions this
* device has.
*/
static TArray<bool> ParseFunctions(int32 Value, int32 Size);
@@ -146,12 +147,31 @@ public:
FString GetHardwareVersion() const;
/**
* Firmware version running on the device's MicroController. (as v4.12, this is the 4).
* Firmware version running on the device's MicroController. (as of v4.12, this is the 4).
*/
int32 GetFirmwareVersion() const;
/**
* Sub firmware version running on the device's microcontroller (as v4.12, this is the 12).
* Sub firmware version running on the device's microcontroller (as of v4.12, this is the 12).
*/
int32 GetSubFirmwareVersion() const;
public:
/**
* Returns true if this glove's firmware is newer than certain version.
*
* @param FirmwareMain
* @param FirmwareSub
* @param bInclusive
*/
bool FirmwareNewerThan(int32 FirmwareMain, int32 FirmwareSub, bool bInclusive) const;
/**
* Returns true if this glove's firmware is older than certain version.
*
* @param FirmwareMain
* @param FirmwareSub
* @param bInclusive
*/
bool FirmwareOlderThan(int32 FirmwareMain, int32 FirmwareSub, bool bInclusive) const;
};
@@ -1,203 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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
*
* A command for five fingers that can be sent to a Sense Glove device.
*/
#pragma once
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "Templates/SharedPointer.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGFingerCommand.generated.h"
class FSGBuzzCommandImpl;
class FSGFingerCommandImpl;
class FSGForceFeedbackCommandImpl;
class FSGTimedBuzzCommandImpl;
/**
* A command that contains values (levels) for five fingers.
*/
UCLASS(Abstract, BlueprintType)
class SENSEGLOVECORE_API USGFingerCommand : public UObject
{
GENERATED_BODY()
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
protected:
/**
*
*/
USGFingerCommand();
/**
*
*/
explicit USGFingerCommand(const TArray<int32>& InLevels);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGFingerCommand(const FSGFingerCommandImpl& FingerCommandImpl);
/**
* The cast from underlying child type constructor.
*/
explicit USGFingerCommand(const FSGBuzzCommandImpl& BuzzCommandImpl);
/**
* The cast from underlying child type constructor.
*/
explicit USGFingerCommand(const FSGForceFeedbackCommandImpl& ForceFeedbackCommandImpl);
/**
* The cast from underlying child type constructor.
*/
explicit USGFingerCommand(const FSGTimedBuzzCommandImpl& TimedBuzzCommandImpl);
protected:
/**
* The cast from underlying pointer type constructor.
*/
explicit USGFingerCommand(TSharedRef<FSGFingerCommandImpl> FingerCommandImpl);
/**
* The cast from underlying child pointer type constructor.
*/
explicit USGFingerCommand(TSharedRef<FSGBuzzCommandImpl> BuzzCommandImpl);
/**
* The cast from underlying child pointer type constructor.
*/
explicit USGFingerCommand(TSharedRef<FSGForceFeedbackCommandImpl> ForceFeedbackCommandImpl);
/**
* The cast from underlying child pointer type constructor.
*/
explicit USGFingerCommand(TSharedRef<FSGTimedBuzzCommandImpl> TimedBuzzCommandImpl);
public:
/**
* The destructor.
*/
virtual ~USGFingerCommand() override;
protected:
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetFingerCommandImpl(const FSGFingerCommandImpl& FingerCommandImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetFingerCommandImpl(const FSGBuzzCommandImpl& BuzzCommandImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetFingerCommandImpl(const FSGForceFeedbackCommandImpl& ForceFeedbackCommandImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetFingerCommandImpl(const FSGTimedBuzzCommandImpl& TimedBuzzCommandImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetFingerCommandImpl(TSharedRef<FSGFingerCommandImpl> FingerCommandImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetFingerCommandImpl(TSharedRef<FSGBuzzCommandImpl> BuzzCommandImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetFingerCommandImpl(TSharedRef<FSGForceFeedbackCommandImpl> ForceFeedbackCommandImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetFingerCommandImpl(TSharedRef<FSGTimedBuzzCommandImpl> TimedBuzzCommandImpl);
public:
/**
* The cast to underlying type method.
*/
TSharedRef<FSGFingerCommandImpl> ToFingerCommandImpl() const;
public:
/**
*
*/
TArray<int32> GetLevels() const;
public:
/**
*
*/
int32 GetLevel(int32 Finger) const;
/**
*
*/
void SetLevel(int32 Finger, int32 Value);
/**
* Check if this command contains the same values as another.
*/
bool Equals(const USGFingerCommand* FingerCommand) const;
/**
* Create a string representation of this finger command.
*/
FString ToString() const;
};
@@ -1,149 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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
*
* A command for five fingers that can be sent to a Sense Glove device.
*/
#pragma once
#include "HAL/Platform.h"
#include "Templates/SharedPointer.h"
#include "UObject/ObjectMacros.h"
#include "SGCore/SGFingerCommand.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGForceFeedbackCommand.generated.h"
class FSGForceFeedbackCommandImpl;
/**
* A Force-Feedback command for the Sense Glove, with levels for each finger.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGForceFeedbackCommand final : public USGFingerCommand
{
GENERATED_BODY()
public:
static USGForceFeedbackCommand* NewForceFeedbackCommand(
UObject* Outer, const FSGForceFeedbackCommandImpl& ForceFeedbackCommandImpl);
static USGForceFeedbackCommand* NewForceFeedbackCommand(
UObject* Outer, TSharedRef<FSGForceFeedbackCommandImpl> ForceFeedbackCommandImpl);
public:
/**
* Empty constructor for internal initialization.
*/
static USGForceFeedbackCommand* NewForceFeedbackCommand(UObject* Outer);
/**
* Create a new Force-Feedback Command, with levels for each finger stored in an int[5] array.
*/
static USGForceFeedbackCommand* NewForceFeedbackCommand(
UObject* Outer, const TArray<int32>& ForceFeedbackLevels);
/**
* Create a new Force-Feedback Command, with levels for each finger.
*/
static USGForceFeedbackCommand* NewForceFeedbackCommand(
UObject* Outer, int32 Thumb, int32 Index, int32 Middle, int32 Ring, int32 Pinky);
/**
* Create a new Force-Feedback command, with only one finger being activated.
*/
static USGForceFeedbackCommand* NewForceFeedbackCommand(
UObject* Outer, ESGFinger Finger, int32 BuzzLevel);
public:
/**
* A command that turns off all force feedback on the Sense Glove.
*/
static USGForceFeedbackCommand* Off(UObject* Outer);
public:
/**
* Empty constructor for internal initialization.
*/
USGForceFeedbackCommand();
/**
* Create a new Force-Feedback Command, with levels for each finger stored in an int[5] array.
*/
explicit USGForceFeedbackCommand(const TArray<int32>& ForceFeedbackLevels);
/**
* Create a new Force-Feedback Command, with levels for each finger.
*/
USGForceFeedbackCommand(int32 Thumb, int32 Index, int32 Middle, int32 Ring, int32 Pinky);
/**
* Create a new Force-Feedback command, with only one finger being activated.
*/
USGForceFeedbackCommand(ESGFinger Finger, int32 BuzzLevel);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGForceFeedbackCommand(const FSGForceFeedbackCommandImpl& ForceFeedbackCommandImpl);
protected:
/**
* The cast from underlying pointer type constructor.
*/
explicit USGForceFeedbackCommand(TSharedRef<FSGForceFeedbackCommandImpl> ForceFeedbackCommandImpl);
public:
/**
* The destructor.
*/
virtual ~USGForceFeedbackCommand() override;
public:
/**
* The cast to underlying type method.
*/
TSharedRef<FSGForceFeedbackCommandImpl> ToForceFeedbackCommandImpl() const;
public:
/**
* Copy this ForceFeedback Command into a new object.
*/
USGForceFeedbackCommand* Copy(UObject* Outer) const;
/**
* Merge this finger command with another, taking the maximum value between the two.
*/
USGForceFeedbackCommand* Merge(UObject* Outer, const USGForceFeedbackCommand* ForceFeedbackCommand) const;
};
@@ -71,76 +71,18 @@ public:
static USGHandInterpolator* NewHandInterpolator(UObject* Outer);
/**
* Create a new basic HandInterpolator without a starting rotation.
* Create a new basic HandInterpolator.
*/
static USGHandInterpolator* NewHandInterpolator(
UObject* Outer,
const TArray<TArray<USGInterpolationSet*>>& JointInterpolations);
/**
* Create a new basic HandInterpolator without a starting rotation.
*/
static USGHandInterpolator* NewHandInterpolator(
UObject* Outer,
const TArray<FSGInterpolationSetArray>& JointInterpolations);
/**
* Create a new basic HandInterpolator with a starting rotation.
*/
static USGHandInterpolator* NewHandInterpolator(
UObject* Outer,
const TArray<TArray<USGInterpolationSet*>>& JointInterpolations, const FQuat& CmcStartRotation);
/**
* Create a new basic HandInterpolator with a starting rotation.
*/
static USGHandInterpolator* NewHandInterpolator(
UObject* Outer,
const TArray<TArray<USGInterpolationSet*>>& JointInterpolations, const FRotator& CmcStartRotation);
/**
* Create a new basic HandInterpolator with a starting rotation.
*/
static USGHandInterpolator* NewHandInterpolator(
UObject* Outer,
const TArray<FSGInterpolationSetArray>& JointInterpolations, const FQuat& CmcStartRotation);
/**
* Create a new basic HandInterpolator with a starting rotation.
*/
static USGHandInterpolator* NewHandInterpolator(
UObject* Outer,
const TArray<FSGInterpolationSetArray>& JointInterpolations, const FRotator& CmcStartRotation);
static USGHandInterpolator* NewHandInterpolator(UObject* Outer, bool bRightHanded);
public:
/**
* Create a default instance of a left- or right handed interpolator.
*/
static USGHandInterpolator* Default(UObject* Outer, const bool bRightHanded);
/**
* Convert a serialized HandInterpolator back into a class representation.
*
* @param SerializedString
* @param bRightHanded
*/
static USGHandInterpolator* Deserialize(UObject* Outer, const FString& SerializedString);
public:
/**
* Calculate all angles of a specific finger based on an Interpolator and input angles.
*/
static TArray<FVector> InterpolateFingerAngles(ESGFinger Finger, const USGHandInterpolator* Interpolator,
const FVector& TotalGloveAngles);
/**
* Calculate all angles of the Thumb based on an Interpolator and input angles.
*/
static TArray<FVector> InterpolateThumbAngles(const USGHandInterpolator* Interpolator,
const FVector& TotalGloveAngles);
/**
* Calculate all hand angles based on an interpolator and total xyz angles.
*/
static TArray<TArray<FVector>> InterpolateHandAngles(const USGHandInterpolator* Interpolator,
const TArray<FVector>& TotalAngles);
static USGHandInterpolator* Deserialize(UObject* Outer, const FString& SerializedString, bool bRightHanded = true);
private:
struct FImpl;
@@ -160,38 +102,9 @@ public:
USGHandInterpolator();
/**
* Create a new basic HandInterpolator without a starting rotation.
* Create a new basic HandInterpolator.
*/
explicit USGHandInterpolator(const TArray<TArray<USGInterpolationSet*>>& JointInterpolations);
/**
* Create a new basic HandInterpolator without a starting rotation.
*/
explicit USGHandInterpolator(const TArray<FSGInterpolationSetArray>& JointInterpolations);
/**
* Create a new basic HandInterpolator without a starting rotation.
*/
USGHandInterpolator(const TArray<TArray<USGInterpolationSet*>>& JointInterpolations,
const FQuat& CmcStartRotation);
/**
* Create a new basic HandInterpolator with a starting rotation.
*/
USGHandInterpolator(const TArray<TArray<USGInterpolationSet*>>& JointInterpolations,
const FRotator& CmcStartRotation);
/**
* Create a new basic HandInterpolator with a starting rotation.
*/
USGHandInterpolator(const TArray<FSGInterpolationSetArray>& JointInterpolations,
const FQuat& CmcStartRotation);
/**
* Create a new basic HandInterpolator with a starting rotation.
*/
USGHandInterpolator(const TArray<FSGInterpolationSetArray>& JointInterpolations,
const FRotator& CmcStartRotation);
explicit USGHandInterpolator(bool bRightHanded);
public:
/**
@@ -218,68 +131,28 @@ public:
const FSGHandInterpolatorImpl& ToHandInterpolatorImpl() const;
public:
/**
* Interpolation sets for each finger. First index indicates which finger, Second index indicates the joint movement.
*/
TArray<TArray<USGInterpolationSet*>> GetJointInterpolations(UObject* Outer) const;
/**
* Starting rotation of the thumb cmc joint.
*/
FQuat GetCmcStartRotationQ() const;
/**
* Starting rotation of the thumb cmc joint.
*/
FRotator GetCmcStartRotation() const;
public:
/**
* Calculate any finger's movement rotation, using an input value.
*
* WARNING: This method is for internal use only. Avoid using it!
*/
float CalculateAngle(ESGFinger Finger, int32 Movement, float Value) const;
/**
* Calculate a finger movement's rotation, using an input value.
*
* WARNING: This method is for internal use only. Avoid using it!
*/
float CalculateAngle(ESGFinger Finger, ESGFingerMovement Movement, float Value) const;
float CalculateAngle(ESGFingerMovement Movement, float Value, bool bApplyLimits = true) const;
/**
* Calculate a thumb movement's rotation, using an input value.
*
* WARNING: This method is for internal use only. Avoid using it!
*/
float CalculateAngle(ESGFinger Finger, ESGThumbMovement Movement, float Value) const;
float CalculateAngle(ESGThumbMovement Movement, float Value, bool bApplyLimits = true) const;
public:
/**
* Updates a particular joint movement interpolation, without changing its limits.
* Calculate all hand angles based on an interpolator and normalized input.
*/
void SetInterpolation(int32 Finger, int32 Movement, float InputAt0, float InputAt1, float AngleAt0, float AngleAt1);
/**
* Updates a particular joint movement interpolation, without changing its limits.
*/
void SetInterpolation(ESGFinger Finger, ESGFingerMovement Movement,
float InputAt0, float InputAt1, float AngleAt0, float AngleAt1);
/**
* Updates a particular joint movement interpolation, without changing its limits.
*/
void SetInterpolation(ESGThumbMovement Movement, float InputAt0, float InputAt1, float AngleAt0, float AngleAt1);
/**
* Returns an interpolationSet
*/
USGInterpolationSet* GetInterpolation(UObject* Outer, int32 Finger, int32 Movement) const;
TArray<TArray<FVector>> InterpolateHandAngles(
const TArray<TArray<float>>& Flexions, const TArray<float>& Abductions, float CmcTwist) const;
public:
/**
* Check if this handInterpolator matches another.
*
* @param HandInterpolator
*/
bool Equals(const USGHandInterpolator* HandInterpolator) const;
@@ -288,4 +161,4 @@ public:
* Serialize this HandInterpolator into a string representation.
*/
FString SGSerialize() const;
};
};
@@ -0,0 +1,255 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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
*
* A way to access all sorts of Hand Tracking and -Haptics without needing to
* cache any device instances.
* Use this layer if you don't care where a HandPose is coming from, and are
* fine with calling generic haptic functions.
*/
#pragma once
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "HAL/Platform.h"
#include "Math/Quat.h"
#include "Math/Vector.h"
#include "UObject/ObjectMacros.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGHandLayer.generated.h"
class USGCustomWaveform;
class USGHandPose;
class USGHapticGlove;
/**
* A way to access all sorts of Hand Tracking and -Haptics without needing to cache any device instances.
*/
USTRUCT()
struct SENSEGLOVECORE_API FSGHandLayer
{
GENERATED_BODY()
public:
/**
* Returns true if there is a HapticGlove Device connected that corresponds to the chosen hand.
*
* @param bRightHanded
*/
static bool DeviceConnected(bool bRightHanded);
/**
* Returns the Device Type of the right / left hand.
*
* @param bRightHanded
*/
static ESGDeviceType GetDeviceType(bool bRightHanded);
/**
* Returns the handedness of the first device you can find; true for right, false for left. Use this for testing a
* single glove.
*/
static bool GetFirstGloveHandedness();
/**
* Returns the number of Haptic Gloves connected to the system.
*/
static int32 GlovesConnected();
/**
* Retrieve a Glove Instance for the right- or left hand to do more complicated, device-specific stuff.
*
* @param bRightHanded
* @param OutGlove
*/
static bool GetGloveInstance(UObject* Outer, bool bRightHanded, USGHapticGlove*& OutGlove);
/**
* Returns the calibration state of the chosen hand.
*
* @param bRightHanded
*/
static ESGHapticGloveCalibrationState GetCalibrationState(bool bRightHanded);
/**
* Returns the Calibration Instructions for the chosen hand.
*
* @param bRightHanded
*/
static FString GetCalibrationInstructions(bool bRightHanded);
/**
* Reset the calibration of the left/right hand.
*
* @param bRightHanded
*/
static void ResetCalibration(bool bRightHanded);
/**
* Reset the calibration of the left/right hand.
*
* @param bRightHanded
*/
static void EndCalibration(bool bRightHanded);
/**
* Attempt to get the HandPose through any of our gloves. You don't care which one is on the other side, as long as
* you get one.
*
* @param bRightHanded
* @param OutHandPose
*/
static bool GetHandPose(UObject* Outer, bool bRightHanded, USGHandPose*& OutHandPose);
/**
* Calculate the Wrist Location of the chosen hand, based on a reference location and tracking hardware.
*
* @param bRightHanded
* @param ReferencePosition
* @param ReferenceRotation
* @param TrackingHardware
* @param OutWristPosition
* @param OutWristRotation
*/
static void GetWristLocation(
bool bRightHanded,
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FQuat& OutWristRotation);
/**
* Sends all haptics in the queue for the Left / Right hand.
* @param bRightHanded
*/
static bool SendHaptics(bool bRightHanded);
/**
* Stop all haptics on the chosen hand.
*
* @param bRightHanded
*/
static void StopAllHaptics(bool bRightHanded);
/**
* Tell a specific hand to hold the force-feedback at a certain level.
*
* @param bRightHanded
* @param Finger
* @param Level01
* @param bSendImmediate
*/
static bool QueueCommand_ForceFeedbackLevel(bool bRightHanded, int32 Finger, float Level01, bool bSendImmediate);
/**
* Queue Force Feedback for multiple fingers. Up to 5. Make sure the value is not NULL.
*
* @param bRightHanded
* @param Levels01
* @param bSendImmediate
*/
static bool QueueCommand_ForceFeedbackLevels(
bool bRightHanded, const TArray<float>& Levels01, bool bSendImmediate);
/**
* Queue a command to set the vibration level(s) of a Haptic Glove's finger. Note: This is only for Nova 1.0 and
* DK1.0.
*
* @param bRightHanded
* @param Finger
* @param Level01
* @param bSendImmediate
*/
static bool QueueCommand_SetVibroLevel(bool bRightHanded, int32 Finger, float Level01, bool bSendImmediate);
/**
* Queue a command to set the vibration level(s) of a Haptic Glove's finger. Note: This is only for Nova 1.0 and
* DK1.0.
*
* @param bRightHanded
* @param Levels01
* @param bSendImmediate
*/
static bool QueueCommand_SetVibroLevels(bool bRightHanded, const TArray<float>& Levels01, bool bSendImmediate);
/**
* Returns true if the glove for this hand supports a custom waveform vibration on said location.
*
* @param bRightHanded
* @param AtLocation
*/
static bool SupportsCustomWaveform(bool bRightHanded, ESGHapticLocation AtLocation);
/**
* Send a Custom Waveform to a glove at a specific location.
*
* @param bRightHanded
* @param OutWaveform
* @param Location
*/
static bool SendCustomWaveform(bool bRightHanded, USGCustomWaveform*& OutWaveform, ESGHapticLocation Location);
/**
* Returns true if the chosen glove supports active contact feedback on the Wrist.
*
* @param bRightHanded
*/
static bool SupportsWristSqueeze(bool bRightHanded);
/**
* Queue a command to set a squeeze level on the wrist, and optionally send it right away.
*
* @param bRightHanded
* @param SqueezeLevel01
* @param bSendImmediate
*/
static bool QueueCommand_WristSqueeze(bool bRightHanded, float SqueezeLevel01, bool bSendImmediate);
/**
* Returns true is the chosen hand supports flexion locking; automatic locking of FFB when flexed beyond a specific
* point.
*
* @param bRightHanded
*/
static bool SupportsFlexionLocks(bool bRightHanded);
/**
* If the flexion exceeds a particular value, turn on the Force-Feedback.
*/
static bool QueueCommand_FlexionLock(bool bRightHanded, int32 Finger, float Flexion01, bool bSendImmediate);
/**
* Stop any Flexion Threshold active on the chosen finger.
*/
static bool QueueCommand_ClearFlexionLock(bool bRightHanded, int32 Finger, bool bSendImmediate);
};
@@ -51,8 +51,8 @@
#include "SGHandPose.generated.h"
class USGBasicHandModel;
class FSGHandPoseImpl;
class USGBasicHandModel;
class USGHandPose;
/**
@@ -142,12 +142,14 @@ public:
static USGHandPose* FlatHand(UObject* Outer, bool bRightHanded);
/**
* Generates a HandPose representing a 'thumbs up', used in calibration to determine finger flexion, thumb extension and adduction.
* Generates a HandPose representing a 'thumbs up', used in calibration to determine finger flexion, thumb
* extension and adduction.
*/
static USGHandPose* ThumbsUp(UObject* Outer, bool bRightHanded, const USGBasicHandModel* HandDimensions);
/**
* Generates a HandPose representing a 'thumbs up', used in calibration to determine finger flexion, thumb extension and adduction.
* Generates a HandPose representing a 'thumbs up', used in calibration to determine finger flexion, thumb
* extension and adduction.
*/
static USGHandPose* ThumbsUp(UObject* Outer, bool bRightHanded);
@@ -200,7 +202,7 @@ public:
const TArray<FSGVectorArray>& HandAngles);
/**
*
* Create a new instance of HandPose.
*/
USGHandPose(bool bRightHanded,
const TArray<FSGVectorArray>& JointPositions, const TArray<FSGRotatorArray>& JointRotations,
@@ -1,209 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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
*
* A profile containing all the information required for HapticGloves.
*/
#pragma once
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGHandProfile.generated.h"
class FSGHandProfileImpl;
class USGNovaGloveHandProfile;
class USGSenseGloveHandProfile;
/**
* Interpolation profiles for a user's hand, compatible with all HapticGloves.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGHandProfile final : public UObject
{
GENERATED_BODY()
public:
static USGHandProfile* NewHandProfile(
UObject* Outer, const FSGHandProfileImpl& HandProfileImpl);
public:
/**
* The default constructor.
*/
static USGHandProfile* NewHandProfile(UObject* Outer);
/**
* Creates a new instance of a HandProfile.
*/
static USGHandProfile* NewHandProfile(
UObject* Outer,
bool bRightHanded,
const USGSenseGloveHandProfile* SenseGloveHandProfile,
const USGNovaGloveHandProfile* NovaGloveHandProfile);
public:
/**
* Generate a new handProfile for either a left or right hand.
*/
static USGHandProfile* Default(UObject* Outer, bool bRightHanded);
/**
* Convert a string notation of a NovaGloveHandProfile into a new instance.
*/
static USGHandProfile* Deserialize(UObject* Outer, const FString& SerializedString);
public:
/**
* Returns the directory where HandProfiles are being stored. Does not include a '\\' at the end.
*/
static FString GetProfileDirectory();
/**
* Filename for the left hand profile.
*/
static FString GetLeftHandFileName();
/**
* Filename for the right hand profile.
*/
static FString GetRightHandFileName();
/**
* Returns the fileName of the left or right-handed profiles.
*/
static FString GetProfileFileName(bool bRightHanded);
/**
* Retrieves the latest HandProfile from disk. If this function returns false, latestProfils is equal to SGCOre::HandProfile::Default(rightHand).
*/
static bool GetLatestProfile(UObject* Outer, bool bRightHanded, USGHandProfile*& OutLatestProfile);
/**
* Stores a HandProfile on disk for other programs to access. Call this function only if your software handles calibration functions.
*/
static bool StoreProfile(const USGHandProfile* ProfileToStore);
/**
* Resets the Calibration of a specific back to default values.
*/
static bool ResetCalibration(bool bRightHanded, bool bOnDisk = true);
/**
* Resets the Calibration of both hands back to default values.
*/
static void ResetCalibration(bool bOnDisk = true);
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
/**
* The default constructor.
*/
USGHandProfile();
/**
* Creates a new instance of a HandProfile.
*/
USGHandProfile(bool bRightHanded,
const USGSenseGloveHandProfile* SenseGloveHandProfile,
const USGNovaGloveHandProfile* NovaGloveHandProfile);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGHandProfile(const FSGHandProfileImpl& HandProfileImpl);
public:
/**
* The destructor.
*/
virtual ~USGHandProfile() override;
protected:
/**
* Allows to set the underlying object after construction.
*/
void SetHandProfileImpl(const FSGHandProfileImpl& HandProfileImpl);
public:
/**
* The cast to underlying type method.
*/
const FSGHandProfileImpl& ToHandProfileImpl() const;
public:
/**
* Whether this profile was created for a left or right hand.
*/
bool IsRight() const;
/**
* Profile for SenseGloves.
*/
USGSenseGloveHandProfile* GetSenseGloveHandProfile(UObject* Outer) const;
/**
* User profile for Nova.
*/
USGNovaGloveHandProfile* GetNovaGloveHandProfile(UObject* Outer) const;
public:
/**
*
*/
bool Equals(const USGHandProfile* HandProfile) const;
/**
* Reset this profile back to its default values.
*/
void Reset();
public:
/**
* Convert this NovaGloveHandProfile into a string notation so it can be stored on disk.
*/
FString SGSerialize() const;
};
@@ -0,0 +1,199 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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
*
* Contains information on Haptic channels available to this device for IPC.
* Some devices have different "Haptic Channels". This info is exposed via IPC
* to SGCore.
*/
#pragma once
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGHapticChannelInfo.generated.h"
class FSGHapticChannelInfoImpl;
/*
* Contains information on Haptic channels available to this device for IPC.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGHapticChannelInfo final : public UObject
{
GENERATED_BODY()
public:
static USGHapticChannelInfo* NewHapticChannelInfo(
UObject* Outer, const FSGHapticChannelInfoImpl& HapticChannelInfoImpl);
public:
/**
* The default constructor.
*/
static USGHapticChannelInfo* NewHapticChannelInfo(UObject* Outer);
/**
* Create a new instance of HapticChannelInfo.
*/
static USGHapticChannelInfo* NewHapticChannelInfo(
UObject* Outer,
const TArray<int32>& StreamIndex, const TArray<int32>& FireAndForgetIndex);
public:
/**
* Generate a single IPCAddress for an address.
*
* @param DeviceIndex
* @param ChannelIndex
*/
static FString GenerateAddress(int32 DeviceIndex, int32 ChannelIndex);
/**
* Parse HapticChannelInfo received through IPC into usable data.
*
* @param IpcString
*/
static USGHapticChannelInfo* Parse(UObject* Outer, const FString& IpcString);
public:
/**
* Byte used to identify streaming channels.
*/
static int32 GetStreamingType();
/**
* Byte used to indicate fire-and-forget channels.
*/
static int32 GetFireAndForgetType();
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
/**
* Creates a default HapticChannelInfo, with solely a single streaming haptic Channel.
*/
USGHapticChannelInfo();
/**
* Create a new instance of HapticChannelInfo.
*/
USGHapticChannelInfo(const TArray<int32>& StreamIndex, const TArray<int32>& FireAndForgetIndex);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGHapticChannelInfo(const FSGHapticChannelInfoImpl& HapticChannelInfoImpl);
public:
/**
* The destructor.
*/
virtual ~USGHapticChannelInfo() override;
protected:
/**
* Allows to set the underlying object after construction.
*/
void SetHapticChannelInfoImpl(const FSGHapticChannelInfoImpl& HapticChannelInfoImpl);
public:
/**
* The cast to underlying type method.
*/
const FSGHapticChannelInfoImpl& ToHapticChannelInfoImpl() const;
public:
/**
* Returns the amount of streaming channels available for haptics. Will indicate if a device can support the
* haptics you're trying to send through it.
*/
int32 GetStreamChannelCount() const;
/**
* Returns the amount of fire-and-forget channels available for haptics. Will indicate if a device can support the
* haptics you're trying to send through it.
*/
int32 GetFireAndForgetChannelCount() const;
/**
* Retrieve the total amount of channels for this device.
*/
int32 GetTotalChannelCount() const;
/**
* Returns the address that corresponds to the nth channel of a specific type. It's unguarded, which means I don't
* check the validity of index - could result in an exception. Optimized piece of code for for loops.
*
* @param Type
* @param TypeIndex
*/
FString GetAddress_Unguarded(ESGHapticChannelType Type, int32 TypeIndex) const;
/**
* Returns the address that corresponds to the nth channel of a specific type. It's unguarded, which means I don't
* check the validity of index - could result in an exception. Optimized piece of code for for loops.
* Used for Internals.
*
* @param Type
* @param TypeIndex
* @param OutIndex
* @param OutAddressString
*/
void GetIpcParams_Unguarded(ESGHapticChannelType Type, int32 TypeIndex,
int32& OutIndex, FString& OutAddressString) const;
/**
* Regenerate the channel names for a specific device Index in shared memory.
*
* @param ForDeviceIndex
*/
void RegenerateAddresses(int32 ForDeviceIndex);
/**
* Returns an array of all the haptic addresses stored for this info channel.
*/
TArray<FString> GetAllAddresses() const;
};
@@ -37,24 +37,27 @@
#pragma once
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "HAL/Platform.h"
#include "Math/Quat.h"
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGCore/SGBasicHandModel.h"
#include "SGCore/SGDevice.h"
#include "SGCore/SGHandPose.h"
#include "SGCore/SGHandProfile.h"
#include "SGCore/SGThumperCommand.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGHapticGlove.generated.h"
class FSGHapticGloveImpl;
class FSGNovaGloveImpl;
class FSGNova2GloveImpl;
class FSGSenseGloveImpl;
class USGBuzzCommand;
class USGForceFeedbackCommand;
class USGBasicHandModel;
class USGCustomWaveform;
/**
* A glove developed by SenseGlove, that has hand tracking and/or haptic feedback functionality.
@@ -66,6 +69,7 @@ class SENSEGLOVECORE_API USGHapticGlove : public USGDevice
private:
friend class USGHapticGloveCalibrationSequence;
friend struct FSGHandLayer;
protected:
static USGHapticGlove* NewHapticGlove(UObject* Outer, const FSGHapticGloveImpl& HapticGloveImpl);
@@ -81,19 +85,37 @@ protected:
public:
/**
* Get all Haptic Gloves detected on this system.
*
* @param bConnectedOnly
*/
static TArray<USGHapticGlove*> GetHapticGloves(UObject* Outer);
static TArray<USGHapticGlove*> GetHapticGloves(UObject* Outer, bool bConnectedOnly = true);
/**
* Get the first Haptic Glove detected on this system.
*
* @param OutGlove
*/
static bool GetGlove(UObject* Outer, USGHapticGlove*& OutGlove);
/**
* Get the first left/right Haptic Glove detected on this system.
*
* @param bRightHanded
* @param OutGlove
*/
static bool GetGlove(UObject* Outer, bool bRightHanded, USGHapticGlove*& OutGlove);
public:
/**
*
*/
static FString ToString(ESGHapticGloveCalibrationState State);
/**
*
*/
static FString ToString(ESGHapticLocation Location);
protected:
/**
* The basic constructor.
@@ -111,6 +133,11 @@ public:
*/
explicit USGHapticGlove(const FSGHapticGloveImpl& HapticGloveImpl);
/**
* The cast from underlying child type constructor.
*/
explicit USGHapticGlove(const FSGNova2GloveImpl& NovaGloveImpl);
/**
* The cast from underlying child type constructor.
*/
@@ -132,6 +159,11 @@ protected:
*/
explicit USGHapticGlove(TSharedRef<FSGHapticGloveImpl> HapticGloveImpl);
/**
* The cast from underlying child pointer type constructor.
*/
explicit USGHapticGlove(TSharedRef<FSGNova2GloveImpl> NovaGloveImpl);
/**
* The cast from underlying child pointer type constructor.
*/
@@ -195,31 +227,54 @@ public:
*/
virtual bool GetImuRotation(FRotator& OutImu);
/**
* Calculate the Hand Pose of this device, provided it has Hand Tracking available
*/
virtual bool GetHandPose(
UObject* Outer,
const USGBasicHandModel* HandGeometry, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose);
/**
* Calculate the HandPose of this Device, taking into account user values, but not hand geometry.
*/
virtual bool GetHandPose(UObject* Outer, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose);
/**
* Retrieve a HandPose based on the latest profile, but with a specific hand geometry.
*/
virtual bool GetHandPose(UObject* Outer, const USGBasicHandModel* HandGeometry, USGHandPose*& OutHandPose);
virtual bool GetHandPose(UObject* Outer, const USGBasicHandModel* HandGeometry, USGHandPose*& OutHandPose) const;
/**
* Retrieve a HandPose based on the latest profile and default hand Geometry.
*/
virtual bool GetHandPose(UObject* Outer, USGHandPose*& OutHandPose);
#if PLATFORM_ANDROID
virtual bool GetHandPose(UObject* Outer, float DeltaTime, USGHandPose*& OutHandPose);
#endif /* PLATFORM_ANDROID */
/**
* Returns the Hand Angles calculated by this Nova 2 Glove. Used for input for HandPoses, but can be used in and of
* itself.
*
* @param OutHandAngles
*/
virtual bool GetHandAngles(TArray<TArray<FVector>>& OutHandAngles) const;
/**
*
*/
USGBasicHandModel* GetHandGeometry(UObject* Outer) const;
/**
*
*/
void SetHandGeometry(const USGBasicHandModel* HandGeometry);
public:
/**
* Returns the HapticGlove's state of calibration for its on-board sensors.
*/
virtual ESGHapticGloveCalibrationState GetCalibrationState() const;
/**
* Resets internal calibration of the Haptic Glove.
*/
virtual void EndCalibration();
/**
* Force-End any form of calibration manually, if any is still running.
*/
virtual void ResetCalibration();
/**
* Retrieve the current calibration instruction.
*/
virtual FString GetCalibrationInstruction() const;
public:
/**
@@ -228,74 +283,52 @@ public:
virtual void StopHaptics();
/**
* Send Haptic Commands to this Glove.
* Stops only vibrations.
*/
virtual void StopVibrations();
/**
* Send Haptic Commands to this Glove.
* Take all active commands in the device queue, compile them into one and send them to the device.
*
* @return Returns true if the message was successfully sent to SenseCom.
*/
virtual void SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand);
/**
* Send Haptic Commands to this Glove.
*/
virtual void SendHaptics(const USGBuzzCommand* BuzzCommand);
/**
* Send Haptic Commands to this Glove.
*/
virtual void SendHaptics(const USGThumperCommand* ThumperCommand);
/**
* Send Haptic Commands to this Glove.
*/
virtual void SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand,
const USGBuzzCommand* BuzzCommand);
/**
* Send Haptic Commands to this Glove.
*/
virtual void SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand,
const USGBuzzCommand* BuzzCommand,
const USGThumperCommand* ThumperCommand);
virtual bool SendHaptics();
public:
/**
* Retrieve calibration values of this glove, as an array of size 5, containing x (roll), y (flexion), z (abduction) values.
* Queue a list of force-feedback levels, between 0.0f and 1.0f. Your list should be sorted from thumb to pinky.
*
* @param Levels01 Array containing the Force-Feedback levels, from 0.0f (no FFB) to 1.0f. A value < 0.0f will be
* ignored.
*
* @remarks Devices that 'only' have on/off FFB will treat any value > 0.0 as 1.0.
*/
virtual bool GetCalibrationValues(TArray<FVector>& OutValues);
virtual bool QueueForceFeedbackLevels(const TArray<float>& Levels01);
/**
* Reset Calibration range for this Device.
* Set the Force-Feedback value of a particular finger to a specific level </summary>
*
* @param Level01 Value will be clamped between [0...1], where 0.0f means no Force-Feedback, and 1.0 means full
* force-feedback.
* @param Finger The finger to which to send the command.
*/
virtual void ResetCalibrationRange();
virtual bool QueueForceFeedbackLevel(int32 Finger, float Level01);
/**
* Updates calibration values only.
* Returns true if the HapticGlove supports vibration feedback on the specified location.
*
* @param AtLocation
*/
virtual void UpdateCalibrationRange();
virtual bool SupportsCustomWaveform(ESGHapticLocation AtLocation) const;
/**
* Updates calibration values only.
* Sends a custom waveform to the location specified, provided that the glove has a motor there, and can support
* custom waveforms.
*
* @param OutWaveform
* @param Location
*/
virtual void UpdateCalibrationRange(const TArray<FVector>& CalibrationValues);
/**
* Access the minimum- and maximum sensor values measured by this Haptic Glove, in this session.
*/
virtual void GetCalibrationRange(TArray<FVector>& OutMinValues,
TArray<FVector>& OutMaxValues);
/**
* Updates Calibration values and applies it to the Profile.
*/
virtual void UpdateCalibration(UObject* Outer, USGHandProfile*& OutProfile);
/**
* Apply this glove's calibration range to a handProfile.
*/
virtual void ApplyCalibration(UObject* Outer, USGHandProfile*& OutProfile) const;
virtual bool SendCustomWaveform(USGCustomWaveform* OutWaveform, ESGHapticLocation Location);
public:
/**
@@ -329,4 +362,10 @@ public:
virtual void GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutGlovePosition, FRotator& OutGloveRotation) const;
public:
/**
* Create a String Representation of this Haptic Glove.
*/
virtual FString ToString() const override;
};
@@ -1,196 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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 "Containers/Array.h"
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGHapticGloveCalibrationCheck.generated.h"
class FSGHapticGloveCalibrationCheckImpl;
class USGSensorRange;
/**
* An algorithm that checks whether or not our current user is running in the same calibration range as last time.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGHapticGloveCalibrationCheck final : public UObject
{
GENERATED_BODY()
public:
static USGHapticGloveCalibrationCheck* NewHapticGloveCalibrationCheck(
UObject* Outer, const FSGHapticGloveCalibrationCheckImpl& HapticGloveCalibrationCheckImpl);
public:
/**
* The last calibration range can be null, at which point you definitely need calibration.
*/
static USGHapticGloveCalibrationCheck* NewHapticGloveCalibrationCheck(UObject* Outer);
/**
* The last calibration range can be null, at which point you definitely need calibration.
*/
static USGHapticGloveCalibrationCheck* NewHapticGloveCalibrationCheck(
UObject* Outer, const USGSensorRange* LastCalibrationRange);
public:
/**
* SenseGlove: How far from the threshold one can be where we would still call it 'the same as before'.
*/
static float GetSenseGloveThreshold();
/**
* Nova: How far from the threshold one can be where we would still call it 'the same as before'.
*/
static float GetNovaGloveThreshold();
/**
* SenseGlove: The minimum amount of sensor flexion movement before we start testing for a smaller hand.
*/
static float GetSenseGloveMinFlexion();
/**
* Nova: The minimum amount of sensor flexion movement before we start testing for a smaller hand.
*/
static float GetNovaGloveMinFlexion();
/**
* SenseGlove: The minimum amount of sensor movement on the thumb abduction before we start testing for a smaller hand.
*/
static float GetSenseGloveMinAbduction();
/**
* Nova: The minimum amount of sensor movement on the thumb abduction before we start testing for a smaller hand.
*/
static float GetNovaGloveMinAbduction();
public:
/**
* Returns true if this DeviceType requires a calibration check.
*/
static bool NeedsCheck(ESGDeviceType DeviceType);
/**
* Checks if current values are operating out of the previous range. Returns -1 if all is fine. 0...4 to indicate which finger is out of bounds.
*/
static int32 OutOfBounds(const USGSensorRange* PreviousRange, const TArray<FVector>& CurrentValues,
ESGDeviceType DeviceType);
/**
* Returns true if the user has moved enough in both flexion and thumb abduction movement to be considered 'active'
*/
static bool MovedMinimum(const TArray<FVector>& CurrentRange, ESGDeviceType DeviceType);
/**
* Returns true if the current sensor values have moved roughly as much as last time.
*/
static bool MatchesLast(const TArray<FVector>& CurrentRange, const TArray<FVector>& LastRange,
ESGDeviceType DeviceType);
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
/**
* The last calibration range can be null, at which point you definitely need calibration.
*/
USGHapticGloveCalibrationCheck();
/**
* The last calibration range can be null, at which point you definitely need calibration.
*/
explicit USGHapticGloveCalibrationCheck(const USGSensorRange* LastCalibrationRange);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGHapticGloveCalibrationCheck(const FSGHapticGloveCalibrationCheckImpl& HapticGloveCalibrationCheckImpl);
public:
/**
* The destructor.
*/
virtual ~USGHapticGloveCalibrationCheck() override;
protected:
/**
* Allows to set the underlying object after construction.
*/
void SetHapticGloveCalibrationCheckImpl(const FSGHapticGloveCalibrationCheckImpl& HapticGloveCalibrationCheckImpl);
public:
/**
* The cast to underlying type method.
*/
const FSGHapticGloveCalibrationCheckImpl& ToHapticGloveCalibrationCheckImpl() const;
public:
/**
*
*/
ESGCalibrationStage GetCalibrationStage() const;
/**
* Whether this algorithm has determined if calibration is required, or not.
*/
bool ReachedConclusion() const;
public:
/**
* Reset the calibration check. so it may be used again. This does not reset the last range.
*/
void Reset();
/**
* Using the currently received Sensor Values, check if calibration is required. This function will have to be called until a conclusion can be reached.
*/
void CheckRange(const TArray<FVector>& CurrentValues, float DeltaSeconds, ESGDeviceType DeviceType);
};
@@ -1,276 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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 "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGHapticGloveCalibrationSequence.generated.h"
class FSGHapticGloveCalibrationSequenceImpl;
class FSGHapticGloveQuickCalibrationImpl;
class USGCalibrationDataPoint;
class USGHandPose;
class USGHandProfile;
class USGHapticGlove;
class USGSensorRange;
/**
* A sequence which collects data points until specific criteria have been met. It must be 'fed' an Update command from your program in order to work.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGHapticGloveCalibrationSequence : public UObject
{
GENERATED_BODY()
public:
static USGHapticGloveCalibrationSequence* NewHapticGloveCalibrationSequence(
UObject* Outer, const FSGHapticGloveCalibrationSequenceImpl& HapticGloveCalibrationSequence);
static USGHapticGloveCalibrationSequence* NewHapticGloveCalibrationSequence(
UObject* Outer, TSharedRef<FSGHapticGloveCalibrationSequenceImpl> HapticGloveCalibrationSequence);
protected:
/**
*
*/
static USGHapticGloveCalibrationSequence* NewHapticGloveCalibrationSequence(UObject* Outer);
public:
/**
* Create a new instance of a base HapitcGlove Calibration Sequence.
*/
static USGHapticGloveCalibrationSequence* NewHapticGloveCalibrationSequence(
UObject* Outer, const USGHapticGlove* LinkedGlove);
public:
/**
* The maximum buffer size for calibration points. Once calibrationPoints exceeds this value, the
*/
static int32 GetMaxDataPoints();
public:
/**
* Converts a calibration range taken from a Calibration sequence, and converts it into a profile. Use this if you're not actually using the sequence.
*/
static bool CompileProfile(UObject* Outer,
const USGSensorRange* SensorRange, ESGDeviceType ForDevice, bool bRightHanded,
USGHandProfile*& OutProfile);
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
protected:
/**
*
*/
USGHapticGloveCalibrationSequence();
public:
/**
* Create a new instance of a base HapitcGlove Calibration Sequence.
*/
explicit USGHapticGloveCalibrationSequence(const USGHapticGlove* LinkedGlove);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGHapticGloveCalibrationSequence(
const FSGHapticGloveCalibrationSequenceImpl& HapticGloveCalibrationSequenceImpl);
/**
* The cast from underlying child type constructor.
*/
explicit USGHapticGloveCalibrationSequence(
const FSGHapticGloveQuickCalibrationImpl& HapticGloveQuickCalibrationImpl);
protected:
/**
* The cast from underlying pointer type constructor.
*/
explicit USGHapticGloveCalibrationSequence(
TSharedRef<FSGHapticGloveCalibrationSequenceImpl> HapticGloveCalibrationSequenceImpl);
/**
* The cast from underlying child pointer type constructor.
*/
explicit USGHapticGloveCalibrationSequence(
TSharedRef<FSGHapticGloveQuickCalibrationImpl> HapticGloveQuickCalibrationImpl);
public:
/**
* The destructor.
*/
virtual ~USGHapticGloveCalibrationSequence() override;
protected:
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetHapticGloveCalibrationSequenceImpl(
const FSGHapticGloveCalibrationSequenceImpl& HapticGloveCalibrationSequenceImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetHapticGloveCalibrationSequenceImpl(
const FSGHapticGloveQuickCalibrationImpl& HapticGloveQuickCalibrationImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetHapticGloveCalibrationSequenceImpl(
TSharedRef<FSGHapticGloveCalibrationSequenceImpl> HapticGloveCalibrationSequenceImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetHapticGloveCalibrationSequenceImpl(
TSharedRef<FSGHapticGloveQuickCalibrationImpl> HapticGloveQuickCalibrationImpl);
public:
/**
* The cast to underlying type method.
*/
TSharedRef<FSGHapticGloveCalibrationSequenceImpl> ToHapticGloveCalibrationSequenceImpl() const;
public:
/**
* Glove linked to this calibration sequence. Will attempt to grab data from this glove evey time Update() is called.
*/
USGHapticGlove* GetLinkedGlove(UObject* Outer) const;
/**
*
*/
void SetLinkedGlove(const USGHapticGlove* LinkedGlove);
/**
* Calibration points collected during this calibration process. One is added every time the "Update()" function is called.
* Used to create a profile after the calibration finishes.
*/
TArray<USGCalibrationDataPoint*> GetCalibrationPoints(UObject* Outer) const;
/**
* How much time has elapsed during this calibration sequence. Useful for logging or for automated functions.
*/
float GetElapsedTime() const;
/**
* Used to determine if the user has manually ended the sequence, to prevent us from adding any more calibration points.
*/
bool IsManuallyCompleted() const;
/**
* If a sequence consists of multiple stages, this integer will show you which one is currently active.
*/
int32 GetCurrentStage() const;
/**
* Returns the amount of calibration points collected so far.
*/
SIZE_T GetCalibrationPointsCount() const;
/**
* Whether or not this sequence was completed as per its own rules.
*/
bool AutoCompleted() const;
/**
* Returns true if this sequence is marked as 'complete' and can begin compiling a profile.
*/
bool Completed() const;
public:
/**
* Resets this calibration sequence's data, but not it's LinkedGlove.
*/
void Reset();
/**
*
*/
void AddDataPoint(const TArray<FVector>& CalibrationPoints);
/**
* Update this calibration sequence with new data. We use deltaSeconds to check for things like stability.
*/
void Update(float DeltaSeconds);
/**
* Manual confirmation of whatever step we're supposed to making at the moment.
*/
void ConfirmCurrentStep();
public:
/**
* Compile a min/max range from the data points collected by this sequence. Returns true if it's actually possible.
*/
bool CompileRange(UObject* Outer, USGSensorRange*& OutSensorRange) const;
/**
* Compile a profile from the data points collected by this sequence. Returns true if it's actually possible.
*/
bool CompileProfile(UObject* Outer, ESGDeviceType ForDevice, bool bRightHanded, USGHandProfile*& OutProfile) const;
/**
* Returns the current HandPose; either the one we should be making, or what it would look like at the moment.
*/
bool GetHandPose(UObject* Outer, USGHandPose*& OutCurrentHandPose) const;
/**
* Returns the current HandPose; either the one we should be making, or what it would look like at the moment.
*/
bool GetHandPose(UObject* Outer, bool bRightHanded, USGHandPose*& OutCurrentHandPose) const;
/**
* Retrieve instructions on what to do during the current step.
*/
FString GetCurrentInstruction(const FString& NextStepKey = FString{""}) const;
};
@@ -1,221 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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 "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGCore/SGTimedThumpCommand.h"
#include "SGHapticGloveCommandBuffer.generated.h"
class FSGHapticGloveCommandBufferImpl;
class USGBuzzCommand;
class USGForceFeedbackCommand;
class USGTimedBuzzCommand;
/**
*
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGHapticGloveCommandBuffer final : public UObject
{
GENERATED_BODY()
public:
static USGHapticGloveCommandBuffer* NewHapticGloveCommandBuffer(
UObject* Outer, const FSGHapticGloveCommandBufferImpl& HapticGloveCommandBufferImpl);
public:
/**
* Create a new HapticsStream for a Haptic Glove.
*/
static USGHapticGloveCommandBuffer* NewHapticGloveCommandBuffer(UObject* Outer);
public:
/**
* The base maximum amount of Force-Feedback Commands that can be in a queue.
*/
static int32 GetMaxForceFeedbackCommands();
/**
* The base maximum amount of Vibrotactile Commands that can be in a queue.
*/
static int32 GetMaxBuzzCommands();
/**
* The base maximum amount of Thumper Commands that can be in a queue.
*/
static int32 GetMaxThumpCommands();
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
/**
*
*/
USGHapticGloveCommandBuffer();
public:
/**
* The cast from underlying type constructor.
*/
explicit USGHapticGloveCommandBuffer(const FSGHapticGloveCommandBufferImpl& HapticGloveCommandBufferImpl);
public:
/**
* The destructor.
*/
virtual ~USGHapticGloveCommandBuffer() override;
protected:
/**
* Allows to set the underlying object after construction.
*/
void SetHapticGloveCommandBufferImpl(const FSGHapticGloveCommandBufferImpl& HapticGloveCommandBufferImpl);
public:
/**
* The cast to underlying type method.
*/
const FSGHapticGloveCommandBufferImpl& ToHapticGloveCommandBufferImpl() const;
public:
/**
* All Force Feedback Commands that have been received this 'frame'. Will be flattened into a single command during FlushHapitcs.
*/
TArray<USGForceFeedbackCommand*> GetForceFeedbackCommandsQueue(UObject* Outer) const;
/**
* All Timed Buzz Commands that have been received this 'frame'. Will be flattened into a single command during FlushHapitcs.
*/
TArray<USGTimedBuzzCommand*> GetBuzzCommandsQueue(UObject* Outer) const;
/**
* All Timed Thump Commands that have been received this 'frame'. Will be flattened into a single command during FlushHapitcs.
*/
TArray<USGTimedThumpCommand*> GetThumperCommandsQueue(UObject* Outer) const;
public:
/**
* Clears only the Force-Feedback Queue.
*/
void ClearForceFeedbackCommandsQueue();
/**
* Clears all vibrations in the queue(s).
*/
void ClearVibrations();
/**
* Clear all ongoing effects to this stream.
*/
void Clear();
/**
* Add a new Force-Feedback command to the queue. Does not actually send it.
*/
void AddCommand(const USGForceFeedbackCommand* ForceFeedbackCommand);
/**
* Add a new vibrotactile command to the queue. Does not actually send it.
*/
void AddCommand(const USGTimedBuzzCommand* BuzzCommand);
/**
* Add a new Thumper command to the queue. Does not actually send it. Does not work with SenseGlove, only for Nova's
*/
void AddCommand(const USGTimedThumpCommand* ThumpCommand);
/**
* Update the active commands, using a deltaSeconds since last update, in seconds. Any timedCommands that are elapsed will be removed from the list.
*/
void UpdateTimedCommands(float DeltaSeconds);
public:
/**
* Compiles all ForceFeedback Levels in the queue into a single one. Does not clear the queue. Returns lastForceFeedbackCommand if no ForceFeedback commands are given.
*/
USGForceFeedbackCommand* GetTotalForceFeedbackLevels(
UObject* Outer, const USGForceFeedbackCommand* LastForceFeedbackCommand) const;
/**
* Compiles all ForceFeedback Levels in the queue into a single one. Does not clear the queue.
*/
USGForceFeedbackCommand* GetTotalForceFeedbackLevels(UObject* Outer) const;
/**
* Compiles all active vibrotactile in the queue into a single list of levels. Does not clear the queue.
*/
USGBuzzCommand* GetTotalBuzzLevels(UObject* Outer) const;
/**
* Compiles all active vibrotactile in the queue into a single list of levels. Does not clear the queue.
*/
USGThumperCommand* GetTotalThumperLevels(UObject* Outer) const;
public:
/**
* Compile all commands in the queue(s) into a single set of commands that can be sent to the glove. Only clears the ForceFeedback queue, and only if you want it to.
*/
void FlushHaptics(UObject* Outer,
const USGForceFeedbackCommand* LastBrakeLevel,
USGForceFeedbackCommand*& OutForceFeedbackCommand,
USGBuzzCommand*& OutBuzzCommand,
USGThumperCommand*& OutThumperCommand,
bool bClearForceFeedbackQueue = true);
/**
* Compile all commands in the queue(s) into a single set of commands that can be sent to the glove. Also updates & clears all queues.
*/
void FlushHaptics(UObject* Outer,
float DeltaSeconds,
const USGForceFeedbackCommand* LastBrakeLevel,
USGForceFeedbackCommand*& OutForceFeedbackCommand, USGBuzzCommand*& OutBuzzCommand,
USGThumperCommand*& OutThumperCommand);
};
@@ -1,125 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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
*
* An interface to get calibration to / from disk.
*/
#pragma once
#include "Containers/UnrealString.h"
#include "SGHapticGloveHandProfiles.generated.h"
class USGHandProfile;
class USGHapticGlove;
class USGSensorRange;
/**
* A glove developed by SenseGlove, that has hand tracking and/or haptic feedback functionality.
*/
USTRUCT()
struct SENSEGLOVECORE_API FSGHapticGloveHandProfiles
{
GENERATED_BODY()
public:
/**
* Returns the directory where our HandProfiles are stored.
*/
static FString GetProfileDirectory();
/**
* Set the directory where our HandProfiles are stored.
*/
static void SetProfileDirectory(const FString& Directory);
/**
* Access the latest Left Hand Profile from disk.
*/
static void GetLeftHandProfile(UObject* Outer, USGHandProfile*& OutHandProfile);
/**
* Sets the newest Left Hand Profile - also stores it on disk.
*/
static void SetLeftHandProfile(const USGHandProfile* HandProfile);
/**
* Access the latest Right Hand Profile from disk.
*/
static void GetRightHandProfile(UObject* Outer, USGHandProfile*& OutHandProfile);
/**
* Sets the newest Right Hand Profile - also stores it on disk.
*/
static void SetRightHandProfile(const USGHandProfile* HandProfile);
/**
* Retrieve a left- or right handed profile.
*/
static void GetProfile(UObject* Outer, bool bRightHanded, USGHandProfile*& OutHandProfile);
/**
* Store a profile in the global variables and on disk. The profile determines if this is a left or right hand.
*/
static void SetProfile(const USGHandProfile* HandProfile);
/**
* Store a profile in the global variables and on disk. You determine if this is a left or right hand.
*/
static void SetProfile(const USGHandProfile* HandProfile, bool bRightHanded);
/**
* Restore both profiles back to their default values.
*/
static void RestoreDefaults();
/**
* Restore the left- or right hand profiles back to their default values.
*/
static void RestoreDefaults(bool bRightHanded);
/**
* Load the latest profiles from disk. Automatically called when you first try to access a profile.
* Exposed so you can force-reload profiles.
*/
static void TryLoadingFromDisk();
/**
* Stores the last sensor range of a glove.
*/
static bool SaveLastRange(const USGSensorRange* CurrentRange, const USGHapticGlove* ForGlove);
/**
* Loads the last sensor range of a glove.
*/
static bool LoadLastRange(UObject* Outer, const USGHapticGlove* ForGlove, USGSensorRange*& OutLastRange);
};
@@ -1,186 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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 "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "SGCore/SGHapticGloveCalibrationSequence.h"
#include "SGHapticGloveQuickCalibration.generated.h"
class FSGHapticGloveQuickCalibrationImpl;
/**
*
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGHapticGloveQuickCalibration final : public USGHapticGloveCalibrationSequence
{
GENERATED_BODY()
public:
static USGHapticGloveQuickCalibration* NewHapticGloveQuickCalibration(
UObject* Outer, const FSGHapticGloveQuickCalibrationImpl& HapticGloveQuickCalibration);
static USGHapticGloveQuickCalibration* NewHapticGloveQuickCalibration(
UObject* Outer, TSharedRef<FSGHapticGloveQuickCalibrationImpl> HapticGloveQuickCalibration);
public:
/**
*
*/
static USGHapticGloveQuickCalibration* NewHapticGloveQuickCalibration(UObject* Outer);
/**
* Create a new instance of a QuickCalibration for Haptic Gloves.
*/
static USGHapticGloveQuickCalibration* NewHapticGloveQuickCalibration(
UObject* Outer,
const USGHapticGlove* GloveToCalibrate,
float AutoEndTimeout = GetDefaultAutoEndTimeout());
public:
/**
* Default time in seconds, to end this sequence. 15 seconds is very quick for some people.
*/
static float GetDefaultAutoEndTimeout();
public:
/**
*
*/
USGHapticGloveQuickCalibration();
/**
* Create a new instance of a QuickCalibration for Haptic Gloves.
*/
explicit USGHapticGloveQuickCalibration(const USGHapticGlove* GloveToCalibrate,
float AutoEndTimeout = GetDefaultAutoEndTimeout());
public:
/**
* The cast from underlying type constructor.
*/
explicit USGHapticGloveQuickCalibration(const FSGHapticGloveQuickCalibrationImpl& HapticGloveQuickCalibrationImpl);
protected:
/**
* The cast from underlying pointer type constructor.
*/
explicit USGHapticGloveQuickCalibration(
TSharedRef<FSGHapticGloveQuickCalibrationImpl> HapticGloveQuickCalibrationImpl);
public:
/**
* The destructor.
*/
virtual ~USGHapticGloveQuickCalibration() override;
public:
/**
* The cast to underlying type method.
*/
TSharedRef<FSGHapticGloveQuickCalibrationImpl> ToHapticGloveQuickCalibrationImpl() const;
public:
/**
* Time, in seconds, after which this sequence stops gathering data. Based on the deltaSeconds variable passed in the Update() function.
*/
float GetAutoEndTimeout() const;
/**
* When compiling the final profile, we use a Weighted Moving Average filter with this period to filer out some outliers.
*/
int32 GetSmoothingSamples() const;
/**
* The min/max values recorded during this calibration sequence.
*/
USGSensorRange* GetSensorRange(UObject* Outer) const;
/**
* A temporary profile to apply the sensorRange to. Used to generate a 'preview' HandPose.
*/
USGHandProfile* GetTemporaryProfile(UObject* Outer) const;
/**
* Determines if the user has moved enough so that we can animate.
*/
bool CanAnimate() const;
public:
/**
* This sequence autocompletes after its autoEndTime has elapsed.
*/
bool AutoCompleted() const;
public:
/**
* Resets data points, min/max ranges and profile.
*/
void Reset();
/**
* Update this calibration sequence with new data. We use deltaSeconds to check for things like stability.
*/
void Update(float DeltaSeconds);
/**
* Add a new datapoint to this sequence's collection. Updates the range and profile used to generate a preview.
*/
void AddDataPoint(const TArray<FVector>& CalibrationData);
/**
* After we confirm the current step, we're basically done.
*/
void ConfirmCurrentStep();
/**
* Compile a sensor range from the data points collected while the sequence was running. Smoothed by a Moving Average Filter.
*/
bool CompileRange(UObject* Outer, USGSensorRange*& OutSensorRange) const;
/**
* Returns a 'preview' of what a HandPose with this sequence's current settings would look like.
*/
bool GetHandPose(UObject* Outer, bool bRightHanded, USGHandPose*& OutCurrentHandPose) const;
/**
* Retrieve instructions on what to do during the current step.
*/
FString GetCurrentInstruction(const FString& NextStepKey = FString{""}) const;
};
@@ -38,6 +38,7 @@
#include "Containers/Array.h"
#include "Math/Quat.h"
#include "Math/Vector.h"
#include "UObject/ObjectMacros.h"
#include "SGTypes/SGCoreTypes.h"
@@ -0,0 +1,573 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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
*
* Interface for Nova 2.0 Gloves. A soft glove with detachable force-feedback
* and sensor module, and active contact feedback in the front strap.
* Since the Nova 2.0 is significantly different from the Nova 1 Glove, it gets
* its own separate device interface.
*/
#pragma once
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "HAL/Platform.h"
#include "Math/Quat.h"
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGCore/SGHapticGlove.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGNova2Glove.generated.h"
class FSGNova2GloveImpl;
class USGHandInterpolator;
class USGNovaGloveInfo;
class USGNova2GloveSensorData;
class USGSensorNormalization;
class USGThresholdCommand;
/**
* Interface for Nova 2.0 Gloves. A soft glove with detachable force-feedback and sensor module, and active contact
* feedback in the front strap.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGNova2Glove final : public USGHapticGlove
{
GENERATED_BODY()
public:
static USGNova2Glove* NewNova2Glove(UObject* Outer, const FSGNova2GloveImpl& Nova2GloveImpl);
static USGNova2Glove* NewNova2Glove(UObject* Outer, TSharedRef<FSGNova2GloveImpl> Nova2GloveImpl);
public:
/**
* Default constructor for Nova2Glove.
*/
static USGNova2Glove* NewNova2Glove(UObject* Outer);
/**
* Creates a new instance of a Nova Glove.
*/
static USGNova2Glove* NewNova2Glove(UObject* Outer, const USGNovaGloveInfo& DeviceInfo);
public:
/**
* Deserializes a Nova 2.0 from its ConstantsString. Returns a nullptr if unsuccessful.
*
* @param ConstantsString
*/
static USGDevice* Parse(UObject* Outer, const FString& ConstantsString);
/**
* Retrieve all Nova 2.0's.
*/
static TArray<USGNova2Glove*> GetNova2Gloves(UObject* Outer);
/**
* Retrieve the first connected Nova 2.0 there is.
*/
static bool GetNova2Glove(UObject* Outer, USGNova2Glove*& OutGlove);
/**
* Retrieve the first (connected) right or left handed Nova 2.0.
*/
static bool GetNova2Glove(UObject* Outer, bool bRightHanded, USGNova2Glove*& OutGlove);
public:
/**
* Retrieve the location of the glove origin, based on a reference location without requiring an object reference.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param bRightHanded Whether this is a left or right-handed glove.
* @param HardwareVersion
* @param OutGlovePosition The 3D Position of the glove, in mm, relative to your origin.
* @param OutGloveRotation The 3D Rotation of the glove, relative to your origin.
*/
static void CalculateGloveLocation(
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, const FString& HardwareVersion,
FVector& OutGlovePosition, FQuat& OutGloveRotation);
/**
* Retrieve the location of the glove origin, based on a reference location without requiring an object reference.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param bRightHanded Whether this is a left or right-handed glove.
* @param HardwareVersion
* @param OutGlovePosition The 3D Position of the glove, in mm, relative to your origin.
* @param OutGloveRotation The 3D Rotation of the glove, relative to your origin.
*/
static void CalculateGloveLocation(
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, const FString& HardwareVersion,
FVector& OutGlovePosition, FRotator& OutGloveRotation);
/**
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets, without
* needing an object reference.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param bRightHanded Whether this is right or left hand.
* @param HardwareVersion
* @param OutWristPosition The 3D Position of the wrist, in mm, relative to your origin.
* @param OutWristRotation The 3D Rotation of the wrist, relative to your origin.
*
* @remarks The simplest interface, using default offsets.
*/
static void CalculateWristLocation(
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, const FString& HardwareVersion,
FVector& OutWristPosition, FQuat& OutWristRotation);
/**
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets, without
* needing an object reference.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param bRightHanded Whether this is right or left hand.
* @param HardwareVersion
* @param OutWristPosition The 3D Position of the wrist, in mm, relative to your origin.
* @param OutWristRotation The 3D Rotation of the wrist, relative to your origin.
*
* @remarks The simplest interface, using default offsets.
*/
static void CalculateWristLocation(
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, const FString& HardwareVersion,
FVector& OutWristPosition, FRotator& OutWristRotation);
public:
/**
* Special Byte to identify the command as a Streaming Byte.
*/
static ANSICHAR GetStreamByte();
/**
* Ranges before a Nova 2.0 Sensor is allowed to move.
*/
static TArray<float> GetNova2SensorRanges();
public:
/**
* Converts Nova 2.0 Sensor Data into floating point inputs for normalization.
*
* @param SensorData
*/
static TArray<float> ToNormalizedValues(const USGNova2GloveSensorData* SensorData);
/**
* Convert Sensor Data into a series of normalized values.
*
* @param Outer
* @param SensorData
* @param OutSensorNormalizer
*/
static TArray<float> ToNormalizedValues(
UObject* Outer,
const USGNova2GloveSensorData* SensorData, USGSensorNormalization*& OutSensorNormalizer);
public:
/**
* Calculate Hand Angles for a Nova 2.0 Glove, based on normalized input.
*
* @param NormalizedValues
* @param Interpolator
*/
static TArray<TArray<FVector>> CalculateHandAngles(
const TArray<float>& NormalizedValues, const USGHandInterpolator* Interpolator, bool bInfluenceIndex);
/**
* Convert normalized inputs (5-6 sensors) to input for an Interpolator.
*
* @param NormalizedData
* @param GloveInfo
*/
static TArray<TArray<FVector>> ToNormalizedAngles(
const TArray<float>& NormalizedData, const USGNovaGloveInfo* GloveInfo);
protected:
USGNova2Glove();
explicit USGNova2Glove(const USGNovaGloveInfo& DeviceInfo);
public:
/**
* The cast from underlying parent type constructor.
*/
explicit USGNova2Glove(const FSGDeviceImpl& SGDeviceImpl);
/**
* The cast from underlying parent type constructor.
*/
explicit USGNova2Glove(const FSGHapticGloveImpl& HapticGloveImpl);
/**
* The cast from underlying type constructor.
*/
explicit USGNova2Glove(const FSGNova2GloveImpl& Nova2GloveImpl);
protected:
/**
* The cast from underlying parent pointer type constructor.
*/
explicit USGNova2Glove(TSharedRef<FSGDeviceImpl> SGDeviceImpl);
/**
* The cast from underlying parent pointer type constructor.
*/
explicit USGNova2Glove(TSharedRef<FSGHapticGloveImpl> HapticGloveImpl);
/**
* The cast from underlying pointer type constructor.
*/
explicit USGNova2Glove(TSharedRef<FSGNova2GloveImpl> Nova2GloveImpl);
public:
/**
* The destructor.
*/
virtual ~USGNova2Glove() override;
public:
/**
* The cast to underlying type method.
*/
TSharedRef<FSGNova2GloveImpl> ToNova2GloveImpl() const;
public:
/**
* Return the DeviceType of this Nova.
*/
virtual ESGDeviceType GetDeviceType() const override;
/**
* Returns this device's unique identifier.
*/
virtual FString GetDeviceId() const override;
/**
* Access this device's hardware designation.
*/
virtual FString GetHardwareVersion() const override;
/**
* Access this device's main firmware version. (ex: v3.2 -> 3).
*/
virtual int32 GetFirmwareVersion() const override;
/**
* Access this device's sub-firmware version. (ex: v3.2 -> 2).
*/
virtual int32 GetSubFirmwareVersion() const override;
public:
/**
* Returns true if this device operates on a battery.
*/
virtual bool HasBattery() const override;
/**
* Returns true if this device is currently charging.
*/
virtual bool IsCharging() override;
/**
* Returns the device's battery level, as a value between 0 (empty) and 1 (full).
*/
virtual bool GetBatteryLevel(float& OutBatteryLevel) override;
public:
/**
* Returns true if this glove is meant for right hands.
*/
virtual bool IsRight() const override;
/**
* Retrieve this glove's latest IMU rotation, if one is present.
*
* @param OutImu
*/
virtual bool GetImuRotation(FQuat& OutImu) override;
/**
* Retrieve this glove's latest IMU rotation, if one is present.
*
* @param OutImu
*/
virtual bool GetImuRotation(FRotator& OutImu) override;
/*
* Calculate a HandPose from this glove's latest Sensor Data.
*/
virtual bool GetHandPose(UObject* Outer, const USGBasicHandModel* HandGeometry,
USGHandPose*& OutHandPose) const override;
/**
* Returns the Hand Angles calculated by this Nova 2 Glove. Used for input for HandPoses, but can be used in and
* of itself.
*
* @param OutHandAngles
*/
virtual bool GetHandAngles(TArray<TArray<FVector>>& OutHandAngles) const override;
public:
/*
* Retrieve the calibration status of this Nova 2.0 Glove.
*/
virtual ESGHapticGloveCalibrationState GetCalibrationState() const override;
/*
* Completes sensor Normalization on the Nova 2.0's end.
*/
virtual void EndCalibration() override;
/*
* Completes sensor Normalization on the Nova 2.0's end.
*/
virtual void ResetCalibration() override;
public:
/*
* Stop all haptic feedback effects playing on this device.
*/
virtual void StopHaptics() override;
/**
* Stop only all vibrotactile feedback.
*/
virtual void StopVibrations() override;
/**
* Flush all streaming haptic effects on the different fingers to the Nova 2.0 Glove.
*/
virtual bool SendHaptics() override;
public:
/**
* Returns true if this Glove supports the chosen haptic location.
*
* @param AtLocation
*/
virtual bool SupportsCustomWaveform(ESGHapticLocation AtLocation) const override;
/**
* Send a custom waveform to the Nova 2.0.
*
* @param OutWaveform
* @param Location
*/
virtual bool SendCustomWaveform(USGCustomWaveform* OutWaveform, ESGHapticLocation Location) override;
public:
/**
* Queue a list of force-feedback levels, between 0.0 and 1.0. Your list should be sorted from thumb to pinky.
*
* @param Levels01 Array containing the Force-Feedback levels, from 0.0 (no FFB) to 1.0. A value < 0.0f will be
* ignored.
*
* @remarks Devices that 'only' have on/off FFB will treat any value > 0.0 as 1.0.
*/
virtual bool QueueForceFeedbackLevels(const TArray<float>& Levels01) override;
/**
* Set the Force-Feedback value of a particular finger to a specific level.
*
* @param Finger The finger to which to send the command.
* @param Level01 Value will be clamped between [0...1], where 0.0 means no Force-Feedback, and 1.0 means full
* force-feedback.
*/
virtual bool QueueForceFeedbackLevel(int32 Finger, float Level01) override;
/**
* Set the amount of squeeze-feedback to the desired level (0 = no squeeze, 1 = full squeeze).
*
* @param SqueezeLevel01
*/
virtual bool QueueSqueezeLevel(float SqueezeLevel01);
public:
/**
* Retrieve the location of the glove origin, based on a reference location.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the Nova2.
* @param OutGlovePosition The 3D Position of the glove, in mm, relative to your origin.
* @param OutGloveRotation The 3D Rotation of the glove, relative to your origin.
*/
virtual void GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutGlovePosition, FQuat& OutGloveRotation) const override;
/**
* Retrieve the location of the glove origin, based on a reference location.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the Nova2.
* @param OutGlovePosition The 3D Position of the glove, in mm, relative to your origin.
* @param OutGloveRotation The 3D Rotation of the glove, relative to your origin.
*/
virtual void GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutGlovePosition, FRotator& OutGloveRotation) const override;
/**
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param OutWristPosition The 3D Position of the wrist, in mm, relative to your origin.
* @param OutWristRotation The 3D Rotation of the wrist, relative to your origin.
*
* @remarks The simplest interface, using default offsets.
*/
virtual void GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FQuat& OutWristRotation) const override;
/**
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param OutWristPosition The 3D Position of the wrist, in mm, relative to your origin.
* @param OutWristRotation The 3D Rotation of the wrist, relative to your origin.
*
* @remarks The simplest interface, using default offsets.
*/
virtual void GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FRotator& OutWristRotation) const override;
public:
/**
* Access DeviceInfo of this Nova.
*/
USGNovaGloveInfo* GetGloveInfo(UObject* Outer) const;
/**
* If true, the Index Finger sensors will influence the tracking of the other fingers.
*/
bool DoesIndexInfluenceOthers() const;
/**
*
*
* @param bInfluenceOthers
*/
void SetIndexInfluencesOthers(bool bInfluenceOthers);
/**
* If true, the sensors of this Nova Glove are normalized on-board the device. Otherwise, sensor normalization runs
* inside the library.
*/
bool SupportsOnBoardNormalization() const;
public:
/**
* Get the latest Sensor Data from this Glove.
*/
bool GetSensorData(UObject* Outer, USGNova2GloveSensorData*& OutSensorData);
/**
* Returns the normalized Sensor Data of this Nova2 Glove. If no normalization is running on the glove(s), then
* it's done on the PC side.
*
* @param OutNormalizedValues
*/
bool GetNormalizedInput(TArray<float>& OutNormalizedValues) const;
/**
* Tell the Nova Glove to send Raw Data instead of normalized data.
*/
virtual bool SendRawData();
/**
* Tell the Nova Glove to send normalized data.
*/
virtual bool SendNormalizedData();
public:
/**
* Convert a HapticLocation into a Nova 2.0 Motor location.
*
* @param Location
*/
virtual ESGNova2VibroMotor ToNovaMotor(ESGHapticLocation Location) const;
/**
* Returns the channel index for a particular motor. Can make this as complex as I want for the Nova2 GLove(s).
*
* @param Motor
*/
virtual int32 ChannelIndex(ESGNova2VibroMotor Motor) const;
/**
* Ensures the waveform that is to be sent to this Nova 2.0 Glove has the appropriate parameters.
*
* @param OutWaveform
* @param Motor
*/
virtual void ValidateWaveform(USGCustomWaveform* OutWaveform, ESGNova2VibroMotor Motor) const;
/**
* Directly sends a custom waveform to the Nova2 Glove motors, as opposed to specifying a Haptic Location.
*
* @param OutWaveform
* @param Motor
* @param bValidateWaveform
*/
virtual bool SendCustomWaveform_Nova2(
USGCustomWaveform* OutWaveform, ESGNova2VibroMotor Motor, bool bValidateWaveform = true);
public:
/**
* Get a string representation of this Nova 2.0 Glove.
*/
virtual FString ToString() const override;
};
@@ -0,0 +1,280 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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
*
* Sensor Data coming off the Nova 2.0 Glove.
* Has certain features the Nova 1.0 Glove does not have, such as multiple
* flexion sensors, normalization states and Active Strap info.
*/
#pragma once
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "Math/Quat.h"
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGTypes/SGVectorArray.h"
#include "SGNova2GloveSensorData.generated.h"
class FSGNova2GloveSensorDataImpl;
class USGNovaGloveInfo;
/**
* Nova Glove 2.0 Sensor data, which had additional feedback and calibration parameters.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGNova2GloveSensorData final : public UObject
{
GENERATED_BODY()
public:
static USGNova2GloveSensorData* NewNova2GloveSensorData(
UObject* Outer, const FSGNova2GloveSensorDataImpl& Nova2GloveSensorDataImpl);
public:
/**
* Default constructor for Nova2GloveSensorData.
*/
static USGNova2GloveSensorData* NewNova2GloveSensorData(UObject* Outer);
/**
* Create a new instance of a Nova2GloveSensorData.
*/
static USGNova2GloveSensorData* NewNova2GloveSensorData(
UObject* Outer, ESGNormalizationState NormalizationState,
const TArray<TArray<FVector>>& Values, int32 ParsedValues,
const FQuat& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging);
/**
* Create a new instance of a Nova2GloveSensorData.
*/
static USGNova2GloveSensorData* NewNova2GloveSensorData(
UObject* Outer, ESGNormalizationState NormalizationState,
const TArray<FSGVectorArray>& Values, int32 ParsedValues,
const FQuat& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging);
/**
* Create a new instance of a Nova2GloveSensorData.
*/
static USGNova2GloveSensorData* NewNova2GloveSensorData(
UObject* Outer, ESGNormalizationState NormalizationState,
const TArray<TArray<FVector>>& Values, int32 ParsedValues,
const FRotator& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging);
/**
* Create a new instance of a Nova2GloveSensorData.
*/
static USGNova2GloveSensorData* NewNova2GloveSensorData(
UObject* Outer, ESGNormalizationState NormalizationState,
const TArray<FSGVectorArray>& Values, int32 ParsedValues,
const FRotator& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging);
public:
/**
* Parse the bytes as they come in from the device into usable values.
*
* @param RawData
* @param GloveInfo
*/
static USGNova2GloveSensorData* Parse(UObject* Outer, const FString& RawData, const USGNovaGloveInfo* GloveInfo);
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
/**
* Default constructor for Nova2GloveSensorData.
*/
USGNova2GloveSensorData();
/**
* Create a new instance of a Nova2GloveSensorData.
*
* @param NormalizationState
* @param Values
* @param ParsedValues
* @param ImuRotation
* @param bImuParsed
* @param BatteryLevel
* @param bCharging
*/
USGNova2GloveSensorData(ESGNormalizationState NormalizationState,
const TArray<TArray<FVector>>& Values, int32 ParsedValues,
const FQuat& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging);
/**
* Create a new instance of a Nova2GloveSensorData.
*
* @param NormalizationState
* @param Values
* @param ParsedValues
* @param ImuRotation
* @param bImuParsed
* @param BatteryLevel
* @param bCharging
*/
USGNova2GloveSensorData(ESGNormalizationState NormalizationState,
const TArray<FSGVectorArray>& Values, int32 ParsedValues,
const FQuat& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging);
/**
* Create a new instance of a Nova2GloveSensorData.
*
* @param NormalizationState
* @param Values
* @param ParsedValues
* @param ImuRotation
* @param bImuParsed
* @param BatteryLevel
* @param bCharging
*/
USGNova2GloveSensorData(ESGNormalizationState NormalizationState,
const TArray<TArray<FVector>>& Values, int32 ParsedValues,
const FRotator& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging);
/**
* Create a new instance of a Nova2GloveSensorData.
*
* @param NormalizationState
* @param Values
* @param ParsedValues
* @param ImuRotation
* @param bImuParsed
* @param BatteryLevel
* @param bCharging
*/
USGNova2GloveSensorData(ESGNormalizationState NormalizationState,
const TArray<FSGVectorArray>& Values, int32 ParsedValues,
const FRotator& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGNova2GloveSensorData(const FSGNova2GloveSensorDataImpl& Nova2GloveSensorDataImpl);
public:
/**
* The destructor.
*/
virtual ~USGNova2GloveSensorData() override;
protected:
/**
* Allows to set the underlying object after construction.
*/
void SetNova2GloveSensorDataImpl(const FSGNova2GloveSensorDataImpl& Nova2GloveSensorDataImpl);
public:
/**
* The cast to underlying type method.
*/
const FSGNova2GloveSensorDataImpl& ToNova2GloveSensorDataImpl() const;
public:
/**
* Sensor Data State based on the internal data.
*/
ESGNormalizationState GetSensorState() const;
/**
* Pronation/Supination, Flexion/Extension and Abduction/Adduction values for each finger.
*/
TArray<TArray<FVector>> GetSensorValues() const;
/**
* Returns the sensor movement of a specific finger.
*
* @param Finger
* @param Location If a Nova glove has only one flexion sensor, it will return the same value for FlexionProximal
* and FlexionDistal.
*/
float GetSensorValue(ESGFinger Finger, ESGNova2SensorLocation Location) const;
/**
* The number of values that were parsed from the sensor string.
*/
int32 GetParsedValues() const;
public:
/**
* Quaternion rotation relative to magnetic north.
*/
FQuat GetImuRotationQ() const;
/**
* Rotation relative to magnetic north.
*/
FRotator GetImuRotation() const;
/**
* Whether the IMU values were all successfully parsed, or not.
*/
bool IsImuParsed() const;
public:
/**
* A value between 0..1 that represents the battery level of this Nova2 Glove (0 .. 100%). Returns -1 if the value
* wasn't received.
*/
float GetBatteryLevel() const;
/**
* Returns true if this NovaGlove is connected to a power source.
*/
bool IsCharging() const;
public:
/**
* Returns true if this sensor data contains the same values as another.
*/
bool Equals(const USGNova2GloveSensorData* Nova2GloveSensorData) const;
public:
/**
* Create a readable string representation of this Sensor Data.
*/
FString ToString() const;
};
+336 -87
View File
@@ -36,11 +36,14 @@
#pragma once
#include "SGHapticGlove.h"
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "HAL/Platform.h"
#include "Math/Quat.h"
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGCore/SGHapticGlove.h"
#include "SGTypes/SGCoreTypes.h"
@@ -48,11 +51,11 @@
#include "SGNovaGlove.generated.h"
class FSGNovaGloveImpl;
class USGBuzzCommand;
class USGForceFeedbackCommand;
class USGHandInterpolator;
class USGNovaGloveInfo;
class USGNovaGloveSensorData;
class USGThumperCommand;
class USGSensorNormalization;
class USGThresholdCommand;
/**
* A soft glove with Force- and Vibrotactile Feedback and limited tracking.
@@ -69,38 +72,20 @@ public:
public:
/**
*
* Default constructor for NovaGlove.
*/
static USGNovaGlove* NewNovaGlove(UObject* Outer);
/**
*
* Creates a new instance of a Nova Glove.
*/
static USGNovaGlove* NewNovaGlove(UObject* Outer, const USGNovaGloveInfo& DeviceInfo);
public:
/**
* Byte indicating a new Nova haptic command.
*/
static ANSICHAR GetHapticsByte();
/**
* Minimum calibration value distance until we apply the range.
*/
static FVector GetMinCalibrationRange();
public:
/**
* Calculate a Hand Pose based on a HandMode; sensor data from a Nova, and a UserProfile.
*/
static USGHandPose* CalculateHandPose(UObject* Outer,
const USGBasicHandModel* HandModel,
const USGNovaGloveSensorData* NovaData,
const USGNovaGloveHandProfile* Profile);
public:
/**
* Deserializes a Nova from its ConstantsString. Returns a nullptr if unsuccessful.
*
* @param ConstantsString
*/
static USGDevice* Parse(UObject* Outer, const FString& ConstantsString);
@@ -119,22 +104,16 @@ public:
*/
static bool GetNovaGlove(UObject* Outer, bool bRightHanded, USGNovaGlove*& OutGlove);
public:
/**
* Convert a SenseGlove GlovePose into calibrationValues.
*/
static TArray<FVector> GetCalibrationValues(const USGNovaGloveSensorData* SensorData);
/**
*
*/
static void CalibrateInterpolation(UObject* Outer,
const TArray<FVector>& MinValues, const TArray<FVector>& MaxValues,
USGNovaGloveHandProfile*& OutProfile);
public:
/**
* Retrieve the location of the glove origin, based on a reference location without requiring an object reference.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param bRightHanded Whether this is a left or right-handed glove.
* @param OutGlovePosition The 3D Position of the glove, in mm, relative to your origin.
* @param OutGloveRotation The 3D Rotation of the glove, relative to your origin.
*/
static void CalculateGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded,
@@ -142,20 +121,47 @@ public:
/**
* Retrieve the location of the glove origin, based on a reference location without requiring an object reference.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param bRightHanded Whether this is a left or right-handed glove.
* @param OutGlovePosition The 3D Position of the glove, in mm, relative to your origin.
* @param OutGloveRotation The 3D Rotation of the glove, relative to your origin.
*/
static void CalculateGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded,
FVector& OutGlovePosition, FRotator& OutGloveRotation);
/**
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets, without needing an object reference.
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets, without
* needing an object reference.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param bRightHanded Whether this is right or left hand.
* @param OutWristPosition The 3D Position of the wrist, in mm, relative to your origin.
* @param OutWristRotation The 3D Rotation of the wrist, relative to your origin.
*
* @remarks The simplest interface, using default offsets.
*/
static void CalculateWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded,
FVector& OutWristPosition, FQuat& OutWristRotation);
/**
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets, without needing an object reference.
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets, without
* needing an object reference.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param bRightHanded Whether this is right or left hand.
* @param OutWristPosition The 3D Position of the wrist, in mm, relative to your origin.
* @param OutWristRotation The 3D Rotation of the wrist, relative to your origin.
*
* @remarks The simplest interface, using default offsets.
*/
static void CalculateWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded,
@@ -163,19 +169,70 @@ public:
public:
/**
* Converts a thumper command into bytes that the Nova can understand.
* Byte indicating a new Nova haptic command.
*/
static FString ToBytes(const USGThumperCommand* ThumperCommand);
static ANSICHAR GetHapticsByte();
/**
* Converts a force-feedback command into bytes that the Nova can understand.
* Byte indicating a new Nova thresholds command.
*/
static FString ToBytes(const USGForceFeedbackCommand* ForceFeedbackCommand);
static ANSICHAR GetThresholdsByte();
/**
* Converts a buzz-motor command into bytes that the Nova can understand.
* Byte to ignore Thresholds.
*/
static FString ToBytes(const USGBuzzCommand* BuzzCommand);
static ANSICHAR GetIgnoreThresholdsByte();
/**
* Ranges before a Nova 1.0 Sensor is allowed to move.
*/
static TArray<float> GetNovaSensorRanges();
public:
/**
* Converts Nova Sensor Data into floating point inputs for normalization.
*
* @param SensorData
*/
static TArray<float> ToNormalizedValues(const USGNovaGloveSensorData* SensorData);
/**
* Convert Sensor Data into a series of normalized values.
*
* @param Outer
* @param SensorData
* @param OutSensorNormalizer
*/
static TArray<float> ToNormalizedValues(
UObject* Outer,
const USGNovaGloveSensorData* SensorData, USGSensorNormalization*& OutSensorNormalizer);
public:
/**
* Calculate Hand Angles for a Nova Glove, based on normalized input.
*
* @param NormalizedValues
* @param Interpolator
*/
static TArray<TArray<FVector>> CalculateHandAngles(
const TArray<float>& NormalizedValues, const USGHandInterpolator* Interpolator);
public:
/**
* Converts a Threshold command into a Nova Glove command.
*
* @param Thresholds
*/
static FString ToNovaCommandAsFlexion(const USGThresholdCommand* Thresholds);
/**
* Converts a Threshold command into a Nova Glove command.
*
* @param Thresholds
* @param Interpolator
*/
static FString ToNovaCommandAsRaw(
const USGThresholdCommand* Thresholds, const USGSensorNormalization* Interpolator);
protected:
USGNovaGlove();
@@ -252,6 +309,14 @@ public:
*/
virtual int32 GetSubFirmwareVersion() const override;
public:
/**
* Change this device's index within the SenseCom. Warning: Can cause errors.
*
* @param NewIndex
*/
virtual void SetDeviceIndex(int32 NewIndex) override;
public:
/**
* Returns true if this device operates on a battery.
@@ -270,84 +335,120 @@ public:
public:
/**
* Get the latest Sensor Data from this Sense Glove.
* Returns true if this glove is meant for right hands.
*/
bool GetSensorData(UObject* Outer, USGNovaGloveSensorData*& OutSensorData);
virtual bool IsRight() const override;
/**
* Retrieve Nova rotation.
*
* @param OutImu
*/
virtual bool GetImuRotation(FQuat& OutImu) override;
/**
* Retrieve Nova rotation.
*
* @param OutImu
*/
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 USGHapticGlove and USGNovaGlove
using USGHapticGlove::GetHandPose;
/*
* Calculate a HandPose from this glove's latest Sensor Data.
*/
virtual bool GetHandPose(UObject* Outer, const USGBasicHandModel* HandGeometry,
USGHandPose*& OutHandPose) const override;
/**
* Retrieve a new hand pose using this glove, based on (calibrated) user data.
* Returns the Hand Angles calculated by this Nova Glove. Used for input for HandPoses, but can be used in and of
* itself.
*
* @param OutHandAngles
*/
bool GetHandPose(UObject* Outer, const USGBasicHandModel* HandModel, const USGNovaGloveHandProfile* Profile,
USGHandPose*& OutHandPose);
virtual bool GetHandAngles(TArray<TArray<FVector>>& OutHandAngles) const override;
public:
/*
* Retrieve the calibration status of this Nova Glove.
*/
virtual ESGHapticGloveCalibrationState GetCalibrationState() const override;
/*
* Completes sensor Normalization on the Nova's end.
*/
virtual void EndCalibration() override;
/*
* Completes sensor Normalization on the Nova's end.
*/
virtual void ResetCalibration() override;
public:
/*
* Stop all haptic feedback effects playing on this device.
*/
virtual void StopHaptics() override;
/**
* Retrieve a new hand pose using this glove, based on (calibrated) user data.
* Stop only all vibrotactile feedback.
*/
virtual bool GetHandPose(UObject* Outer, const USGBasicHandModel* HandGeometry, const USGHandProfile* HandProfile,
USGHandPose*& OutHandPose) override;
virtual void StopVibrations() override;
/**
* Calculate the HandPose of this Device, taking into account user values, but not hand geometry.
* Take all active commands in the device queue, compile them into one and send them to the device.
*
* @returns Returns true if the message was successfully sent to SenseCom. Returns false if no changes to commands
* were detected.
*
* @remarks Generic function across any Haptic Interface in SGCore.
*/
virtual bool GetHandPose(UObject* Outer, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose) override;
virtual bool SendHaptics() override;
public:
/**
* Send all available haptics to a Nova.
* Returns true if this Glove supports the chosen haptic location.
*
* @param AtLocation
*/
virtual void SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand,
const USGBuzzCommand* BuzzCommand,
const USGThumperCommand* ThumperCommand) override;
virtual bool SupportsCustomWaveform(ESGHapticLocation AtLocation) const override;
/**
* Send Haptic Commands to this Glove.
* Send a custom waveform to the Nova.
*
* @param OutWaveform
* @param Location
*/
virtual void SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand) override;
/**
* Send Haptic Commands to this Glove.
*/
virtual void SendHaptics(const USGBuzzCommand* BuzzCommand) override;
/**
* Send Haptic Commands to this Glove.
*/
virtual void SendHaptics(const USGThumperCommand* ThumperCommand) override;
virtual bool SendCustomWaveform(USGCustomWaveform* OutWaveform, ESGHapticLocation Location) override;
public:
/**
* Retrieve calibration values of this glove, as an array of size 5, containing x (roll), y (flexion), z (abduction) values.
* Queue a list of force-feedback levels, between 0.0 and 1.0. Your list should be sorted from thumb to pinky.
*
* @param Levels01 Array containing the Force-Feedback levels, from 0.0 (no FFB) to 1.0. A value < 0.0f will be
* ignored.
*
* @remarks Devices that 'only' have on/off FFB will treat any value > 0.0 as 1.0.
*/
virtual bool GetCalibrationValues(TArray<FVector>& OutValues) override;
virtual bool QueueForceFeedbackLevels(const TArray<float>& Levels01) override;
/**
* Applies the calibration range of this Nova a HandProfile.
* Set the Force-Feedback value of a particular finger to a specific level.
*
* @param Finger The finger to which to send the command.
* @param Level01 Value will be clamped between [0...1], where 0.0 means no Force-Feedback, and 1.0 means full
* force-feedback.
*/
virtual void ApplyCalibration(UObject* Outer, USGHandProfile*& OutProfile) const override;
/**
* Applies the calibration range of this SenseGlove to a NovaGloveHandProfile.
*/
void ApplyCalibration(UObject* Outer, USGNovaGloveHandProfile*& OutProfile) const;
virtual bool QueueForceFeedbackLevel(int32 Finger, float Level01) override;
public:
/**
* Retrieve the location of the glove origin, based on a reference location.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the Nova.
* @param OutGlovePosition The 3D Position of the glove, in mm, relative to your origin.
* @param OutGloveRotation The 3D Rotation of the glove, relative to your origin.
*/
virtual void GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
@@ -355,6 +456,12 @@ public:
/**
* Retrieve the location of the glove origin, based on a reference location.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the Nova.
* @param OutGlovePosition The 3D Position of the glove, in mm, relative to your origin.
* @param OutGloveRotation The 3D Rotation of the glove, relative to your origin.
*/
virtual void GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
@@ -362,6 +469,14 @@ public:
/**
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param OutWristPosition The 3D Position of the wrist, in mm, relative to your origin.
* @param OutWristRotation The 3D Rotation of the wrist, relative to your origin.
*
* @remarks The simplest interface, using default offsets.
*/
virtual void GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
@@ -369,14 +484,148 @@ public:
/**
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param OutWristPosition The 3D Position of the wrist, in mm, relative to your origin.
* @param OutWristRotation The 3D Rotation of the wrist, relative to your origin.
*
* @remarks The simplest interface, using default offsets.
*/
virtual void GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FRotator& OutWristRotation) const override;
public:
/**
* Access all sorts of device info specific to this Nova.
*/
USGNovaGloveInfo* GetGloveInfo(UObject* Outer) const;
/**
* If true, this Nova Glove supports sending special firmware commands to lock brakes at specific sensor values.
*/
bool SupportsThresholds() const;
/**
* If true, this Nova Glove supports sending custom 'fire-and-forget' waveforms.
*/
bool SupportsCustomWaveforms() const;
/**
* If true, this glove's sensor calibration runs on board the device.
*/
bool SupportsOnBoardNormalization() const;
public:
/**
* Get the latest Sensor Data from this Glove.
*/
bool GetSensorData(UObject* Outer, USGNovaGloveSensorData*& OutSensorData);
/**
* Returns the normalized Sensor Data of this Nova Glove. If no normalization is running on the glove(s), then it's
* done on the PC side.
*
* @param OutNormalizedValues
*/
bool GetNormalizedInput(TArray<float>& OutNormalizedValues) const;
public:
/**
* Converts a set of commands into a series of bytes (string) this glove can understand.
*
* @param ForceFeedbackLevels Force-Feedback levels for each finger.
* @param BuzzLevels Vibration levels for each finger.
* @param WristLevel Value between 0 and 1 for the wrist amplitude to set.
*/
virtual FString ToNovaCommand(
const TArray<float>& ForceFeedbackLevels, const TArray<float>& BuzzLevels, float WristLevel) const;
/**
* Queue a vibrotactile level for each finger.
*
* @param Amplitudes
*/
virtual bool QueueVibroLevels(const TArray<float>& Amplitudes);
/**
* Queue a vibrotactle level for a specific finger.
*
* @param Finger
* @param Amplitude
*/
virtual bool QueueVibroLevel(int32 Finger, float Amplitude);
/**
* Queue a command to the vibration amplitude of a general wrist actuator to a set level.
*
* @param Amplitude The amplitude of the wrist vibration, where 0.0 means no vibration, and 1.0 means full
* vibration.
*
* @returns Returns true if the wrist command has been successfully queued. If false, the device might not support
* direct wrist control or have the appropriate firmware.
*
* @remarks This one isn't contained in an interface as it's not used outside of the NovaGlove class.
*/
virtual bool QueueWristLevel(float Amplitude);
public:
/**
* Convert a HapticLocation into a Nova Motor location.
*
* @param Location
*/
virtual ESGNovaVibroMotor ToNovaMotor(ESGHapticLocation Location) const;
/**
* Returns the channel index for a particular motor. Can make this as complex as I want for the Nova GLove(s).
*
* @param Motor
*/
virtual int32 ChannelIndex(ESGNovaVibroMotor Motor) const;
/**
* Ensures the waveform that is to be sent to this Nova Glove has the appropriate parameters.
*
* @param OutWaveform
* @param Motor
*/
virtual void ValidateWaveform(USGCustomWaveform* OutWaveform, ESGNovaVibroMotor Motor) const;
/**
* Directly sends a custom waveform to the Nova Glove motors, as opposed to specifying a Haptic Location.
*
* @param OutWaveform
* @param Motor
* @param bValidateWaveform
*/
virtual bool SendCustomWaveform_Nova(
USGCustomWaveform* OutWaveform, ESGNovaVibroMotor Motor, bool bValidateWaveform = true);
public:
/**
* Stops the glove when flexing pas this point.
*
* @param Finger
* @param FlexionThreshold
*/
bool QueueThresholdCommand_Flexion(int32 Finger, float FlexionThreshold);
/**
* Queue a command to clear the threshold for a specific finger.
*
* @param Finger
*
* @returns Returns true if the command was queued. If false, the device does not have the required firmware for
* these commands.
*/
virtual bool QueueClearThreshold(int32 Finger);
public:
/**
* Create a string representation of this device for reporting purposes.
*/
virtual FString ToString() const override;
};
};
@@ -1,71 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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 "Containers/Array.h"
#include "Math/Vector.h"
#include "SGNovaGloveCalibration.generated.h"
class USGNovaGloveHandProfile;
/**
*
*/
USTRUCT()
struct SENSEGLOVECORE_API FSGNovaGloveCalibration
{
GENERATED_BODY()
public:
/**
* Apply a glove's default interpolation values to a profile, using the 'default' hand angles from calibration.
*/
static void ApplyDefaultCalibrationInterpolationValues(
const TArray<FVector>& RetractedValues,
const TArray<FVector>& ExtendedValues,
const USGNovaGloveHandProfile* Profile);
/**
* Apply a set of sensor-to-joint-angle interpolations to a nova profile.
*/
static void ApplyInterpolationValues(
const TArray<FVector>& RetractedValues,
const TArray<FVector>& ExtendedValues,
const TArray<TArray<FVector>>& RetractedAngles,
const TArray<TArray<FVector>>& ExtendedAngles,
const USGNovaGloveHandProfile* Profile);
};
@@ -1,158 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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
*
* Input for Nova kinematics to calculate a HandPose.
* Output of calibration algorithms.
*/
#pragma once
#include "Containers/UnrealString.h"
#include "HAL/Platform.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGNovaGloveHandProfile.generated.h"
class FSGNovaGloveHandProfileImpl;
class USGHandInterpolator;
/**
* Contains user-specific data for the Nova to convert sensor data into a hand pose.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGNovaGloveHandProfile final : public UObject
{
GENERATED_BODY()
public:
static USGNovaGloveHandProfile* NewNovaGloveHandProfile(
UObject* Outer, const FSGNovaGloveHandProfileImpl& NovaGloveHandProfileImpl);
public:
/**
* The default constructor.
*/
static USGNovaGloveHandProfile* NewNovaGloveHandProfile(UObject* Outer);
/**
* Create a new instance of a Nova-Profile.
*/
static USGNovaGloveHandProfile* NewNovaGloveHandProfile(
UObject* Outer, bool bRightHanded, const USGHandInterpolator* Interpolator);
public:
/**
* Creates a default Nova Profile for a left or right hand.
*/
static USGNovaGloveHandProfile* Default(UObject* Outer, bool bRightHanded);
/**
* Convert a string notation of a NovaGloveHandProfile into a new instance.
*/
static USGNovaGloveHandProfile* Deserialize(UObject* Outer, const FString& SerializedString);
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
/**
* The default constructor.
*/
USGNovaGloveHandProfile();
/**
* Create a new instance of a Nova-Profile.
*/
USGNovaGloveHandProfile(bool bRightHanded, const USGHandInterpolator* Interpolator);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGNovaGloveHandProfile(const FSGNovaGloveHandProfileImpl& NovaGloveHandProfileImpl);
public:
/**
* The destructor.
*/
virtual ~USGNovaGloveHandProfile() override;
protected:
/**
* Allows to set the underlying object after construction.
*/
void SetNovaGloveHandProfileImpl(const FSGNovaGloveHandProfileImpl& NovaGloveHandProfileImpl);
public:
/**
* The cast to underlying type method.
*/
const FSGNovaGloveHandProfileImpl& ToNovaGloveHandProfileImpl() const;
public:
/**
* Whether this profile was created for a right- or left hand.
*/
bool IsRight() const;
/**
* Interpolation sets to convert sensor data into a hand pose.
*/
USGHandInterpolator* GetInterpolationSet(UObject* Outer) const;
public:
/**
*
*/
bool Equals(const USGNovaGloveHandProfile* NovaGloveHandProfile) const;
/**
*
*/
void Reset();
public:
/**
* Convert this NovaGloveHandProfile into a string notation so it can be stored on disk.
*/
FString SGSerialize() const;
};
@@ -35,7 +35,6 @@
#pragma once
#include "SGHapticGlove.h"
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "HAL/Platform.h"
@@ -178,6 +177,25 @@ public:
*/
int32 GetNumberOfSensors() const;
public:
/**
* Returns true if this glove's firmware is newer than certain version.
*
* @param FirmwareMain
* @param FirmwareSub
* @param bInclusive
*/
bool FirmwareNewerThan(int32 FirmwareMain, int32 FirmwareSub, bool bInclusive) const;
/**
* Returns true if this glove's firmware is older than certain version.
*
* @param FirmwareMain
* @param FirmwareSub
* @param bInclusive
*/
bool FirmwareOlderThan(int32 FirmwareMain, int32 FirmwareSub, bool bInclusive) const;
public:
/**
* Returns true if this GloveInfo contains the same information as another.
@@ -87,12 +87,18 @@ public:
static USGNovaGloveSensorData* Empty(UObject* Outer);
/**
* Parse the bytes as they come in from the device into useable values.
* Parse the bytes as they come in from the device into usable values.
*
* @param RawData
* @param GloveInfo
* @return
*/
static USGNovaGloveSensorData* Parse(UObject* Outer, const FString& RawData, const USGNovaGloveInfo* GloveInfo);
/**
* Convert this sensor data into ta string representation.
*
* @param SerializedString
*/
static USGNovaGloveSensorData* Deserialize(UObject* Outer, const FString& SerializedString);
@@ -115,12 +121,26 @@ public:
/**
* Create a new instance of a NovaGloveSensorData.
*
* @param Values
* @param ParsedValues
* @param ImuRotation
* @param bImuParsed
* @param BatteryLevel
* @param bCharging
*/
USGNovaGloveSensorData(const TArray<FVector>& Values, int32 ParsedValues,
const FQuat& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging);
/**
* Create a new instance of a NovaGloveSensorData.
*
* @param Values
* @param ParsedValues
* @param ImuRotation
* @param bImuParsed
* @param BatteryLevel
* @param bCharging
*/
USGNovaGloveSensorData(const TArray<FVector>& Values, int32 ParsedValues,
const FRotator& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging);
@@ -155,6 +175,21 @@ public:
*/
TArray<FVector> GetSensorValues() const;
/**
* Returns the sensor movement of a specific finger.
*
* @param Finger
* @param Location If a Nova glove has only one flexion sensor, it will return the same value for FlexionProximal
* and FlexionDistal.
*/
float GetSensorValue(ESGFinger Finger, ESGNovaSensorLocation Location) const;
/**
* The number of values that were parsed from the sensor string.
*/
int32 GetParsedValues() const;
public:
/**
* Quaternion rotation relative to magnetic north.
*/
@@ -165,23 +200,20 @@ public:
*/
FRotator GetImuRotation() const;
/**
* The number of values that were parsed from the sensor string.
*/
int32 GetParsedValues() const;
/**
* Whether the IMU values were all successfully parsed, or not.
*/
bool IsImuParsed() const;
public:
/**
* A value between 0..1 that represents the battery level of this Nova Glove (0 .. 100%). Returns -1 if the value wasn't received.
* A value between 0..1 that represents the battery level of this Nova Glove (0 .. 100%). Returns -1 if the value
* wasn't received.
*/
float GetBatteryLevel() const;
/**
* Returns true if this NovaGlove is connected to a power source
* Returns true if this NovaGlove is connected to a power source.
*/
bool IsCharging() const;
@@ -193,7 +225,7 @@ public:
public:
/**
* Create a readable string representation of this Sensor Data
* Create a readable string representation of this Sensor Data.
*/
FString ToString() const;
@@ -201,4 +233,4 @@ public:
* Convert this sensor data into a string so it can be stored on disk.
*/
FString SGSerialize() const;
};
};
+357 -202
View File
@@ -36,26 +36,28 @@
#pragma once
#include "SGHapticGlove.h"
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "HAL/Platform.h"
#include "Math/Quat.h"
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGCore/SGBasicHandModel.h"
#include "SGCore/SGHandPose.h"
#include "SGCore/SGHandProfile.h"
#include "SGCore/SGHapticGlove.h"
#include "SGCore/SGSenseGlovePose.h"
#include "SGCore/SGSenseGloveSensorData.h"
#include "SGCore/SGThumperCommand.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGSenseGlove.generated.h"
class FSGSenseGloveImpl;
class USGBuzzCommand;
class USGForceFeedbackCommand;
class USGHandInterpolator;
class USGHandPose;
class USGSenseGloveSensorNormalizer;
/**
* Interface for the Sense Glove; and exoskeleton Force-Feedback glove.
@@ -72,7 +74,7 @@ public:
public:
/**
*
* Default constructor for SenseGlove.
*/
static USGSenseGlove* NewSenseGlove(UObject* Outer);
@@ -81,44 +83,6 @@ public:
*/
static USGSenseGlove* NewSenseGlove(UObject* Outer, const USGSenseGloveInfo& Model);
public:
/**
* Byte indicating a new Sense Glove haptic command.
*/
static ANSICHAR GetHapticsByte();
/**
* Byte indicating a new Thumper command.
*/
static ANSICHAR GetThumperByte();
public:
/**
* Calculates a GlovePose based on sensor angles and a glove model.
*
* @remarks Use this when you already have gloveAngles collected.
*/
static USGSenseGlovePose* CalculateGlovePose(UObject* Outer,
const USGSenseGloveSensorData* SensorData,
const USGSenseGloveInfo* GloveModel);
/**
* Calculates a GlovePose based on gloveAngles and a glove model.
*
* @remarks Use this when you already have gloveAngles collected.
*/
static USGSenseGlovePose* CalculateGlovePose(UObject* Outer,
const TArray<TArray<FVector>>& GloveAngles,
const USGSenseGloveInfo* GloveModel);
/**
* @remarks Use this when you already have a GlovePose.
*/
static USGHandPose* CalculateHandPose(UObject* Outer,
const USGSenseGlovePose* GlovePose,
const USGBasicHandModel* HandModel,
const USGSenseGloveHandProfile* Profile);
public:
/**
* Deserializes a Sense Glove from its ConstantsString. Returns a nullptr if unsuccessful.
@@ -140,22 +104,17 @@ public:
*/
static bool GetSenseGlove(UObject* Outer, bool bRightHanded, USGSenseGlove*& OutGlove);
public:
/**
* Convert a SenseGlove GlovePose into calibrationValues.
*/
static TArray<FVector> GetCalibrationValues(const USGSenseGlovePose* GlovePose);
/**
* Apply interpolation values to the correct fields in the SenseGlove Profile, based on min/max sensor values.
*/
static void CalibrateInterpolation(UObject* Outer,
const TArray<FVector>& MinValues, const TArray<FVector>& MaxValues,
bool bRightHanded, USGSenseGloveHandProfile*& OutProfile);
public:
/**
* Retrieve the location of the glove origin, based on a reference location without requiring an object reference.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param bRightHanded Whether or not this is a left or right handed glove.
* @param MountedOn Which finger module the hardware is mounted on. Default is Middle finger.
* @param OutGlovePosition The 3D Position of the glove, in mm, relative to your origin.
* @param OutGloveRotation The 3D Rotation of the glove, relative to your origin.
*/
static void CalculateGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
@@ -164,6 +123,14 @@ public:
/**
* Retrieve the location of the glove origin, based on a reference location without requiring an object reference.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param bRightHanded Whether or not this is a left or right handed glove.
* @param MountedOn Which finger module the hardware is mounted on. Default is Middle finger.
* @param OutGlovePosition The 3D Position of the glove, in mm, relative to your origin.
* @param OutGloveRotation The 3D Rotation of the glove, relative to your origin.
*/
static void CalculateGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
@@ -172,6 +139,16 @@ public:
/**
* Calculates the full wrist location.
*
* @param ReferencePosition
* @param ReferenceRotation
* @param TrackingHardware
* @param bRightHanded
* @param MountedOn
* @param GloveWristPositionOffset
* @param GloveWristRotationOffset
* @param OutWristPosition
* @param OutWristRotation
*/
static void CalculateWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
@@ -182,6 +159,16 @@ public:
/**
* Calculates the full wrist location.
*
* @param ReferencePosition
* @param ReferenceRotation
* @param TrackingHardware
* @param bRightHanded
* @param MountedOn
* @param GloveWristPositionOffset
* @param GloveWristRotationOffset
* @param OutWristPosition
* @param OutWristRotation
*/
static void CalculateWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
@@ -190,6 +177,84 @@ public:
const FRotator& GloveWristRotationOffset,
FVector& OutWristPosition, FRotator& OutWristRotation);
public:
/**
* Byte indicating a new Sense Glove haptic command.
*/
static ANSICHAR GetHapticsByte();
/**
* Byte indicating a new Thumper command.
*/
static ANSICHAR GetThumperByte();
/**
* Default offset from thimble to fingertip.
*/
static FVector GetDefaultThimbleOffset();
public:
/**
* Calculates a GlovePose based on sensor angles and a glove model.
*
* @remarks Use this when you already have gloveAngles collected.
*/
static USGSenseGlovePose* CalculateGlovePose(UObject* Outer,
const USGSenseGloveSensorData* SensorData,
const USGSenseGloveInfo* GloveModel);
/**
* Calculates a GlovePose based on gloveAngles and a glove model.
*
* @remarks Use this when you already have gloveAngles collected.
*/
static USGSenseGlovePose* CalculateGlovePose(UObject* Outer,
const TArray<TArray<FVector>>& GloveAngles,
const USGSenseGloveInfo* GloveModel);
/**
* Returns normalized flexions and abductions.
*
* @param SumAngles
* @param Normalizer
* @param OutFlexions
* @param OutAbductions
*/
static void NormalizeValues(const TArray<FVector>& SumAngles,
const USGSenseGloveSensorNormalizer* Normalizer,
TArray<float>& OutFlexions, TArray<float>& OutAbductions);
public:
/**
* Calculate Hand Angles from a GlovePose and relevant normalizers.
*
* @param GlovePose
* @param Normalizer
* @param NormalizedToAngles
* @param OutHandAngles
*/
static void CalculateHandAngles(
const USGSenseGlovePose* GlovePose,
const USGSenseGloveSensorNormalizer* Normalizer, const USGHandInterpolator* NormalizedToAngles,
TArray<TArray<FVector>>& OutHandAngles);
/**
* Calculate a HandPose based on a glovePose and a solver.
*
* @remarks Use this when you already have a GlovePose.
*
* @param GlovePose
* @param HandModel
* @param Normalizer
* @param NormalizedToAngles
* @param OutHandPose
*/
static void CalculateHandPose(
UObject* Outer,
const USGSenseGlovePose* GlovePose, const USGBasicHandModel* HandModel,
const USGSenseGloveSensorNormalizer* Normalizer, const USGHandInterpolator* NormalizedToAngles,
USGHandPose*& OutHandPose);
protected:
/**
*
@@ -245,19 +310,6 @@ public:
*/
TSharedRef<FSGSenseGloveImpl> ToSenseGloveImpl() const;
public:
/**
* Retrieve this glove's hardware model, which contains its hardware data.
*/
USGSenseGloveInfo* GetGloveModel(UObject* Outer) const;
/**
* Check if this Sense Glove is right handed.
*
* @remarks While the variable is stored in SG_GloveModel, added direct access here since its frequently used.
*/
virtual bool IsRight() const override;
public:
/**
* Get the DeviceType enumerator of this SenseGlove, used in DeviceList enumeration.
@@ -286,9 +338,11 @@ public:
public:
/**
* Get the latest Sensor Data from this Sense Glove.
* Check if this Sense Glove is right handed.
*
* @remarks While the variable is stored in SG_GloveModel, added direct access here since its frequently used.
*/
bool GetSensorData(UObject* Outer, USGSenseGloveSensorData*& OutSensorData) const;
virtual bool IsRight() const override;
/**
*
@@ -300,6 +354,223 @@ public:
*/
virtual bool GetImuRotation(FRotator& OutImu) override;
/*
* Calculate a HandPose from this glove's latest Sensor Data.
*
* @param HandGeometry
* @param OutHandPose
*/
virtual bool GetHandPose(UObject* Outer, const USGBasicHandModel* HandGeometry,
USGHandPose*& OutHandPose) const override;
/**
* Returns the Hand Angles calculated by this Sense Glove. Used for input for HandPoses, but can be used in and of
* itself.
*
* @param OutHandAngles
*/
virtual bool GetHandAngles(TArray<TArray<FVector>>& OutHandAngles) const;
public:
/*
* Retrieve the calibration status of this Sense Glove.
*/
virtual ESGHapticGloveCalibrationState GetCalibrationState() const override;
/*
* Completes sensor Normalization on the Glove's end.
*/
virtual void EndCalibration() override;
/*
* Completes sensor Normalization on the Glove's end.
*/
virtual void ResetCalibration() override;
public:
/*
* Stop all haptic feedback effects playing on this device.
*/
virtual void StopHaptics() override;
/**
* Stop only all vibrotactile feedback.
*/
virtual void StopVibrations() override;
/**
* Flush all streaming haptic effects on the different fingers to the Glove.
*/
virtual bool SendHaptics() override;
public:
/**
* Set the Force-Feedback value of a particular finger to a specific level.
*
* @param Levels01 Array containing the Force-Feedback levels, from 0.0 (no FFB) to 1.0. A value < 0.0f will be
* ignored.
*
* @remarks Devices that 'only' have on/off FFB will treat any value > 0.0 as 1.0.
*/
virtual bool QueueForceFeedbackLevels(const TArray<float>& Levels01) override;
/**
* Queue a list of force-feedback levels, between 0.0 and 1.0. Your list should be sorted from thumb to pinky.
*
* @param Finger Value will be clamped between [0...1], where 0.0 means no Force-Feedback, and 1.0 means
* full force-feedback.
* @param Level01 The finger to which to send the command.
*/
virtual bool QueueForceFeedbackLevel(int32 Finger, float Level01) override;
public:
/**
* Retrieve the location of the glove origin, based on a reference location.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param OutGlovePosition The 3D Position of the glove, in mm, relative to your origin.
* @param OutGloveRotation The 3D Rotation of the glove, relative to your origin.
*/
virtual void GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutGlovePosition, FQuat& OutGloveRotation) const override;
/**
* Retrieve the location of the glove origin, based on a reference location.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param OutGlovePosition The 3D Position of the glove, in mm, relative to your origin.
* @param OutGloveRotation The 3D Rotation of the glove, relative to your origin.
*/
virtual void GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutGlovePosition, FRotator& OutGloveRotation) const override;
/**
* Retrieve the location of the glove origin, based on a reference location.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param MountedOn Which finger module the hardware is mounted on.
* @param OutGlovePosition The 3D Position of the glove, in mm, relative to your origin.
* @param OutGloveRotation The 3D Rotation of the glove, relative to your origin.
*/
void GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware, ESGFinger MountedOn,
FVector& OutGlovePosition, FQuat& OutGloveRotation) const;
/**
* Retrieve the location of the glove origin, based on a reference location.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param MountedOn Which finger module the hardware is mounted on.
* @param OutGlovePosition The 3D Position of the glove, in mm, relative to your origin.
* @param OutGloveRotation The 3D Rotation of the glove, relative to your origin.
*/
void GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware, ESGFinger MountedOn,
FVector& OutGlovePosition, FRotator& OutGloveRotation) const;
/**
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param OutWristPosition The 3D Position of the wrist, in mm, relative to your origin.
* @param OutWristRotation The 3D Rotation of the wrist, relative to your origin.
*
* @remarks The simplest interface, using default offsets.
*/
virtual void GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FQuat& OutWristRotation) const override;
/**
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets.
*
* @param ReferencePosition Position of the tracked object, in mm, relative to your origin.
* @param ReferenceRotation Rotation of the tracked object relative to your origin.
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param OutWristPosition The 3D Position of the wrist, in mm, relative to your origin.
* @param OutWristRotation The 3D Rotation of the wrist, relative to your origin.
*
* @remarks The simplest interface, using default offsets.
*/
virtual void GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FRotator& OutWristRotation) const override;
/**
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets.
*
* @param ReferencePosition
* @param ReferenceRotation
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param GloveWristPositionOffset Position offset, in mm, from the glove origin to wrist (default = 0,0,-30 mm).
* @param GloveWristRotationOffset Rotation offset from the glove origin to wrist (default = 0,-5,0 degrees).
* @param OutWristPosition The 3D Position of the wrist, in mm, relative to your origin.
* @param OutWristRotation The 3D Rotation of the wrist, relative to your origin.
*/
void GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
const FVector& GloveWristPositionOffset,
const FQuat& GloveWristRotationOffset,
FVector& OutWristPosition, FQuat& OutWristRotation) const;
/**
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets.
*
* @param ReferencePosition
* @param ReferenceRotation
* @param TrackingHardware The hardware mounted on the SenseGlove.
* @param GloveWristPositionOffset Position offset, in mm, from the glove origin to wrist (default = 0,0,-30 mm).
* @param GloveWristRotationOffset Rotation offset from the glove origin to wrist (default = 0,-5,0 degrees).
* @param OutWristPosition The 3D Position of the wrist, in mm, relative to your origin.
* @param OutWristRotation The 3D Rotation of the wrist, relative to your origin.
*/
void GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
const FVector& GloveWristPositionOffset,
const FRotator& GloveWristRotationOffset,
FVector& OutWristPosition, FRotator& OutWristRotation) const;
public:
/**
* Retrieve this glove's hardware model, which contains its hardware data.
*/
USGSenseGloveInfo* GetGloveInfo(UObject* Outer) const;
/**
* Offset from thimble to fingertip, used for Inverse Kinematics.
*/
TArray<FVector> GetFingerThimbleOffsets() const;
/**
*
* @param Finger
* @param Offset
*/
void SetFingerThimbleOffset(int32 Finger, const FVector& Offset);
/**
*
*/
bool SupportsWristActuator() const;
public:
/**
* Get the latest Sensor Data from this Sense Glove.
*/
bool GetSensorData(UObject* Outer, USGSenseGloveSensorData*& OutSensorData) const;
/**
* Get the pose of this Sense Glove's hardware, based on its latest Sensor Data.
*/
@@ -310,148 +581,32 @@ public:
*/
bool GetGlovePose(UObject* Outer, const USGSenseGloveSensorData* SensorData, USGSenseGlovePose*& OutGlovePose);
/// HACK
/// 'FSGSenseGloveImpl::GetHandPose' hides overloaded virtual functions [-Werror,-Woverloaded-virtual]
/// tell the compiler we want both the GetHandPose from USGHapticGlove and USGSenseGlove
using USGHapticGlove::GetHandPose;
/**
* Retrieve a new hand pose using this glove's data, based on (calibrated) user data.
*/
bool GetHandPose(UObject* Outer, const USGBasicHandModel* HandModel, const USGSenseGloveHandProfile* Profile,
USGHandPose*& OutHandPose);
/**
* Calculate the Hand Pose of this device, provided it has Hand Tracking available.
*/
virtual bool GetHandPose(UObject* Outer, const USGBasicHandModel* HandGeometry, const USGHandProfile* HandProfile,
USGHandPose*& OutHandPose) override;
/**
* Calculate the HandPose of this Device, taking into account user values, but not hand geometry.
*/
virtual bool GetHandPose(UObject* Outer, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose) override;
public:
/// HACK
/// 'USGSenseGlove::SendHaptics' hides overloaded virtual functions [-Werror,-Woverloaded-virtual]
/// tell the compiler we want both the SendHaptics from USGHapticGlove and USGSenseGlove
using USGHapticGlove::SendHaptics;
/**
* Set the level(s) of Force and Vibrotactile feedback, with an optional thumper command.
*/
bool SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand,
const USGBuzzCommand* BuzzCommand,
ESGSenseGloveThumperCommand ThumperCommand = ESGSenseGloveThumperCommand::None);
/**
* Send a thumper command.
*/
bool SendHaptics(ESGSenseGloveThumperCommand ThumperCommand);
/**
* Send Haptic Commands to this Glove.
*/
virtual void SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand) override;
/**
* Send Haptic Commands to this Glove.
*/
virtual void SendHaptics(const USGBuzzCommand* BuzzCommand) override;
/**
* Retrieve this device's firmware version.
*/
virtual void SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand,
const USGBuzzCommand* BuzzCommand,
const USGThumperCommand* ThumperCommand) override;
public:
/**
* Retrieve calibration values of this glove, as an array of size 5, containing x (roll), y (flexion), z (abduction) values.
* Queue a vibrotactile level for each finger.
*
* @param Amplitudes
*/
virtual bool GetCalibrationValues(TArray<FVector>& OutValues) override;
virtual bool QueueVibroLevels(const TArray<float>& Amplitudes);
/**
* Reset the glove's calibration range.
* Queue a vibrotactle level for a specific finger.
*
* @param Finger
* @param Amplitude
*/
virtual void ResetCalibrationRange() override;
virtual bool QueueVibroLevel(int32 Finger, float Amplitude);
/**
* Apply this glove's calibration range to a handProfile.
* Queue a command for the SenseGlove Thumper actuator.
*
* @param Command
*/
virtual void ApplyCalibration(UObject* Outer, USGHandProfile*& OutProfile) const override;
/**
* Apply this glove's calibration range to a SenseGloveHandProfile.
*/
void ApplyCalibration(UObject* Outer, USGSenseGloveHandProfile*& OutProfile) const;
public:
/**
* Retrieve the location of the glove origin, based on a reference location.
*/
virtual void GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutGlovePosition, FQuat& OutGloveRotation) const override;
/**
* Retrieve the location of the glove origin, based on a reference location.
*/
virtual void GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutGlovePosition, FRotator& OutGloveRotation) const override;
/**
* Retrieve the location of the glove origin, based on a reference location.
*/
void GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware, ESGFinger MountedOn,
FVector& OutGlovePosition, FQuat& OutGloveRotation) const;
/**
* Retrieve the location of the glove origin, based on a reference location.
*/
void GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware, ESGFinger MountedOn,
FVector& OutGlovePosition, FRotator& OutGloveRotation) const;
/**
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets.
*/
virtual void GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FQuat& OutWristRotation) const override;
/**
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets.
*/
virtual void GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FRotator& OutWristRotation) const override;
/**
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets.
*/
void GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
const FVector& GloveWristPositionOffset,
const FQuat& GloveWristRotationOffset,
FVector& OutWristPosition, FQuat& OutWristRotation) const;
/**
* Retrieve the location of the wrist, based on a reference location and default glove-hand offsets.
*/
void GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
const FVector& GloveWristPositionOffset,
const FRotator& GloveWristRotationOffset,
FVector& OutWristPosition, FRotator& OutWristRotation) const;
virtual bool QueueThumperCommand(ESGSenseGloveThumperCommand Command);
public:
/**
* Create a string representation of this device for reporting purposes.
*/
virtual FString ToString() const override;
};
};
@@ -1,185 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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
*
* Input for Sense Glove kinematics to calculate a HandPose.
* Output of calibration algorithms.
*/
#pragma once
#include "Containers/UnrealString.h"
#include "HAL/Platform.h"
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGSenseGloveHandProfile.generated.h"
class FSGSenseGloveHandProfileImpl;
class USGHandInterpolator;
/**
* Contains everything a Sense Glove needs to calculate a HandPose.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGSenseGloveHandProfile final : public UObject
{
GENERATED_BODY()
public:
static USGSenseGloveHandProfile* NewSenseGloveHandProfile(
UObject* Outer, const FSGSenseGloveHandProfileImpl& SenseGloveHandProfileImpl);
public:
/**
* The basic constructor.
*/
static USGSenseGloveHandProfile* NewSenseGloveHandProfile(UObject* Outer);
/**
* Create a new Hand Profile for the Sense Glove.
*/
static USGSenseGloveHandProfile* NewSenseGloveHandProfile(
UObject* Outer, bool bRightHanded, const USGHandInterpolator* Interpolator,
ESGThumbSolver ThumbSolver, ESGFingerSolver FingerSolver, const TArray<FVector>& FingerThimbleOffset);
public:
/**
* Retrieve a 'new' profile, for either a left or right hand.
*/
static USGSenseGloveHandProfile* Default(UObject* Outer, bool bRightHanded);
/**
* Deserialize a HandProfile back into usable values.
*/
static USGSenseGloveHandProfile* Deserialize(UObject* Outer, const FString& SerializedString);
public:
/**
* Default offset from thimble to fingertip.
*/
static FVector GetDefaultThimbleOffset();
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
/**
* The basic constructor.
*/
USGSenseGloveHandProfile();
/**
* Create a new Hand Profile for the Sense Glove.
*/
USGSenseGloveHandProfile(bool bRightHanded, const USGHandInterpolator* Interpolator,
ESGThumbSolver ThumbSolver, ESGFingerSolver FingerSolver,
const TArray<FVector>& FingerThimbleOffset);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGSenseGloveHandProfile(const FSGSenseGloveHandProfileImpl& SenseGloveHandProfileImpl);
public:
/**
* The destructor.
*/
virtual ~USGSenseGloveHandProfile() override;
protected:
/**
* Allows to set the underlying object after construction.
*/
void SetSenseGloveHandProfileImpl(const FSGSenseGloveHandProfileImpl& SenseGloveHandProfileImpl);
public:
/**
* The cast to underlying type method.
*/
const FSGSenseGloveHandProfileImpl& ToSenseGloveHandProfileImpl() const;
public:
/**
* Check whether this profile has been created for a right hand (true) or left hand (false).
*/
bool IsRight() const;
/**
* Interpolation set to estimate joint angles.
*/
USGHandInterpolator* GetInterpolationSet(UObject* Outer) const;
/**
* Solver property that determines _how_ HandPoses are calculated.
*/
ESGThumbSolver GetThumbSolver() const;
/**
* Solver property that determines _how_ finger poses are calculated.
*/
ESGFingerSolver GetFingerSolver() const;
/**
* Offset from thimble to fingertip, used for Inverse Kinematics.
*/
TArray<FVector> GetFingerThimbleOffset() const;
public:
/**
*
*/
bool Equals(const USGSenseGloveHandProfile* SenseGloveHandProfile) const;
/**
* Reset calibration on this profile.
*/
void Reset();
public:
/**
* Serialize this HandProfile into a string representation.
*/
FString SGSerialize() const;
};
@@ -300,18 +300,18 @@ public:
bool Equals(const USGSenseGloveInfo* SenseGloveInfo) const;
public:
/**
* Create a string representation for logging. If shortNotation is false, all values are reported.
*/
FString ToString() const;
/**
* Create a string representation for fast logging.
*/
FString ToString(bool bShortNotation) const;
/**
* Create a string representation for logging. If shortNotation is false, all values are reported.
*/
FString ToString() const;
/**
* Serialize this HandProfile into a string representation.
*/
FString SGSerialize() const;
};
};
@@ -51,7 +51,6 @@
#include "SGSenseGlovePose.generated.h"
class FSGSenseGlovePoseImpl;
class USGSenseGloveHandProfile;
class USGSenseGloveInfo;
/**
@@ -237,15 +236,10 @@ public:
*/
TArray<FVector> GetTotalGloveAngles() const;
/**
* Calculate fingertip positions based on a user profile.
*/
TArray<FVector> CalculateFingerTips(const USGSenseGloveHandProfile* SenseGloveHandProfile) const;
/**
* Calculate fingertip positions, knowing the offset between thimble and fingertips.
*/
TArray<FVector> CalculateFingerTips(const TArray<FVector>& FingerOffsets) const;
TArray<FVector> CalculateFingertips(const TArray<FVector>& FingerOffsets) const;
/**
* Returns true if this glove pose equals another.
@@ -107,7 +107,7 @@ public:
static USGSenseGloveSensorData* Parse(UObject* Outer, const FString& RawData, const USGSenseGloveInfo* GloveInfo);
/**
* Deserialize a HandProfile back into useable values.
* Deserialize a HandProfile back into usable values.
*/
static USGSenseGloveSensorData* Deserialize(UObject* Outer, const FString& SerializedString);
@@ -182,6 +182,16 @@ public:
*/
TArray<TArray<float>> GetSensorAngles() const;
/**
* Get the glove angles of a specific finger segment.
*/
TArray<float> GetSensorAngles(ESGFinger Finger) const;
/**
* Returns all glove angles in a sequence, without splitting them per finger.
*/
TArray<float> GetAngleSequence() const;
/**
*
*/
@@ -197,22 +207,12 @@ public:
*/
int32 GetParsedValues() const;
public:
/**
* Check if the IMU was properly parsed.
*/
bool IsImuParsed() const;
public:
/**
* Get the glove angles of a specific finger segment.
*/
TArray<float> GetSensorAngles(ESGFinger Finger) const;
/**
* Returns all glove angles in a sequence, without splitting them per finger.
*/
TArray<float> GetAngleSequence() const;
public:
/**
* Returns true if the values of both data are equal.
@@ -229,4 +229,4 @@ public:
* Serialize this HandProfile into a string representation.
*/
FString SGSerialize() const;
};
};
@@ -29,7 +29,8 @@
*
* @section DESCRIPTION
*
*
* Internal class that acts as a sort of 'in between' handProfile. This class
* converts SG Dk1 Angles into 'normalized data' - between 0 .. 1.
*/
@@ -37,40 +38,37 @@
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "HAL/Platform.h"
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGCalibrationDataPoint.generated.h"
#include "SGSenseGloveSensorNormalizer.generated.h"
class FSGCalibrationDataPointImpl;
class FSGSenseGloveSensorNormalizerImpl;
/**
*
* Internal class to hold 'Threshold Commands' for specific fingers. Can be sent to a Device, or used internally.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGCalibrationDataPoint final : public UObject
class SENSEGLOVECORE_API USGSenseGloveSensorNormalizer final : public UObject
{
GENERATED_BODY()
public:
static USGCalibrationDataPoint* NewCalibrationDataPoint(
UObject* Outer, const FSGCalibrationDataPointImpl& CalibrationDataPointImpl);
static USGSenseGloveSensorNormalizer* NewSenseGloveSensorNormalizer(
UObject* Outer, const FSGSenseGloveSensorNormalizerImpl& SenseGloveSensorNormalizerImpl);
public:
/**
*
* The default constructor.
*/
static USGCalibrationDataPoint* NewCalibrationDataPoint(UObject* Outer);
static USGSenseGloveSensorNormalizer* NewSenseGloveSensorNormalizer(UObject* Outer);
/**
* Create a new data point.
* Create a new instance of SenseGloveSensorNormalizer.
*/
static USGCalibrationDataPoint* NewCalibrationDataPoint(
UObject* Outer,
int32 CurrentStage, const TArray<FVector>& CalibrationValues);
static USGSenseGloveSensorNormalizer* NewSenseGloveSensorNormalizer(
UObject* Outer, bool bRightHanded);
private:
struct FImpl;
@@ -85,53 +83,55 @@ private:
public:
/**
*
* The default constructor.
*/
USGCalibrationDataPoint();
USGSenseGloveSensorNormalizer();
/**
* Create a new data point.
* Creates a new SenseGlove Sensor Normalizer based off the device's sensor angles.
*
* @param bRightHanded
*/
USGCalibrationDataPoint(int32 CurrentStage, const TArray<FVector>& CalibrationValues);
explicit USGSenseGloveSensorNormalizer(bool bRightHanded);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGCalibrationDataPoint(const FSGCalibrationDataPointImpl& CalibrationDataPointImpl);
explicit USGSenseGloveSensorNormalizer(const FSGSenseGloveSensorNormalizerImpl& SenseGloveSensorNormalizerImpl);
public:
/**
* The destructor.
*/
virtual ~USGCalibrationDataPoint() override;
virtual ~USGSenseGloveSensorNormalizer() override;
protected:
/**
* Allows to set the underlying object after construction.
*/
void SetCalibrationDataPointImpl(const FSGCalibrationDataPointImpl& CalibrationDataPointImpl);
void SetSenseGloveSensorNormalizerImpl(const FSGSenseGloveSensorNormalizerImpl& SenseGloveSensorNormalizerImpl);
public:
/**
* The cast to underlying type method.
*/
const FSGCalibrationDataPointImpl& ToCalibrationDataPointImpl() const;
const FSGSenseGloveSensorNormalizerImpl& ToSenseGloveSensorNormalizerImpl() const;
public:
/**
* Actual calibration values.
* Normalize a finger's flexion, based on the total flexion of the exoskeleton.
*
* @param Finger
* @param SumFlexionAngles
*/
TArray<FVector> GetCalibrationValues() const;
float NormalizeFlexion(int32 Finger, float SumFlexionAngles) const;
/**
* The Calibration stage this data point belongs to.
* Normalize a finger's abduction, based on the total abduction of the exoskeleton.
*
* @param Finger
* @param SumAbductionAngles
*/
int32 GetStage() const;
public:
/**
* Log Calibration values for storing on disk.
*/
FString ToLogData(const FString& Delimiter = "\t") const;
float NormalizeAbduction(int32 Finger, float SumAbductionAngles) const;
};
@@ -55,7 +55,8 @@ struct SENSEGLOVECORE_API FSGSenseGloveVars
public:
/**
* Retrieve a basic ConstantsString for a Sense Glove of a specific Hardware Version. Used for debugging / unit tests.
* Retrieve a basic ConstantsString for a Sense Glove of a specific Hardware Version. Used for debugging / unit
* tests.
*
* @returns Returns an empty string when an invalid glove version is requested.
*/
@@ -0,0 +1,189 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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
*
* A script to normalize any set of floating point values by looking at their
* minimum and maximum values. Used for automagical calibration.
*/
#pragma once
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGSensorNormalization.generated.h"
class FSGSensorNormalizationImpl;
/**
* Internal class to hold 'Threshold Commands' for specific fingers. Can be sent to a Device, or used internally.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGSensorNormalization final : public UObject
{
GENERATED_BODY()
public:
static USGSensorNormalization* NewSensorNormalization(
UObject* Outer, const FSGSensorNormalizationImpl& SensorNormalizationImpl);
public:
/**
* The default constructor.
*/
static USGSensorNormalization* NewSensorNormalization(UObject* Outer);
/**
* Create a new instance of SensorNormalization.
*/
static USGSensorNormalization* NewSensorNormalization(
UObject* Outer, const TArray<float>& MovementRanges);
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
/**
* The default constructor.
*/
USGSensorNormalization();
/**
* Create a new instance of SensorNormalization.
*/
explicit USGSensorNormalization(const TArray<float>& MovementRanges);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGSensorNormalization(const FSGSensorNormalizationImpl& SensorNormalizationImpl);
public:
/**
* The destructor.
*/
virtual ~USGSensorNormalization() override;
protected:
/**
* Allows to set the underlying object after construction.
*/
void SetSensorNormalizationImpl(const FSGSensorNormalizationImpl& SensorNormalizationImpl);
public:
/**
* The cast to underlying type method.
*/
const FSGSensorNormalizationImpl& ToSensorNormalizationImpl() const;
public:
/**
* If true, the normalization collection is active. If false, we're no longer collecting min / max values.
*/
bool CollectsNormalization() const;
/**
*
* @param bCollectNormalization
*/
void SetCollectNormalization(bool bCollectNormalization);
public:
/**
* The amount of items in this collector Useful for FOR loops.
*/
int32 GetLength() const;
/**
* The amount of values that have moved the appropriate amount.
*/
int32 GetMoveCount() const;
/**
* Returns true if all sensors are allowed to move.
*/
bool AllSensorsMoving() const;
/**
* Reset the normalization of values.
*/
void ResetNormalization();
/**
*
* @param Value
* @param Index
*/
void UpdateNormalization(float Value, int32 Index);
/**
* Normalize a value on a specific index, and update Normalization while you're at it.
*
* @param Value
* @param Index
*/
float NormalizeValue(float Value, int32 Index);
/**
* Update and Normalize a set of values, provided this is the same length.
*
* @param Values
*/
TArray<float> NormalizeValues(const TArray<float>& Values);
/**
* Returns true if a sensor on this index has moved enough.
*
* @param Index
*/
bool MovedEnough(int32 Index) const;
/**
* Turn a value from 0 .. 1 back into [minValue ... maxValue] range for the Nova Glove.
*
* @param Value01
* @param Index
* @param FallbackValue
*/
float Denormalize(float Value01, int32 Index, float FallbackValue = 1.0f) const;
};
@@ -1,192 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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 "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGSensorRange.generated.h"
class FSGSensorRangeImpl;
/**
*
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGSensorRange final : public UObject
{
GENERATED_BODY()
public:
static USGSensorRange* NewSensorRange(
UObject* Outer, const FSGSensorRangeImpl& SensorRangeImpl);
public:
/**
* Create a new instance of a SensorRange with values at 0, 0.
*/
static USGSensorRange* NewSensorRange(UObject* Outer);
/**
* Create a new SensorRange with predefined Min/Max values.
*/
static USGSensorRange* NewSensorRange(UObject* Outer,
const TArray<FVector>& MinValues, const TArray<FVector>& MaxValues);
public:
/**
* Generates a Sensor Range where minimum values are float.MaxValue and maximum values are float.MinValue.
*/
static USGSensorRange* ForCalibration(UObject* Outer);
/**
* Convert a serialized SensorRange back into the appropriate class.
*/
static USGSensorRange* Deserialize(UObject* Outer, const FString& SerializedString);
/**
* Evaluate maxValues so that it contains the highest x, y, and z values between currentValues and maxValues.
*/
static void CheckMax(const FVector CurrentValues, FVector& OutMaxValues);
/**
* Evaluate minValues so that it contains the lowest x, y, and z values between currentValues and minValues.
*/
static void CheckMin(const FVector& CurrentValues, FVector& OutMinValues);
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
/**
* Create a new instance of a SensorRange with values at 0, 0.
*/
USGSensorRange();
/**
* Create a new SensorRange with predefined Min/Max values.
*/
USGSensorRange(const TArray<FVector>& MinValues, const TArray<FVector>& MaxValues);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGSensorRange(const FSGSensorRangeImpl& SensorRangeImpl);
public:
/**
* The destructor.
*/
virtual ~USGSensorRange() override;
protected:
/**
* Allows to set the underlying object after construction.
*/
void SetSensorRangeImpl(const FSGSensorRangeImpl& SensorRangeImpl);
public:
/**
* The cast to underlying type method.
*/
const FSGSensorRangeImpl& ToSensorRangeImpl() const;
public:
/**
* Access the lowest values values of this range.
*/
TArray<FVector> GetMinValues() const;
/**
* Set the lowest values values of this range.
*/
void SetMinValues(const TArray<FVector>& Values);
/**
* Access the highest values values of this range.
*/
TArray<FVector> GetMaxValues() const;
/**
* Set the highest values values of this range.
*/
void SetMaxValues(const TArray<FVector>& Values);
/**
* Access the difference between min and max values.
*/
TArray<FVector> GetRange() const;
public:
/**
* Update the Range based on the current MinValues and MaxValues.
*/
void UpdateRange();
/**
* In otherValues are greater/smaller than this current range, update them.
*/
void CheckForExtremes(const TArray<FVector>& OtherValues);
public:
/**
* Report the Range value of this SensorRange, separated by a comma.
*/
FString RangeString(bool bYOnly = true) const;
/**
* Convert this SensorRange into a string rotation [min ... max].
*/
FString ToString(bool bYOnly = true) const;
/**
* Serialize this SensorRange into a string representation, that can be deserialized later.
*/
FString SGSerialize() const;
};
@@ -0,0 +1,183 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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
*
* Internal class to hold 'Threshold Commands' for specific fingers. Can be sent
* to a Device, or used internally.
* Threshold Commands tell our device "When your sensor data is higher than this
* threshold, lock FFB. Otherwise, turn it back off".
*/
#pragma once
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGThresholdCommand.generated.h"
class FSGThresholdCommandImpl;
/**
* Interface for Nova 2.0 Gloves. A soft glove with detachable force-feedback and sensor module, and active contact
* feedback in the front strap.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGThresholdCommand final : public UObject
{
GENERATED_BODY()
public:
static USGThresholdCommand* NewThresholdCommand(
UObject* Outer, const FSGThresholdCommandImpl& ThresholdCommandImpl);
public:
/**
* The default constructor.
*/
static USGThresholdCommand* NewThresholdCommand(UObject* Outer);
/**
* Create a new instance of ThresholdCommand.
*/
static USGThresholdCommand* NewThresholdCommand(
UObject* Outer,
const TArray<bool>& AffectedFingers, const TArray<float>& ThresholdValues);
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
/**
* The default constructor.
*/
USGThresholdCommand();
/**
* Create a new instance of ThresholdCommand.
*/
USGThresholdCommand(
const TArray<bool>& AffectedFingers, const TArray<float>& ThresholdValues);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGThresholdCommand(const FSGThresholdCommandImpl& ThresholdCommandImpl);
public:
/**
* The destructor.
*/
virtual ~USGThresholdCommand() override;
protected:
/**
* Allows to set the underlying object after construction.
*/
void SetThresholdCommandImpl(const FSGThresholdCommandImpl& ThresholdCommandImpl);
public:
/**
* The cast to underlying type method.
*/
const FSGThresholdCommandImpl& ToThresholdCommandImpl() const;
public:
/**
* Retrieve the threshold of a particular finger.
*
* @param Finger
*/
float GetThreshold(int32 Finger) const;
/**
* Activates the threshold for a finger at a particular value.
*
* @param Finger
* @param ThresholdValue
*/
void SetThreshold(int32 Finger, float ThresholdValue);
TArray<float> GetThresholds() const;
/**
* Activates the threshold for a finger at a particular value.
*
* @param AffectedFingers
* @param ThresholdValues
*/
void SetThresholds(const TArray<bool>& AffectedFingers, const TArray<float>& ThresholdValues);
/**
* If true, the threshold on a finger should be active.
*
* @param Finger
*/
bool GetFingerActive(int32 Finger) const;
TArray<bool> GetActiveFingers() const;
/**
* Deactivates Threshold Mode for a particular finger.
*
* @param Finger
*/
void ClearThreshold(int32 Finger);
/**
* Disables Threshold mode for all fingers. Clears the ActiveFingers, but keeps the Thresholds value for now, in
* case you want to re-apply them later.
*/
void ClearThresholds();
public:
/**
* Returns true if both values are exactly equal.
*/
bool Equals(const USGThresholdCommand* ThresholdCommand) const;
public:
/**
* Print the contents of this Threshold Command. If inactive, a '-' is shown.
*/
FString ToString() const;
};
@@ -1,147 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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
*
* Thumper command.
*/
#pragma once
#include "HAL/Platform.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGThumperCommand.generated.h"
class FSGThumperCommandImpl;
/**
*
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGThumperCommand : public UObject
{
GENERATED_BODY()
public:
static USGThumperCommand* NewThumperCommand(UObject* Outer, const FSGThumperCommandImpl& ThumperCommandImpl);
public:
/**
* Empty constructor for inheritance.
*/
static USGThumperCommand* NewThumperCommand(UObject* Outer);
/**
* Create a new Thumper Command.
*/
static USGThumperCommand* NewThumperCommand(UObject* Outer, int32 Magnitude);
public:
/**
* A command that turns off all force feedback on the Sense Glove.
*/
static USGThumperCommand* Off(UObject* Outer);
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
/**
* Empty constructor for inheritance.
*/
USGThumperCommand();
/**
* Create a new Thumper Command.
*/
explicit USGThumperCommand(int32 Magnitude);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGThumperCommand(const FSGThumperCommandImpl& ThumperCommandImpl);
public:
/**
* The destructor.
*/
virtual ~USGThumperCommand() override;
protected:
/**
* Allows to set the underlying object after construction.
*/
void SetThumperCommandImpl(const FSGThumperCommandImpl& ThumperCommandImpl);
public:
/**
* The cast to underlying type method.
*/
const FSGThumperCommandImpl& ToThumperCommandImpl() const;
public:
/**
* Thumper intensity, a level between 0 and 100.
*/
int32 GetMagnitude() const;
/**
*
*/
void SetMagnitude(int32 Magnitude);
public:
/**
* Duplicate the Thumper command.
*/
USGThumperCommand* Copy(UObject* Outer) const;
/**
* Merge two ThumperCommands into one.
*/
USGThumperCommand* Merge(UObject* Outer, const USGThumperCommand* ThumperCommand) const;
/**
*
*/
bool Equals(const USGThumperCommand* ThumperCommand) const;
};
@@ -1,177 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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
*
* Buzz Motor with timing parameters.
*/
#pragma once
#include "HAL/Platform.h"
#include "Templates/SharedPointer.h"
#include "UObject/ObjectMacros.h"
#include "SGTimedBuzzCommand.generated.h"
class FSGTimedBuzzCommandImpl;
class USGBuzzCommand;
/**
* Buzz motor commands that is meant to stop after a few milliseconds.
*
* @remarks Intended use; this.levels indicates the actual command.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGTimedBuzzCommand : public USGBuzzCommand
{
GENERATED_BODY()
public:
static USGTimedBuzzCommand* NewTimedBuzzCommand(
UObject* Outer, const FSGTimedBuzzCommandImpl& TimedBuzzCommandImpl);
static USGTimedBuzzCommand* NewTimedBuzzCommand(
UObject* Outer, TSharedRef<FSGTimedBuzzCommandImpl> TimedBuzzCommandImpl);
public:
/**
* Empty constructor for inheritance.
*/
static USGTimedBuzzCommand* NewTimedBuzzCommand(UObject* Outer);
/**
* Create a new TimeBuzzCommand for a single finger.
*/
static USGTimedBuzzCommand* NewTimedBuzzCommand(
UObject* Outer,
ESGFinger Finger, int32 Magnitude, float DurationSeconds, float StartTimeSeconds = 0.0f);
/**
* Create a new buzz motor command that expires after timing_ms.
*/
static USGTimedBuzzCommand* NewTimedBuzzCommand(
UObject* Outer,
const USGBuzzCommand* BaseCommand, float DurationSeconds, float StartTimeSeconds = 0.0f);
public:
/**
* Empty constructor for inheritance.
*/
USGTimedBuzzCommand();
/**
* Create a new TimeBuzzCommand for a single finger.
*/
USGTimedBuzzCommand(ESGFinger Finger, int32 Magnitude, float DurationSeconds, float StartTimeSeconds = 0.0f);
/**
* Create a new buzz motor command that expires after timing_ms.
*/
USGTimedBuzzCommand(const USGBuzzCommand* BaseCommand, float DurationSeconds, float StartTimeSeconds = 0.0f);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGTimedBuzzCommand(const FSGTimedBuzzCommandImpl& TimedBuzzCommandImpl);
protected:
/**
* The cast from underlying pointer type constructor.
*/
explicit USGTimedBuzzCommand(TSharedRef<FSGTimedBuzzCommandImpl> TimedBuzzCommandImpl);
public:
/**
* The destructor.
*/
virtual ~USGTimedBuzzCommand() override;
public:
/**
* The cast to underlying type method.
*/
TSharedRef<FSGTimedBuzzCommandImpl> ToTimedBuzzCommandImpl() const;
public:
/**
* Copy this Buzz Command's values into a new object.
*/
USGBuzzCommand* Copy(UObject* Outer) const;
/**
* Merges this base command with another command.
*/
USGBuzzCommand* Merge(UObject* Outer, const USGBuzzCommand* BuzzCommand) const;
public:
/**
* Access the base command, which indicates the buzz levels to keep untill time elapses.
*/
USGBuzzCommand* GetBaseCommand(UObject* Outer) const;
/**
* The total time [milliseconds] each buzz motor should be vibrating for.
*/
float GetDuration() const;
/**
* The time elapsed since the command was sent [milliseconds].
*/
float GetElapsedTime() const;
/**
* Check if this timed command's timing has elapsed.
*/
bool HasTimeElapsed() const;
/**
* Represents how far this effect is in its playtime; [0...1], where 0 means at the start, and 1 means at the end.
*
* @param bClamp01 Optional parameter; ensures this value is always between 0 and 1.
*/
float NormalizedTime(bool bClamp01 = true) const;
/**
* Reset the timings of this BuzzCommand, allowing us to re-use it.
*/
void ResetTiming();
/**
* Update the elapsed time to check if the buzz motors should stop.
*/
void UpdateTiming(float DeltaSeconds);
/**
*
*/
FString ToString() const;
};
@@ -1,172 +0,0 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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 "HAL/Platform.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGTimedThumpCommand.generated.h"
class FSGTimedThumpCommandImpl;
class USGThumperCommand;
/**
*
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGTimedThumpCommand final : public UObject
{
GENERATED_BODY()
public:
static USGTimedThumpCommand* NewTimedThumpCommand(
UObject* Outer, const FSGTimedThumpCommandImpl& TimedThumpCommandImpl);
public:
/**
* Internal, empty, for extended classes.
*/
static USGTimedThumpCommand* NewTimedThumpCommand(UObject* Outer);
/**
* Create a new Timed Thumper Command.
*/
static USGTimedThumpCommand* NewTimedThumpCommand(
UObject* Outer, int32 Magnitude, float DurationSeconds, float StartTimeSeconds = 0.0f);
/**
* Create a new Timed Thumper Command.
*/
static USGTimedThumpCommand* NewTimedThumpCommand(
UObject* Outer, const USGThumperCommand* BaseCommand, float DurationSeconds, float StartTimeSeconds = 0.0f);
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
/**
* Internal, empty, for extended classes.
*/
USGTimedThumpCommand();
/**
* Create a new Timed Thumper Command.
*/
USGTimedThumpCommand(int32 Magnitude, float DurationSeconds, float StartTimeSeconds = 0.0f);
/**
* Create a new Timed Thumper Command.
*/
USGTimedThumpCommand(const USGThumperCommand* BaseCommand, float DurationSeconds, float StartTimeSeconds = 0.0f);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGTimedThumpCommand(const FSGTimedThumpCommandImpl& TimedThumpCommandImpl);
public:
/**
* The destructor.
*/
virtual ~USGTimedThumpCommand() override;
protected:
/**
* Allows to set the underlying object after construction.
*/
void SetTimedThumpCommandImpl(const FSGTimedThumpCommandImpl& TimedThumpCommandImpl);
public:
/**
* The cast to underlying type method.
*/
const FSGTimedThumpCommandImpl& ToTimedThumpCommandImpl() const;
public:
/**
* Magnitude in %.
*/
int32 GetMagnitude() const;
/**
* Duration in seconds.
*/
float GetDuration() const;
/**
* The elapsed time so far.
*/
float GetElapsedTime() const;
public:
/**
* Returns true if the timed command has elapsed.
*/
bool HasTimeElapsed() const;
public:
/**
* Copy the parameters of this ThumperCommand into another instance.
*/
USGTimedThumpCommand* Copy(UObject* Outer, bool bCopyElapsed = true) const;
/**
* Update the timing on this Thumper Command.
*/
void Update(float DeltaSeconds);
/**
*
*/
bool Equals(const USGTimedThumpCommand* TimedThumpCommand) const;
public:
/**
*
*/
FString ToString() const;
};
+287 -13
View File
@@ -101,6 +101,7 @@ public:
/**
* Get the position and rotation offsets to go from the glove origin to the mounted position.
*
* @remarks Based on CAD. needs to be inverted when going from tracker to glove origin.
*/
static void GetSenseGloveMountOffset(bool bRightHanded, ESGFinger ToFinger,
@@ -108,19 +109,22 @@ public:
/**
* Get the position and rotation offsets to go from the glove origin to the mounted position.
*
* @remarks Based on CAD. needs to be inverted when going from tracker to glove origin.
*/
static void GetSenseGloveMountOffset(bool bRightHanded, ESGFinger ToFinger,
FVector& OutIPosition, FRotator& OutIRotation);
/**
* Get the offset to get from the TrackedHardware to a SenseGlove mounting location. Combined with Glove-Mount offset to get the glove location.
* Get the offset to get from the TrackedHardware to a SenseGlove mounting location. Combined with Glove-Mount
* offset to get the glove location.
*/
static void GetSenseGloveTrackerMountOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded,
FVector& OutPositionOffset, FQuat& OutRotationOffset);
/**
* Get the offset to get from the TrackedHardware to a SenseGlove mounting location. Combined with Glove-Mount offset to get the glove location.
* Get the offset to get from the TrackedHardware to a SenseGlove mounting location. Combined with Glove-Mount
* offset to get the glove location.
*/
static void GetSenseGloveTrackerMountOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded,
FVector& OutPositionOffset, FRotator& OutRotationOffset);
@@ -170,16 +174,6 @@ public:
*/
static FRotator GetNovaToWristRotationOffset();
/**
* Returns the Offsets that will bring us from the Nova origin to the wrist position.
*/
static void GetNovaGloveWristOffset(bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset);
/**
* Returns the Offsets that will bring us from the Nova origin to the wrist position.
*/
static void GetNovaGloveWristOffset(bool bRightHanded, FVector& OutPositionOffset, FRotator& OutRotationOffset);
/**
*
*/
@@ -265,20 +259,300 @@ public:
*/
static FRotator GetLeftNovaPico2ToAttachRotation();
/**
*
*/
static FVector GetRightNovaQuestProToAttachPosition();
/**
*
*/
static FQuat GetRightNovaQuestProToAttachRotationQ();
/**
*
*/
static FRotator GetRightNovaQuestProToAttachRotation();
/**
*
*/
static FVector GetLeftNovaQuestProToAttachPosition();
/**
*
*/
static FQuat GetLeftNovaQuestProToAttachRotationQ();
/**
*
*/
static FRotator GetLeftNovaQuestProToAttachRotation();
/**
*
*/
static FVector GetRightNovaViveFocus3ToAttachPosition();
/**
*
*/
static FQuat GetRightNovaViveFocus3ToAttachRotationQ();
/**
*
*/
static FRotator GetRightNovaViveFocus3ToAttachRotation();
/**
*
*/
static FVector GetLeftNovaViveFocus3ToAttachPosition();
/**
*
*/
static FQuat GetLeftNovaViveFocus3ToAttachRotationQ();
/**
*
*/
static FRotator GetLeftNovaViveFocus3ToAttachRotation();
/**
* Returns the Offsets that will bring us from the Nova origin to the wrist position.
*/
static void GetNovaGloveWristOffset(bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset);
/**
* Returns the Offsets that will bring us from the Nova origin to the wrist position.
*/
static void GetNovaGloveWristOffset(bool bRightHanded, FVector& OutPositionOffset, FRotator& OutRotationOffset);
/**
* Retrieves Offsets for a particular device.
*
* @param Hardware
* @param bRightHanded
* @param OutPositionOffset
* @param OutRotationOffset
*/
static void GetNovaGloveTrackerOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded,
FVector& OutPositionOffset, FQuat& OutRotationOffset);
/**
* Retrieves Offsets for a particular device.
*
* @param Hardware
* @param bRightHanded
* @param OutPositionOffset
* @param OutRotationOffset
*/
static void GetNovaGloveTrackerOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded,
FVector& OutPositionOffset, FRotator& OutRotationOffset);
/**
*
*/
static FVector GetRightNova2ToWristPositionOffset();
/**
*
*/
static FQuat GetRightNova2ToWristRotationOffsetQ();
/**
*
*/
static FRotator GetRightNova2ToWristRotationOffset();
/**
*
*/
static FVector GetLeftNova2ToWristPositionOffset();
/**
*
*/
static FQuat GetLeftNova2ToWristRotationOffsetQ();
/**
*
*/
static FRotator GetLeftNova2ToWristRotationOffset();
/**
*
*/
static FVector GetRightNova2Quest2ToAttachPosition();
/**
*
*/
static FQuat GetRightNova2Quest2ToAttachRotationQ();
/**
*
*/
static FRotator GetRightNova2Quest2ToAttachRotation();
/**
*
*/
static FVector GetLeftNova2Quest2ToAttachPosition();
/**
*
*/
static FQuat GetLeftNova2Quest2ToAttachRotationQ();
/**
*
*/
static FRotator GetLeftNova2Quest2ToAttachRotation();
/**
*
*/
static FVector GetRightNova2QuestProToAttachPosition();
/**
*
*/
static FQuat GetRightNova2QuestProToAttachRotationQ();
/**
*
*/
static FRotator GetRightNova2QuestProToAttachRotation();
/**
*
*/
static FVector GetLeftNova2QuestProToAttachPosition();
/**
*
*/
static FQuat GetLeftNova2QuestProToAttachRotationQ();
/**
*
*/
static FRotator GetLeftNova2QuestProToAttachRotation();
/**
*
*/
static FVector GetRightNova2ViveTrackerToAttachPosition();
/**
*
*/
static FQuat GetRightNova2ViveTrackerToAttachRotationQ();
/**
*
*/
static FRotator GetRightNova2ViveTrackerToAttachRotation();
/**
*
*/
static FVector GetLeftNova2ViveTrackerToAttachPosition();
/**
*
*/
static FQuat GetLeftNova2ViveTrackerToAttachRotationQ();
/**
*
*/
static FRotator GetLeftNova2ViveTrackerToAttachRotation();
/**
*
*/
static FVector GetRightNova2ViveWristTrackerToAttachPosition();
/**
*
*/
static FQuat GetRightNova2ViveWristTrackerToAttachRotationQ();
/**
*
*/
static FRotator GetRightNova2ViveWristTrackerToAttachRotation();
/**
*
*/
static FVector GetLeftNova2ViveWristTrackerToAttachPosition();
/**
*
*/
static FQuat GetLeftNova2ViveWristTrackerToAttachRotationQ();
/**
*
*/
static FRotator GetLeftNova2ViveWristTrackerToAttachRotation();
/**
* Returns the Offsets that will bring us from the Nova origin to the wrist position.
*
* @param bRightHanded
* @param HardwareVersion
* @param OutPositionOffset
* @param OutRotationOffset
*/
static void GetNova2GloveWristOffset(bool bRightHanded, const FString& HardwareVersion,
FVector& OutPositionOffset, FQuat& OutRotationOffset);
/**
* Returns the Offsets that will bring us from the Nova origin to the wrist position.
*
* @param bRightHanded
* @param HardwareVersion
* @param OutPositionOffset
* @param OutRotationOffset
*/
static void GetNova2GloveWristOffset(bool bRightHanded, const FString& HardwareVersion,
FVector& OutPositionOffset, FRotator& OutRotationOffset);
/**
* Retrieves Offsets for a particular device.
*
* @param Hardware
* @param bRightHanded
* @param HardwareVersion
* @param OutPositionOffset
* @param OutRotationOffset
*/
static void GetNova2GloveTrackerOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded,
const FString& HardwareVersion,
FVector& OutPositionOffset, FQuat& OutRotationOffset);
/**
* Retrieves Offsets for a particular device.
*
* @param Hardware
* @param bRightHanded
* @param HardwareVersion
* @param OutPositionOffset
* @param OutRotationOffset
*/
static void GetNova2GloveTrackerOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded,
const FString& HardwareVersion,
FVector& OutPositionOffset, FRotator& OutRotationOffset);
/**
*
*/
static FString ToString(ESGPositionalTrackingHardware Hardware);
};
};