implement the nova2 api updates and bump the senseglove libraries to v2.101.0-3e1693fb
This commit is contained in:
@@ -64,6 +64,8 @@ public:
|
||||
|
||||
static float GetThumbJointLimit(bool bRightHanded, int32 Joint, int32 Movement, bool bMax);
|
||||
|
||||
static float ClampJointAngle(float Value, int32 Finger, bool bRightHand, int32 Joint, int32 Movement);
|
||||
|
||||
static float NormalizeFingerFlexion(float FlexionInDegrees);
|
||||
|
||||
static float NormalizeThumbFlexion(float FlexionInDegrees);
|
||||
|
||||
@@ -160,7 +160,7 @@ public:
|
||||
FString GetLastCommand() const;
|
||||
|
||||
public:
|
||||
bool SendHaptics(const FString& Command) const;
|
||||
bool SendHaptics(const FString& Command, int32 Channel = 0) const;
|
||||
|
||||
public:
|
||||
virtual FString ToString() const override;
|
||||
|
||||
@@ -1,148 +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/SharedPointer.h"
|
||||
#include "Templates/UniquePtr.h"
|
||||
|
||||
#include "SGBuildHacks/SGPlatform.h"
|
||||
#include "SGCoreImpl/SGFingerCommandImpl.h"
|
||||
#include "SGTypes/SGCoreTypes.h"
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
namespace Haptics
|
||||
{
|
||||
class BuzzCommand;
|
||||
}
|
||||
}
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGBuzzCommandImpl : public FSGFingerCommandImpl
|
||||
{
|
||||
public:
|
||||
typedef SGCore::Haptics::BuzzCommand FBuzzCommandType;
|
||||
|
||||
public:
|
||||
static const FSGBuzzCommandImpl& Off();
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
|
||||
struct FImplDeleter
|
||||
{
|
||||
void operator()(const FImpl* P) const;
|
||||
};
|
||||
|
||||
TUniquePtr<FImpl, FImplDeleter> Pimpl;
|
||||
FImplDeleter PimplDeleter;
|
||||
|
||||
public:
|
||||
FSGBuzzCommandImpl();
|
||||
|
||||
public:
|
||||
explicit FSGBuzzCommandImpl(const TArray<int32>& BuzzLevels);
|
||||
|
||||
FSGBuzzCommandImpl(int32 Thumb, int32 Index, int32 Middle, int32 Ring, int32 Pinky);
|
||||
|
||||
FSGBuzzCommandImpl(ESGFinger Finger, int32 BuzzLevel);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast from underlying type constructor.
|
||||
*/
|
||||
explicit FSGBuzzCommandImpl(const FBuzzCommandType& BuzzCommand);
|
||||
|
||||
/**
|
||||
* The cast from underlying pointer type constructor.
|
||||
*/
|
||||
explicit FSGBuzzCommandImpl(TSharedRef<FBuzzCommandType> BuzzCommand);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy constructor.
|
||||
*/
|
||||
FSGBuzzCommandImpl(const FSGBuzzCommandImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move constructor
|
||||
*/
|
||||
FSGBuzzCommandImpl(FSGBuzzCommandImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The destructor.
|
||||
*/
|
||||
virtual ~FSGBuzzCommandImpl() override;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy assignment operator.
|
||||
*/
|
||||
FSGBuzzCommandImpl& operator=(const FSGBuzzCommandImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move assignment operator.
|
||||
*/
|
||||
FSGBuzzCommandImpl& operator=(FSGBuzzCommandImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
const FBuzzCommandType& ToBuzzCommand() const;
|
||||
|
||||
/**
|
||||
* The cast to underlying pointer type method.
|
||||
*/
|
||||
TSharedRef<FBuzzCommandType> ToBuzzCommandRef() const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The non-const cast to underlying type method.
|
||||
*/
|
||||
FBuzzCommandType& ToBuzzCommand();
|
||||
|
||||
/**
|
||||
* The non-const cast to underlying pointer type method.
|
||||
*/
|
||||
TSharedRef<FBuzzCommandType> ToBuzzCommandRef();
|
||||
|
||||
public:
|
||||
virtual FSGBuzzCommandImpl Copy() const;
|
||||
|
||||
virtual FSGBuzzCommandImpl Merge(const FSGBuzzCommandImpl& Command) const;
|
||||
};
|
||||
+58
-46
@@ -36,46 +36,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "Containers/UnrealString.h"
|
||||
#include "Templates/UniquePtr.h"
|
||||
|
||||
#include "SGBuildHacks/SGPlatform.h"
|
||||
|
||||
class FSGHandInterpolatorImpl;
|
||||
#include "SGTypes/SGCoreTypes.h"
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
class HandProfile;
|
||||
class CustomWaveform;
|
||||
}
|
||||
|
||||
class FSGNovaGloveHandProfileImpl;
|
||||
class FSGSenseGloveHandProfileImpl;
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGHandProfileImpl final
|
||||
class SENSEGLOVECOREIMPL_API FSGCustomWaveformImpl final
|
||||
{
|
||||
public:
|
||||
typedef SGCore::HandProfile FHandProfileType;
|
||||
typedef SGCore::CustomWaveform FCustomWaveformType;
|
||||
|
||||
public:
|
||||
static FSGHandProfileImpl Default(bool bRightHanded);
|
||||
|
||||
static FSGHandProfileImpl Deserialize(const FString& SerializedString);
|
||||
|
||||
public:
|
||||
static const FString& GetProfileDirectory();
|
||||
|
||||
static const FString& GetLeftHandFileName();
|
||||
|
||||
static const FString& GetRightHandFileName();
|
||||
|
||||
static const FString& GetProfileFileName(bool bRightHanded);
|
||||
|
||||
static bool GetLatestProfile(bool bRightHanded, FSGHandProfileImpl& OutLatestProfile);
|
||||
|
||||
static bool StoreProfile(const FSGHandProfileImpl& ProfileToStore);
|
||||
|
||||
static bool ResetCalibration(bool bRightHanded, bool bOnDisk = true);
|
||||
|
||||
static void ResetCalibration(bool bOnDisk = true);
|
||||
static FString ToString(ESGWaveformType Type);
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
@@ -89,64 +65,100 @@ private:
|
||||
FImplDeleter PimplDeleter;
|
||||
|
||||
public:
|
||||
FSGHandProfileImpl();
|
||||
FSGCustomWaveformImpl();
|
||||
|
||||
FSGHandProfileImpl(bool bRightHanded,
|
||||
const FSGSenseGloveHandProfileImpl& SenseGloveHandProfile,
|
||||
const FSGNovaGloveHandProfileImpl& NovaGloveHandProfile);
|
||||
FSGCustomWaveformImpl(float Amplitude, float Duration);
|
||||
|
||||
FSGCustomWaveformImpl(float Amplitude, float Duration, float Frequency);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast from underlying type constructor.
|
||||
*/
|
||||
explicit FSGHandProfileImpl(const FHandProfileType& SenseGloveHandProfile);
|
||||
explicit FSGCustomWaveformImpl(const FCustomWaveformType& CustomWaveform);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy constructor.
|
||||
*/
|
||||
FSGHandProfileImpl(const FSGHandProfileImpl& Rhs);
|
||||
FSGCustomWaveformImpl(const FSGCustomWaveformImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move constructor.
|
||||
*/
|
||||
FSGHandProfileImpl(FSGHandProfileImpl&& Rhs) SG_NOEXCEPT;
|
||||
FSGCustomWaveformImpl(FSGCustomWaveformImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The destructor.
|
||||
*/
|
||||
virtual ~FSGHandProfileImpl();
|
||||
virtual ~FSGCustomWaveformImpl();
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy assignment operator.
|
||||
*/
|
||||
FSGHandProfileImpl& operator=(const FSGHandProfileImpl& Rhs);
|
||||
FSGCustomWaveformImpl& operator=(const FSGCustomWaveformImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move assignment operator.
|
||||
*/
|
||||
FSGHandProfileImpl& operator=(FSGHandProfileImpl&& Rhs) SG_NOEXCEPT;
|
||||
FSGCustomWaveformImpl& operator=(FSGCustomWaveformImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
const FHandProfileType& ToHandProfile() const;
|
||||
const FCustomWaveformType& ToCustomWaveform() const;
|
||||
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
FCustomWaveformType& ToCustomWaveform();
|
||||
|
||||
public:
|
||||
bool IsRight() const;
|
||||
float GetAmplitude() const;
|
||||
void SetAmplitude(float Amplitude);
|
||||
|
||||
FSGSenseGloveHandProfileImpl GetSenseGloveHandProfile() const;
|
||||
ESGWaveformType GetWaveType() const;
|
||||
void SetWaveType(ESGWaveformType Type);
|
||||
|
||||
FSGNovaGloveHandProfileImpl GetNovaGloveHandProfile() const;
|
||||
bool IsInfinite() const;
|
||||
void SetInfinite(bool bInfinite);
|
||||
|
||||
int32 GetRepeatAmount() const;
|
||||
void SetRepeatAmount(int32 Amount);
|
||||
|
||||
float GetAttackTime() const;
|
||||
void SetAttackTime(float Time);
|
||||
|
||||
float GetSustainTime() const;
|
||||
void SetSustainTime(float Time);
|
||||
|
||||
float GetDecayTime() const;
|
||||
void SetDecayTime(float Time);
|
||||
|
||||
float GetFrequencyStart() const;
|
||||
void SetFrequencyStart(float Frequency);
|
||||
|
||||
float GetFrequencyEnd() const;
|
||||
void SetFrequencyEnd(float Frequency);
|
||||
|
||||
float GetFrequencySwitchTime() const;
|
||||
void SetFrequencySwitchTime(float Time);
|
||||
|
||||
float GetFrequencySwitchFactor() const;
|
||||
void SetFrequencySwitchFactor(float Factor);
|
||||
|
||||
public:
|
||||
bool Equals(const FSGHandProfileImpl& HandProfileImpl) const;
|
||||
float GetEffectTime() const;
|
||||
float GetTotalEffectTime() const;
|
||||
|
||||
void Reset();
|
||||
bool FrequencyJumps() const;
|
||||
|
||||
public:
|
||||
FString Serialize() const;
|
||||
bool Equals(const FSGCustomWaveformImpl& CustomWaveformImpl) const;
|
||||
|
||||
public:
|
||||
FString ToString() const;
|
||||
};
|
||||
@@ -50,7 +50,9 @@ namespace SGCore
|
||||
}
|
||||
|
||||
class FSGBetaDeviceImpl;
|
||||
class FSGHapticChannelInfoImpl;
|
||||
class FSGHapticGloveImpl;
|
||||
class FSGNova2GloveImpl;
|
||||
class FSGNovaGloveImpl;
|
||||
class FSGSenseGloveImpl;
|
||||
|
||||
@@ -65,6 +67,13 @@ public:
|
||||
public:
|
||||
static void ParseFirmware(const FString& RawFirmware, int32& OutMainVersion, int32& OutSubVersion);
|
||||
|
||||
static bool FirmwareNewerThan(int32 MyFirmwareMain, int32 MyFirmwareSub,
|
||||
int32 ReferenceMain, int32 ReferenceSub,
|
||||
bool bInclusive);
|
||||
static bool FirmwareOlderThan(int32 MyFirmwareMain, int32 MyFirmwareSub,
|
||||
int32 ReferenceMain, int32 ReferenceSub,
|
||||
bool bInclusive);
|
||||
|
||||
static FString ToString(ESGDeviceType DeviceType);
|
||||
|
||||
private:
|
||||
@@ -142,6 +151,11 @@ public:
|
||||
*/
|
||||
TSharedRef<FSGHapticGloveImpl> ToHapticGloveImplRef();
|
||||
|
||||
/**
|
||||
* The cast to derived TSharedRef<FSGNova2GloveImpl> type method.
|
||||
*/
|
||||
TSharedRef<FSGNova2GloveImpl> ToNova2GloveImplRef();
|
||||
|
||||
/**
|
||||
* The cast to derived TSharedRef<FSGNovaGloveImpl> type method.
|
||||
*/
|
||||
@@ -162,6 +176,9 @@ public:
|
||||
virtual int32 GetSubFirmwareVersion() const;
|
||||
virtual FString GetFirmwareString() const;
|
||||
|
||||
bool FirmwareNewerThan(int32 FirmwareMain, int32 FirmwareSub, bool bInclusive) const;
|
||||
bool FirmwareOlderThan(int32 FirmwareMain, int32 FirmwareSub, bool bInclusive) const;
|
||||
|
||||
FString GetAddress() const;
|
||||
|
||||
bool IsConnected() const;
|
||||
@@ -171,7 +188,7 @@ public:
|
||||
int32 PacketsPerSecondSent() const;
|
||||
|
||||
int32 GetDeviceIndex() const;
|
||||
void SetDeviceIndex(int32 NewIndex);
|
||||
virtual void SetDeviceIndex(int32 NewIndex);
|
||||
|
||||
virtual bool IsWireless() const;
|
||||
|
||||
@@ -179,5 +196,12 @@ public:
|
||||
virtual bool IsCharging();
|
||||
virtual bool GetBatteryLevel(float& OutLevel);
|
||||
|
||||
public:
|
||||
virtual void SetHapticChannels(const FSGHapticChannelInfoImpl& Channels);
|
||||
|
||||
int32 GetHapticChannelCount() const;
|
||||
int32 GetHapticChannelCount(ESGHapticChannelType ChannelType) const;
|
||||
|
||||
public:
|
||||
virtual FString ToString() const;
|
||||
};
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
|
||||
static bool GetSensorDataString(int32 IpcIndex, const FString& IpcAddress, FString& OutString);
|
||||
|
||||
static bool SendHaptics(int32 IpcIndex, const FString& IpcAddress, const FString& Commands);
|
||||
static bool SendHaptics(int32 IpcIndex, const FString& IpcAddress, int32 ChannelIndex, const FString& Commands);
|
||||
|
||||
static FString GetDeviceStringAt(int32 IpcIndex, const FString& IpcAddress, int32 Index);
|
||||
|
||||
|
||||
@@ -120,4 +120,8 @@ public:
|
||||
int32 GetFirmwareVersion() const;
|
||||
|
||||
int32 GetSubFirmwareVersion() const;
|
||||
|
||||
public:
|
||||
bool FirmwareNewerThan(int32 FirmwareMain, int32 FirmwareSub, bool bInclusive) const;
|
||||
bool FirmwareOlderThan(int32 FirmwareMain, int32 FirmwareSub, bool bInclusive) const;
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,169 +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/SharedPointer.h"
|
||||
#include "Templates/UniquePtr.h"
|
||||
|
||||
#include "SGBuildHacks/SGPlatform.h"
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
namespace Haptics
|
||||
{
|
||||
class FingerCommand;
|
||||
}
|
||||
}
|
||||
|
||||
class FSGBuzzCommandImpl;
|
||||
class FSGForceFeedbackCommandImpl;
|
||||
class FSGTimedBuzzCommandImpl;
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGFingerCommandImpl : public TSharedFromThis<FSGFingerCommandImpl>
|
||||
{
|
||||
public:
|
||||
typedef SGCore::Haptics::FingerCommand FFingerCommandType;
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
|
||||
struct FImplDeleter
|
||||
{
|
||||
void operator()(const FImpl* P) const;
|
||||
};
|
||||
|
||||
TUniquePtr<FImpl, FImplDeleter> Pimpl;
|
||||
FImplDeleter PimplDeleter;
|
||||
|
||||
public:
|
||||
FSGFingerCommandImpl();
|
||||
|
||||
explicit FSGFingerCommandImpl(const TArray<int32>& Levels);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast from underlying type constructor.
|
||||
*/
|
||||
explicit FSGFingerCommandImpl(const FFingerCommandType& FingerCommand);
|
||||
|
||||
/**
|
||||
* The cast from underlying pointer type constructor.
|
||||
*/
|
||||
explicit FSGFingerCommandImpl(TSharedRef<FFingerCommandType> FingerCommand);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy constructor.
|
||||
*/
|
||||
FSGFingerCommandImpl(const FSGFingerCommandImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move constructor
|
||||
*/
|
||||
FSGFingerCommandImpl(FSGFingerCommandImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The destructor.
|
||||
*/
|
||||
virtual ~FSGFingerCommandImpl();
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy assignment operator.
|
||||
*/
|
||||
FSGFingerCommandImpl& operator=(const FSGFingerCommandImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move assignment operator.
|
||||
*/
|
||||
FSGFingerCommandImpl& operator=(FSGFingerCommandImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
const FFingerCommandType& ToFingerCommand() const;
|
||||
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
TSharedRef<FFingerCommandType> ToFingerCommandRef() const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The non-const cast to underlying type method.
|
||||
*/
|
||||
FFingerCommandType& ToFingerCommand();
|
||||
|
||||
/**
|
||||
* The non-const cast to underlying type method.
|
||||
*/
|
||||
TSharedRef<FFingerCommandType> ToFingerCommandRef();
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to base TSharedRef<FSGFingerCommandImpl> type method.
|
||||
*/
|
||||
TSharedRef<FSGFingerCommandImpl> ToFingerCommandImplRef();
|
||||
|
||||
/**
|
||||
* The cast to derived TSharedRef<FSGBuzzCommandImpl> type method.
|
||||
*/
|
||||
TSharedRef<FSGBuzzCommandImpl> ToBuzzCommandImplRef();
|
||||
|
||||
/**
|
||||
* The cast to derived TSharedRef<FSGForceFeedbackCommandImpl> type method.
|
||||
*/
|
||||
TSharedRef<FSGForceFeedbackCommandImpl> ToForceFeedbackCommandImplRef();
|
||||
|
||||
/**
|
||||
* The cast to derived TSharedRef<FSGTimedBuzzCommandImpl> type method.
|
||||
*/
|
||||
TSharedRef<FSGTimedBuzzCommandImpl> ToTimedBuzzCommandImplRef();
|
||||
|
||||
public:
|
||||
virtual TArray<int32> GetLevels() const;
|
||||
|
||||
virtual int32 GetLevel(int32 Finger) const;
|
||||
virtual void SetLevel(int32 Finger, int32 Value);
|
||||
|
||||
virtual bool Equals(const FSGFingerCommandImpl& FingerCommandImpl) const;
|
||||
|
||||
virtual FString ToString() const;
|
||||
};
|
||||
@@ -1,137 +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/SharedPointer.h"
|
||||
#include "Templates/UniquePtr.h"
|
||||
|
||||
#include "SGBuildHacks/SGPlatform.h"
|
||||
#include "SGCoreImpl/SGFingerCommandImpl.h"
|
||||
#include "SGTypes/SGCoreTypes.h"
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
namespace Haptics
|
||||
{
|
||||
class ForceFeedbackCommand;
|
||||
}
|
||||
}
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGForceFeedbackCommandImpl final : public FSGFingerCommandImpl
|
||||
{
|
||||
public:
|
||||
typedef SGCore::Haptics::ForceFeedbackCommand FForceFeedbackCommandType;
|
||||
|
||||
public:
|
||||
static const FSGForceFeedbackCommandImpl& Off();
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
|
||||
struct FImplDeleter
|
||||
{
|
||||
void operator()(const FImpl* P) const;
|
||||
};
|
||||
|
||||
TUniquePtr<FImpl, FImplDeleter> Pimpl;
|
||||
FImplDeleter PimplDeleter;
|
||||
|
||||
public:
|
||||
FSGForceFeedbackCommandImpl();
|
||||
|
||||
public:
|
||||
explicit FSGForceFeedbackCommandImpl(const TArray<int32>& ForceFeedbackLevels);
|
||||
|
||||
FSGForceFeedbackCommandImpl(int32 Thumb, int32 Index, int32 Middle, int32 Ring, int32 Pinky);
|
||||
|
||||
FSGForceFeedbackCommandImpl(ESGFinger Finger, int32 BuzzLevel);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast from underlying type constructor.
|
||||
*/
|
||||
explicit FSGForceFeedbackCommandImpl(const FForceFeedbackCommandType& ForceFeedbackCommand);
|
||||
|
||||
/**
|
||||
* The cast from underlying pointer type constructor.
|
||||
*/
|
||||
explicit FSGForceFeedbackCommandImpl(TSharedRef<FForceFeedbackCommandType> ForceFeedbackCommand);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy constructor.
|
||||
*/
|
||||
FSGForceFeedbackCommandImpl(const FSGForceFeedbackCommandImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move constructor
|
||||
*/
|
||||
FSGForceFeedbackCommandImpl(FSGForceFeedbackCommandImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The destructor.
|
||||
*/
|
||||
virtual ~FSGForceFeedbackCommandImpl() override;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy assignment operator.
|
||||
*/
|
||||
FSGForceFeedbackCommandImpl& operator=(const FSGForceFeedbackCommandImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move assignment operator.
|
||||
*/
|
||||
FSGForceFeedbackCommandImpl& operator=(FSGForceFeedbackCommandImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
const FForceFeedbackCommandType& ToForceFeedbackCommand() const;
|
||||
|
||||
/**
|
||||
* The cast to underlying pointer type method.
|
||||
*/
|
||||
TSharedRef<FForceFeedbackCommandType> ToForceFeedbackCommandRef() const;
|
||||
|
||||
public:
|
||||
virtual FSGForceFeedbackCommandImpl Copy() const;
|
||||
|
||||
virtual FSGForceFeedbackCommandImpl Merge(const FSGForceFeedbackCommandImpl& Command) const;
|
||||
};
|
||||
@@ -59,19 +59,7 @@ public:
|
||||
typedef SGCore::Kinematics::HandInterpolator FHandInterpolatorType;
|
||||
|
||||
public:
|
||||
static FSGHandInterpolatorImpl Default(bool bRightHanded);
|
||||
|
||||
static FSGHandInterpolatorImpl Deserialize(const FString& SerializedString);
|
||||
|
||||
public:
|
||||
static TArray<FVector> InterpolateFingerAngles(ESGFinger Finger, const FSGHandInterpolatorImpl& Interpolator,
|
||||
const FVector& TotalGloveAngles);
|
||||
|
||||
static TArray<FVector> InterpolateThumbAngles(const FSGHandInterpolatorImpl& Interpolator,
|
||||
const FVector& TotalGloveAngles);
|
||||
|
||||
static TArray<TArray<FVector>> InterpolateHandAngles(const FSGHandInterpolatorImpl& Interpolator,
|
||||
const TArray<FVector>& TotalAngles);
|
||||
static FSGHandInterpolatorImpl Deserialize(const FString& SerializedString, bool bRightHanded = true);
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
@@ -87,10 +75,7 @@ private:
|
||||
public:
|
||||
FSGHandInterpolatorImpl();
|
||||
|
||||
explicit FSGHandInterpolatorImpl(const TArray<TArray<FSGInterpolationSetImpl>>& JointInterpolations);
|
||||
|
||||
FSGHandInterpolatorImpl(const TArray<TArray<FSGInterpolationSetImpl>>& JointInterpolations,
|
||||
const FQuat& CmcStartRotation);
|
||||
explicit FSGHandInterpolatorImpl(bool bRightHanded);
|
||||
|
||||
public:
|
||||
/**
|
||||
@@ -133,26 +118,13 @@ public:
|
||||
const FHandInterpolatorType& ToHandInterpolator() const;
|
||||
|
||||
public:
|
||||
TArray<TArray<FSGInterpolationSetImpl>> GetJointInterpolations() const;
|
||||
float CalculateAngle(ESGFingerMovement Movement, float Value, bool bApplyLimits = true) const;
|
||||
|
||||
FQuat GetCmcStartRotation() const;
|
||||
float CalculateAngle(ESGThumbMovement Movement, float Value, bool bApplyLimits = true) const;
|
||||
|
||||
public:
|
||||
float CalculateAngle(ESGFinger Finger, int32 Movement, float Value) const;
|
||||
|
||||
float CalculateAngle(ESGFinger Finger, ESGFingerMovement Movement, float Value) const;
|
||||
|
||||
float CalculateAngle(ESGFinger Finger, ESGThumbMovement Movement, float Value) const;
|
||||
|
||||
public:
|
||||
void SetInterpolation(int32 Finger, int32 Movement, float InputAt0, float InputAt1, float AngleAt0, float AngleAt1);
|
||||
|
||||
void SetInterpolation(ESGFinger Finger, ESGFingerMovement Movement,
|
||||
float InputAt0, float InputAt1, float AngleAt0, float AngleAt1);
|
||||
|
||||
void SetInterpolation(ESGThumbMovement Movement, float InputAt0, float InputAt1, float AngleAt0, float AngleAt1);
|
||||
|
||||
FSGInterpolationSetImpl GetInterpolation(int32 Finger, int32 Movement) const;
|
||||
TArray<TArray<FVector>> InterpolateHandAngles(
|
||||
const TArray<TArray<float>>& Flexions, const TArray<float>& Abductions, float CmcTwist);
|
||||
|
||||
public:
|
||||
bool Equals(const FSGHandInterpolatorImpl& HandInterpolatorImpl) const;
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* @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 "HAL/Platform.h"
|
||||
#include "Math/Quat.h"
|
||||
#include "Math/Vector.h"
|
||||
#include "Templates/SharedPointer.h"
|
||||
|
||||
#include "SGTypes/SGCoreTypes.h"
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
class HandLayer;
|
||||
}
|
||||
|
||||
class FSGCustomWaveformImpl;
|
||||
class FSGHandPoseImpl;
|
||||
class FSGHapticGloveImpl;
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGHandLayerImpl final
|
||||
{
|
||||
public:
|
||||
typedef SGCore::HandLayer FHandLayerType;
|
||||
|
||||
public:
|
||||
static bool DeviceConnected(bool bRightHanded);
|
||||
|
||||
static ESGDeviceType GetDeviceType(bool bRightHanded);
|
||||
|
||||
static bool GetFirstGloveHandedness();
|
||||
|
||||
static int32 GlovesConnected();
|
||||
|
||||
static bool GetGloveInstance(bool bRightHanded, TSharedPtr<FSGHapticGloveImpl>& OutGlove);
|
||||
|
||||
static ESGHapticGloveCalibrationState GetCalibrationState(bool bRightHanded);
|
||||
|
||||
static FString GetCalibrationInstructions(bool bRightHanded);
|
||||
|
||||
static void ResetCalibration(bool bRightHanded);
|
||||
|
||||
static void EndCalibration(bool bRightHanded);
|
||||
|
||||
static bool GetHandPose(bool bRightHanded, FSGHandPoseImpl& OutHandPose);
|
||||
|
||||
static void GetWristLocation(
|
||||
bool bRightHanded,
|
||||
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
|
||||
ESGPositionalTrackingHardware TrackingHardware,
|
||||
FVector& OutWristPosition, FQuat& OutWristRotation);
|
||||
|
||||
static bool SendHaptics(bool bRightHanded);
|
||||
|
||||
static void StopAllHaptics(bool bRightHanded);
|
||||
|
||||
static bool QueueCommand_ForceFeedbackLevel(bool bRightHanded, int32 Finger, float Level01, bool bSendImmediate);
|
||||
|
||||
static bool QueueCommand_ForceFeedbackLevels(
|
||||
bool bRightHanded, const TArray<float>& Levels01, bool bSendImmediate);
|
||||
|
||||
static bool QueueCommand_SetVibroLevel(bool bRightHanded, int32 Finger, float Level01, bool bSendImmediate);
|
||||
|
||||
static bool QueueCommand_SetVibroLevels(bool bRightHanded, const TArray<float>& Levels01, bool bSendImmediate);
|
||||
|
||||
static bool SupportsCustomWaveform(bool bRightHanded, ESGHapticLocation AtLocation);
|
||||
|
||||
static bool SendCustomWaveform(bool bRightHanded, FSGCustomWaveformImpl& OutWaveform, ESGHapticLocation Location);
|
||||
|
||||
static bool SupportsWristSqueeze(bool bRightHanded);
|
||||
|
||||
static bool QueueCommand_WristSqueeze(bool bRightHanded, float SqueezeLevel01, bool bSendImmediate);
|
||||
|
||||
static bool SupportsFlexionLocks(bool bRightHanded);
|
||||
|
||||
static bool QueueCommand_FlexionLock(bool bRightHanded, int32 Finger, float Flexion01, bool bSendImmediate);
|
||||
|
||||
static bool QueueCommand_ClearFlexionLock(bool bRightHanded, int32 Finger, bool bSendImmediate);
|
||||
|
||||
public:
|
||||
FSGHandLayerImpl() = delete;
|
||||
virtual ~FSGHandLayerImpl() = delete;
|
||||
};
|
||||
+32
-36
@@ -35,26 +35,31 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Containers/Array.h"
|
||||
#include "Containers/UnrealString.h"
|
||||
#include "HAL/Platform.h"
|
||||
#include "Templates/UniquePtr.h"
|
||||
|
||||
#include "SGBuildHacks/SGPlatform.h"
|
||||
#include "SGTypes/SGCoreTypes.h"
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
namespace Haptics
|
||||
{
|
||||
class TimedThumpCommand;
|
||||
}
|
||||
class HapticChannelInfo;
|
||||
}
|
||||
|
||||
class FSGThumperCommandImpl;
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGTimedThumpCommandImpl final
|
||||
class SENSEGLOVECOREIMPL_API FSGHapticChannelInfoImpl final
|
||||
{
|
||||
public:
|
||||
typedef SGCore::Haptics::TimedThumpCommand FTimedThumpCommandType;
|
||||
typedef SGCore::HapticChannelInfo FHapticChannelInfoType;
|
||||
|
||||
public:
|
||||
static FString GenerateAddress(int32 DeviceIndex, int32 ChannelIndex);
|
||||
|
||||
static FSGHapticChannelInfoImpl Parse(const FString& IpcString);
|
||||
|
||||
public:
|
||||
static int32 GetStreamingType();
|
||||
static int32 GetFireAndForgetType();
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
@@ -68,70 +73,61 @@ private:
|
||||
FImplDeleter PimplDeleter;
|
||||
|
||||
public:
|
||||
FSGTimedThumpCommandImpl();
|
||||
FSGHapticChannelInfoImpl();
|
||||
|
||||
public:
|
||||
FSGTimedThumpCommandImpl(int32 Magnitude, float DurationSeconds, float StartTimeSeconds = 0.0f);
|
||||
|
||||
FSGTimedThumpCommandImpl(const FSGThumperCommandImpl& BaseCommand, float DurationSeconds,
|
||||
float StartTimeSeconds = 0.0f);
|
||||
FSGHapticChannelInfoImpl(const TArray<int32>& StreamIndex, const TArray<int32>& FireAndForgetIndex);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast from underlying type constructor.
|
||||
*/
|
||||
explicit FSGTimedThumpCommandImpl(const FTimedThumpCommandType& TimedThumpCommand);
|
||||
explicit FSGHapticChannelInfoImpl(const FHapticChannelInfoType& HapticChannelInfo);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy constructor.
|
||||
*/
|
||||
FSGTimedThumpCommandImpl(const FSGTimedThumpCommandImpl& Rhs);
|
||||
FSGHapticChannelInfoImpl(const FSGHapticChannelInfoImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move constructor
|
||||
* The move constructor.
|
||||
*/
|
||||
FSGTimedThumpCommandImpl(FSGTimedThumpCommandImpl&& Rhs) SG_NOEXCEPT;
|
||||
FSGHapticChannelInfoImpl(FSGHapticChannelInfoImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The destructor.
|
||||
*/
|
||||
virtual ~FSGTimedThumpCommandImpl();
|
||||
virtual ~FSGHapticChannelInfoImpl();
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy assignment operator.
|
||||
*/
|
||||
FSGTimedThumpCommandImpl& operator=(const FSGTimedThumpCommandImpl& Rhs);
|
||||
FSGHapticChannelInfoImpl& operator=(const FSGHapticChannelInfoImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move assignment operator.
|
||||
*/
|
||||
FSGTimedThumpCommandImpl& operator=(FSGTimedThumpCommandImpl&& Rhs) SG_NOEXCEPT;
|
||||
FSGHapticChannelInfoImpl& operator=(FSGHapticChannelInfoImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
const FTimedThumpCommandType& ToTimedThumpCommand() const;
|
||||
const FHapticChannelInfoType& ToHapticChannelInfo() const;
|
||||
|
||||
public:
|
||||
int32 GetMagnitude() const;
|
||||
int32 GetStreamChannelCount() const;
|
||||
int32 GetFireAndForgetChannelCount() const;
|
||||
int32 GetTotalChannelCount() const;
|
||||
|
||||
float GetDuration() const;
|
||||
FString GetAddress_Unguarded(ESGHapticChannelType Type, int32 TypeIndex) const;
|
||||
|
||||
float GetElapsedTime() const;
|
||||
void GetIpcParams_Unguarded(ESGHapticChannelType Type, int32 TypeIndex,
|
||||
int32& OutIndex, FString& OutAddressString) const;
|
||||
|
||||
bool HasTimeElapsed() const;
|
||||
void RegenerateAddresses(int32 ForDeviceIndex);
|
||||
|
||||
public:
|
||||
virtual FSGTimedThumpCommandImpl Copy(bool bCopyElapsed = true) const;
|
||||
|
||||
virtual void Update(float DeltaSeconds);
|
||||
|
||||
virtual bool Equals(const FSGThumperCommandImpl& SGThumperCommandImpl) const;
|
||||
|
||||
public:
|
||||
virtual FString ToString() const;
|
||||
TArray<FString> GetAllAddresses() const;
|
||||
};
|
||||
@@ -1,150 +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 "SGBuildHacks/SGPlatform.h"
|
||||
#include "SGTypes/SGCoreTypes.h"
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
namespace Calibration
|
||||
{
|
||||
class HapticGloveCalibrationCheck;
|
||||
}
|
||||
}
|
||||
|
||||
class FSGSensorRangeImpl;
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGHapticGloveCalibrationCheckImpl
|
||||
{
|
||||
public:
|
||||
typedef SGCore::Calibration::HapticGloveCalibrationCheck FHapticGloveCalibrationCheckType;
|
||||
|
||||
public:
|
||||
static float GetSenseGloveThreshold();
|
||||
|
||||
static float GetNovaGloveThreshold();
|
||||
|
||||
static float GetSenseGloveMinFlexion();
|
||||
|
||||
static float GetNovaGloveMinFlexion();
|
||||
|
||||
static float GetSenseGloveMinAbduction();
|
||||
|
||||
static float GetNovaGloveMinAbduction();
|
||||
|
||||
public:
|
||||
static bool NeedsCheck(ESGDeviceType DeviceType);
|
||||
|
||||
static int32 OutOfBounds(const FSGSensorRangeImpl& PreviousRange, const TArray<FVector>& CurrentValues,
|
||||
ESGDeviceType DeviceType);
|
||||
|
||||
static bool MovedMinimum(const TArray<FVector>& CurrentRange, ESGDeviceType DeviceType);
|
||||
|
||||
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:
|
||||
FSGHapticGloveCalibrationCheckImpl();
|
||||
|
||||
explicit FSGHapticGloveCalibrationCheckImpl(const FSGSensorRangeImpl& LastCalibrationRange);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast from underlying type constructor.
|
||||
*/
|
||||
explicit FSGHapticGloveCalibrationCheckImpl(
|
||||
const FHapticGloveCalibrationCheckType& HapticGloveCalibrationCheck);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy constructor.
|
||||
*/
|
||||
FSGHapticGloveCalibrationCheckImpl(const FSGHapticGloveCalibrationCheckImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move constructor.
|
||||
*/
|
||||
FSGHapticGloveCalibrationCheckImpl(FSGHapticGloveCalibrationCheckImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The destructor.
|
||||
*/
|
||||
virtual ~FSGHapticGloveCalibrationCheckImpl();
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy assignment operator.
|
||||
*/
|
||||
FSGHapticGloveCalibrationCheckImpl& operator=(const FSGHapticGloveCalibrationCheckImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move assignment operator.
|
||||
*/
|
||||
FSGHapticGloveCalibrationCheckImpl& operator=(FSGHapticGloveCalibrationCheckImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
const FHapticGloveCalibrationCheckType& ToHapticGloveCalibrationCheck() const;
|
||||
|
||||
public:
|
||||
ESGCalibrationStage GetCalibrationStage() const;
|
||||
|
||||
bool ReachedConclusion() const;
|
||||
|
||||
public:
|
||||
virtual void Reset();
|
||||
|
||||
void CheckRange(const TArray<FVector>& CurrentValues, float DeltaSeconds, ESGDeviceType DeviceType);
|
||||
};
|
||||
@@ -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/UnrealString.h"
|
||||
#include "Math/Vector.h"
|
||||
#include "Templates/SharedPointer.h"
|
||||
#include "Templates/UniquePtr.h"
|
||||
|
||||
#include "SGCoreImpl/SGHapticGloveCalibrationSequenceImpl.h"
|
||||
#include "SGBuildHacks/SGPlatform.h"
|
||||
#include "SGTypes/SGCoreTypes.h"
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
namespace Calibration
|
||||
{
|
||||
class HapticGloveCalibrationSequence;
|
||||
}
|
||||
}
|
||||
|
||||
class FSGCalibrationDataPointImpl;
|
||||
class FSGHandPoseImpl;
|
||||
class FSGHandProfileImpl;
|
||||
class FSGHapticGloveImpl;
|
||||
class FSGHapticGloveQuickCalibrationImpl;
|
||||
class FSGSensorRangeImpl;
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGHapticGloveCalibrationSequenceImpl
|
||||
: public TSharedFromThis<FSGHapticGloveCalibrationSequenceImpl>
|
||||
{
|
||||
public:
|
||||
typedef SGCore::Calibration::HapticGloveCalibrationSequence FHapticGloveCalibrationSequenceType;
|
||||
|
||||
public:
|
||||
static int32 GetMaxDataPoints();
|
||||
|
||||
public:
|
||||
static bool CompileProfile(const FSGSensorRangeImpl& SensorRange, ESGDeviceType ForDevice, bool bRightHanded,
|
||||
FSGHandProfileImpl& OutProfile);
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
|
||||
struct FImplDeleter
|
||||
{
|
||||
void operator()(const FImpl* P) const;
|
||||
};
|
||||
|
||||
TUniquePtr<FImpl, FImplDeleter> Pimpl;
|
||||
FImplDeleter PimplDeleter;
|
||||
|
||||
public:
|
||||
FSGHapticGloveCalibrationSequenceImpl();
|
||||
|
||||
explicit FSGHapticGloveCalibrationSequenceImpl(TSharedRef<FSGHapticGloveImpl> LinkedGlove);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast from underlying type constructor.
|
||||
*/
|
||||
explicit FSGHapticGloveCalibrationSequenceImpl(
|
||||
const FHapticGloveCalibrationSequenceType& HapticGloveCalibrationSequence);
|
||||
|
||||
/**
|
||||
* The cast from underlying pointer type constructor.
|
||||
*/
|
||||
explicit FSGHapticGloveCalibrationSequenceImpl(
|
||||
TSharedRef<FHapticGloveCalibrationSequenceType> HapticGloveCalibrationSequence);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy constructor.
|
||||
*/
|
||||
FSGHapticGloveCalibrationSequenceImpl(const FSGHapticGloveCalibrationSequenceImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move constructor.
|
||||
*/
|
||||
FSGHapticGloveCalibrationSequenceImpl(FSGHapticGloveCalibrationSequenceImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The destructor.
|
||||
*/
|
||||
virtual ~FSGHapticGloveCalibrationSequenceImpl();
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy assignment operator.
|
||||
*/
|
||||
FSGHapticGloveCalibrationSequenceImpl& operator=(const FSGHapticGloveCalibrationSequenceImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move assignment operator.
|
||||
*/
|
||||
FSGHapticGloveCalibrationSequenceImpl& operator=(FSGHapticGloveCalibrationSequenceImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
const FHapticGloveCalibrationSequenceType& ToHapticGloveCalibrationSequence() const;
|
||||
|
||||
/**
|
||||
* The cast to underlying pointer type method.
|
||||
*/
|
||||
TSharedRef<FHapticGloveCalibrationSequenceType> ToHapticGloveCalibrationSequenceRef() const;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to base TSharedRef<FSGHapticGloveCalibrationSequenceImpl> type method.
|
||||
*/
|
||||
TSharedRef<FSGHapticGloveCalibrationSequenceImpl> ToHapticGloveCalibrationSequenceImplRef();
|
||||
|
||||
/**
|
||||
* The cast to derived TSharedRef<FSGHapticGloveCalibrationSequenceImpl> type method.
|
||||
*/
|
||||
TSharedRef<FSGHapticGloveQuickCalibrationImpl> ToHapticGloveQuickCalibrationImplRef();
|
||||
|
||||
public:
|
||||
TSharedRef<FSGHapticGloveImpl> GetLinkedGlove() const;
|
||||
|
||||
void SetLinkedGlove(const TSharedRef<FSGHapticGloveImpl> LinkedGlove);
|
||||
|
||||
TArray<FSGCalibrationDataPointImpl> GetCalibrationPoints() const;
|
||||
|
||||
float GetElapsedTime() const;
|
||||
|
||||
bool IsManuallyCompleted() const;
|
||||
|
||||
virtual int32 GetCurrentStage() const;
|
||||
|
||||
SIZE_T GetCalibrationPointsCount() const;
|
||||
|
||||
virtual bool AutoCompleted() const;
|
||||
|
||||
virtual bool Completed() const;
|
||||
|
||||
public:
|
||||
virtual void Reset();
|
||||
|
||||
virtual void AddDataPoint(const TArray<FVector>& CalibrationPoints);
|
||||
|
||||
virtual void Update(float DeltaSeconds);
|
||||
|
||||
virtual void ConfirmCurrentStep();
|
||||
|
||||
public:
|
||||
virtual bool CompileRange(FSGSensorRangeImpl& OutSensorRange) const;
|
||||
|
||||
virtual bool CompileProfile(ESGDeviceType ForDevice, bool bRightHanded, FSGHandProfileImpl& OutProfile) const;
|
||||
|
||||
bool GetHandPose(FSGHandPoseImpl& OutCurrentHandPose) const;
|
||||
|
||||
virtual bool GetHandPose(bool bRightHanded, FSGHandPoseImpl& OutCurrentHandPose) const;
|
||||
|
||||
virtual FString GetCurrentInstruction(const FString& NextStepKey = FString{""}) const;
|
||||
};
|
||||
@@ -1,165 +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 "Templates/UniquePtr.h"
|
||||
|
||||
#include "SGBuildHacks/SGPlatform.h"
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
namespace Haptics
|
||||
{
|
||||
class HapticGloveCommandBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
class FSGBuzzCommandImpl;
|
||||
class FSGFingerCommandImpl;
|
||||
class FSGForceFeedbackCommandImpl;
|
||||
class FSGThumperCommandImpl;
|
||||
class FSGTimedBuzzCommandImpl;
|
||||
class FSGTimedThumpCommandImpl;
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGHapticGloveCommandBufferImpl final
|
||||
{
|
||||
public:
|
||||
typedef SGCore::Haptics::HapticGloveCommandBuffer FHapticGloveCommandBufferType;
|
||||
|
||||
public:
|
||||
static int32 GetMaxForceFeedbackCommands();
|
||||
|
||||
static int32 GetMaxBuzzCommands();
|
||||
|
||||
static int32 GetMaxThumpCommands();
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
|
||||
struct FImplDeleter
|
||||
{
|
||||
void operator()(const FImpl* P) const;
|
||||
};
|
||||
|
||||
TUniquePtr<FImpl, FImplDeleter> Pimpl;
|
||||
FImplDeleter PimplDeleter;
|
||||
|
||||
public:
|
||||
FSGHapticGloveCommandBufferImpl();
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast from underlying type constructor.
|
||||
*/
|
||||
explicit FSGHapticGloveCommandBufferImpl(const FHapticGloveCommandBufferType& HapticGloveCommandBuffer);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy constructor.
|
||||
*/
|
||||
FSGHapticGloveCommandBufferImpl(const FSGHapticGloveCommandBufferImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move constructor.
|
||||
*/
|
||||
FSGHapticGloveCommandBufferImpl(FSGHapticGloveCommandBufferImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The destructor.
|
||||
*/
|
||||
virtual ~FSGHapticGloveCommandBufferImpl();
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy assignment operator.
|
||||
*/
|
||||
FSGHapticGloveCommandBufferImpl& operator=(const FSGHapticGloveCommandBufferImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move assignment operator.
|
||||
*/
|
||||
FSGHapticGloveCommandBufferImpl& operator=(FSGHapticGloveCommandBufferImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
const FHapticGloveCommandBufferType& ToHapticGloveCommandBuffer() const;
|
||||
|
||||
public:
|
||||
TArray<FSGForceFeedbackCommandImpl> GetForceFeedbackCommandsQueue() const;
|
||||
|
||||
TArray<FSGTimedBuzzCommandImpl> GetBuzzCommandsQueue() const;
|
||||
|
||||
TArray<FSGTimedThumpCommandImpl> GetThumperCommandsQueue() const;
|
||||
|
||||
public:
|
||||
void ClearForceFeedbackCommandsQueue();
|
||||
|
||||
void ClearVibrations();
|
||||
|
||||
void Clear();
|
||||
|
||||
void AddCommand(const FSGForceFeedbackCommandImpl& ForceFeedbackCommand);
|
||||
|
||||
void AddCommand(const FSGTimedBuzzCommandImpl& BuzzCommand);
|
||||
|
||||
void AddCommand(const FSGTimedThumpCommandImpl& ThumpCommand);
|
||||
|
||||
void UpdateTimedCommands(float DeltaSeconds);
|
||||
|
||||
public:
|
||||
FSGForceFeedbackCommandImpl GetTotalForceFeedbackLevels(
|
||||
const FSGForceFeedbackCommandImpl& LastForceFeedbackCommand) const;
|
||||
|
||||
FSGForceFeedbackCommandImpl GetTotalForceFeedbackLevels() const;
|
||||
|
||||
FSGBuzzCommandImpl GetTotalBuzzLevels() const;
|
||||
|
||||
FSGThumperCommandImpl GetTotalThumperLevels() const;
|
||||
|
||||
public:
|
||||
void FlushHaptics(const FSGForceFeedbackCommandImpl& LastBrakeLevel,
|
||||
FSGForceFeedbackCommandImpl& OutForceFeedbackCommand,
|
||||
FSGBuzzCommandImpl& OutBuzzCommand, FSGThumperCommandImpl& OutThumperCommand,
|
||||
bool bClearForceFeedbackQueue = true);
|
||||
|
||||
void FlushHaptics(float DeltaSeconds, const FSGForceFeedbackCommandImpl& LastBrakeLevel,
|
||||
FSGForceFeedbackCommandImpl& OutForceFeedbackCommand, FSGBuzzCommandImpl& OutBuzzCommand,
|
||||
FSGThumperCommandImpl& OutThumperCommand);
|
||||
};
|
||||
@@ -1,87 +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/UnrealString.h"
|
||||
#include "Templates/SharedPointer.h"
|
||||
|
||||
class FSGHandProfileImpl;
|
||||
class FSGHapticGloveImpl;
|
||||
class FSGSensorRangeImpl;
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
class HapticGloveHandProfiles;
|
||||
}
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGHapticGloveHandProfilesImpl final
|
||||
{
|
||||
public:
|
||||
typedef SGCore::HapticGloveHandProfiles FHapticGloveHandProfilesType;
|
||||
|
||||
public:
|
||||
static const FString& GetProfileDirectory();
|
||||
|
||||
static void SetProfileDirectory(const FString& Directory);
|
||||
|
||||
static void GetLeftHandProfile(FSGHandProfileImpl& OutHandProfileImpl);
|
||||
|
||||
static void SetLeftHandProfile(const FSGHandProfileImpl& HandProfileImpl);
|
||||
|
||||
static void GetRightHandProfile(FSGHandProfileImpl& OutHandProfileImpl);
|
||||
|
||||
static void SetRightHandProfile(const FSGHandProfileImpl& HandProfileImpl);
|
||||
|
||||
static void GetProfile(bool bRightHanded, FSGHandProfileImpl& OutHandProfileImpl);
|
||||
|
||||
static void SetProfile(const FSGHandProfileImpl& HandProfileImpl);
|
||||
|
||||
static void SetProfile(const FSGHandProfileImpl& HandProfileImpl, bool bRightHanded);
|
||||
|
||||
static void RestoreDefaults();
|
||||
|
||||
static void RestoreDefaults(bool bRightHanded);
|
||||
|
||||
static void TryLoadingFromDisk();
|
||||
|
||||
static bool SaveLastRange(const FSGSensorRangeImpl& CurrentRange, const TSharedRef<FSGHapticGloveImpl> ForGlove);
|
||||
|
||||
static bool LoadLastRange(const TSharedRef<FSGHapticGloveImpl> ForGlove, FSGSensorRangeImpl& OutLastRange);
|
||||
|
||||
public:
|
||||
FSGHapticGloveHandProfilesImpl() = delete;
|
||||
virtual ~FSGHapticGloveHandProfilesImpl() = delete;
|
||||
};
|
||||
@@ -32,6 +32,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
@@ -54,11 +55,8 @@ namespace SGCore
|
||||
}
|
||||
|
||||
class FSGBasicHandModelImpl;
|
||||
class FSGBuzzCommandImpl;
|
||||
class FSGForceFeedbackCommandImpl;
|
||||
class FSGCustomWaveformImpl;
|
||||
class FSGHandPoseImpl;
|
||||
class FSGHandProfileImpl;
|
||||
class FSGThumperCommandImpl;
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGHapticGloveImpl : public FSGDeviceImpl
|
||||
{
|
||||
@@ -76,12 +74,17 @@ public:
|
||||
typedef std::vector<FHapticGlovePtrType> FHapticGlovePtrVectorType;
|
||||
|
||||
public:
|
||||
static TArray<TSharedRef<FSGHapticGloveImpl>> GetHapticGloves();
|
||||
static TArray<TSharedRef<FSGHapticGloveImpl>> GetHapticGloves(bool bConnectedOnly = true);
|
||||
|
||||
static bool GetGlove(TSharedPtr<FSGHapticGloveImpl>& OutGlove);
|
||||
|
||||
static bool GetGlove(bool bRightHanded, TSharedPtr<FSGHapticGloveImpl>& OutGlove);
|
||||
|
||||
public:
|
||||
static FString ToString(ESGHapticGloveCalibrationState State);
|
||||
|
||||
static FString ToString(ESGHapticLocation Location);
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
|
||||
@@ -149,56 +152,44 @@ public:
|
||||
virtual int32 GetFirmwareVersion() const override;
|
||||
virtual int32 GetSubFirmwareVersion() const override;
|
||||
|
||||
public:
|
||||
virtual bool IsRight() const;
|
||||
|
||||
virtual bool GetImuRotation(FQuat& OutImu);
|
||||
|
||||
virtual bool GetHandPose(const FSGBasicHandModelImpl& HandGeometry, const FSGHandProfileImpl& HandProfile,
|
||||
FSGHandPoseImpl& OutHandPose);
|
||||
|
||||
virtual bool GetHandPose(const FSGHandProfileImpl& HandProfile, FSGHandPoseImpl& OutHandPose);
|
||||
|
||||
virtual bool GetHandPose(const FSGBasicHandModelImpl& HandGeometry, FSGHandPoseImpl& OutHandPose);
|
||||
virtual bool GetHandPose(const FSGBasicHandModelImpl& HandGeometry, FSGHandPoseImpl& OutHandPose) const;
|
||||
|
||||
virtual bool GetHandPose(FSGHandPoseImpl& OutHandPose);
|
||||
|
||||
#if PLATFORM_ANDROID
|
||||
virtual bool GetHandPose(float DeltaTime, FSGHandPoseImpl& OutHandPose);
|
||||
#endif /* PLATFORM_ANDROID */
|
||||
virtual bool GetHandAngles(TArray<TArray<FVector>>& OutHandAngles) const;
|
||||
|
||||
FSGBasicHandModelImpl GetHandGeometry() const;
|
||||
void SetHandGeometry(const FSGBasicHandModelImpl& HandGeometry);
|
||||
|
||||
public:
|
||||
virtual ESGHapticGloveCalibrationState GetCalibrationState() const;
|
||||
|
||||
virtual void EndCalibration();
|
||||
|
||||
virtual void ResetCalibration();
|
||||
|
||||
virtual FString GetCalibrationInstruction() const;
|
||||
|
||||
public:
|
||||
virtual void StopHaptics();
|
||||
|
||||
virtual void StopVibrations();
|
||||
|
||||
virtual void SendHaptics(const FSGForceFeedbackCommandImpl& ForceFeedbackCommand);
|
||||
|
||||
virtual void SendHaptics(const FSGBuzzCommandImpl& BuzzCommand);
|
||||
|
||||
virtual void SendHaptics(const FSGThumperCommandImpl& ThumperCommand);
|
||||
|
||||
virtual void SendHaptics(const FSGForceFeedbackCommandImpl& ForceFeedbackCommand,
|
||||
const FSGBuzzCommandImpl& BuzzCommand);
|
||||
|
||||
virtual void SendHaptics(const FSGForceFeedbackCommandImpl& ForceFeedbackCommand,
|
||||
const FSGBuzzCommandImpl& BuzzCommand,
|
||||
const FSGThumperCommandImpl& ThumperCommand);
|
||||
virtual bool SendHaptics();
|
||||
|
||||
public:
|
||||
virtual bool GetCalibrationValues(TArray<FVector>& OutValues);
|
||||
virtual bool QueueForceFeedbackLevels(const TArray<float>& Levels01);
|
||||
|
||||
virtual void ResetCalibrationRange();
|
||||
virtual bool QueueForceFeedbackLevel(int32 Finger, float Level01);
|
||||
|
||||
virtual void UpdateCalibrationRange();
|
||||
virtual bool SupportsCustomWaveform(ESGHapticLocation AtLocation) const;
|
||||
|
||||
virtual void UpdateCalibrationRange(const TArray<FVector>& CalibrationValues);
|
||||
|
||||
virtual void GetCalibrationRange(TArray<FVector>& OutMinValues,
|
||||
TArray<FVector>& OutMaxValues);
|
||||
|
||||
virtual void UpdateCalibration(FSGHandProfileImpl& OutProfile);
|
||||
|
||||
virtual void ApplyCalibration(FSGHandProfileImpl& OutProfile) const;
|
||||
virtual bool SendCustomWaveform(FSGCustomWaveformImpl& OutWaveform, ESGHapticLocation Location);
|
||||
|
||||
public:
|
||||
virtual void GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
|
||||
@@ -208,4 +199,7 @@ public:
|
||||
virtual void GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
|
||||
ESGPositionalTrackingHardware TrackingHardware,
|
||||
FVector& OutGlovePosition, FQuat& OutGloveRotation) const;
|
||||
|
||||
public:
|
||||
virtual FString ToString() const override;
|
||||
};
|
||||
@@ -1,156 +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/UnrealString.h"
|
||||
#include "Math/Vector.h"
|
||||
#include "Templates/UniquePtr.h"
|
||||
|
||||
#include "SGBuildHacks/SGPlatform.h"
|
||||
#include "SGCoreImpl/SGHapticGloveCalibrationSequenceImpl.h"
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
namespace Calibration
|
||||
{
|
||||
class HapticGloveQuickCalibration;
|
||||
}
|
||||
}
|
||||
|
||||
class FSGHandPoseImpl;
|
||||
class FSGHandProfileImpl;
|
||||
class FSGHapticGloveImpl;
|
||||
class FSGSensorRangeImpl;
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGHapticGloveQuickCalibrationImpl final : public FSGHapticGloveCalibrationSequenceImpl
|
||||
{
|
||||
public:
|
||||
typedef SGCore::Calibration::HapticGloveQuickCalibration FHapticGloveQuickCalibrationType;
|
||||
|
||||
public:
|
||||
static float GetDefaultAutoEndTimeout();
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
|
||||
struct FImplDeleter
|
||||
{
|
||||
void operator()(const FImpl* P) const;
|
||||
};
|
||||
|
||||
TUniquePtr<FImpl, FImplDeleter> Pimpl;
|
||||
FImplDeleter PimplDeleter;
|
||||
|
||||
public:
|
||||
FSGHapticGloveQuickCalibrationImpl();
|
||||
|
||||
explicit FSGHapticGloveQuickCalibrationImpl(TSharedRef<FSGHapticGloveImpl> GloveToCalibrate,
|
||||
float AutoEndTimeout = GetDefaultAutoEndTimeout());
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast from underlying type constructor.
|
||||
*/
|
||||
explicit FSGHapticGloveQuickCalibrationImpl(const FHapticGloveQuickCalibrationType& HapticGloveQuickCalibration);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy constructor.
|
||||
*/
|
||||
FSGHapticGloveQuickCalibrationImpl(const FSGHapticGloveQuickCalibrationImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move constructor.
|
||||
*/
|
||||
FSGHapticGloveQuickCalibrationImpl(FSGHapticGloveQuickCalibrationImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The destructor.
|
||||
*/
|
||||
virtual ~FSGHapticGloveQuickCalibrationImpl();
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy assignment operator.
|
||||
*/
|
||||
FSGHapticGloveQuickCalibrationImpl& operator=(const FSGHapticGloveQuickCalibrationImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move assignment operator.
|
||||
*/
|
||||
FSGHapticGloveQuickCalibrationImpl& operator=(FSGHapticGloveQuickCalibrationImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
const FHapticGloveQuickCalibrationType& ToHapticGloveQuickCalibration() const;
|
||||
|
||||
/**
|
||||
* The cast to underlying pointer type method.
|
||||
*/
|
||||
TSharedRef<FHapticGloveQuickCalibrationType> ToHapticGloveQuickCalibrationRef() const;
|
||||
|
||||
public:
|
||||
float GetAutoEndTimeout() const;
|
||||
|
||||
int32 GetSmoothingSamples() const;
|
||||
|
||||
FSGSensorRangeImpl GetSensorRange() const;
|
||||
|
||||
FSGHandProfileImpl GetTemporaryProfile() const;
|
||||
|
||||
bool CanAnimate() const;
|
||||
|
||||
public:
|
||||
virtual bool AutoCompleted() const override;
|
||||
|
||||
public:
|
||||
virtual void Reset() override;
|
||||
|
||||
virtual void Update(float DeltaSeconds) override;
|
||||
|
||||
virtual void AddDataPoint(const TArray<FVector>& CalibrationData) override;
|
||||
|
||||
virtual void ConfirmCurrentStep() override;
|
||||
|
||||
virtual bool CompileRange(FSGSensorRangeImpl& OutSensorRange) const override;
|
||||
|
||||
virtual bool GetHandPose(bool bRightHanded, FSGHandPoseImpl& OutCurrentHandPose) const override;
|
||||
|
||||
virtual FString GetCurrentInstruction(const FString& NextStepKey = FString{""}) const override;
|
||||
};
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Containers/Array.h"
|
||||
#include "Math/Quat.h"
|
||||
#include "Math/Vector.h"
|
||||
|
||||
@@ -63,4 +64,8 @@ public:
|
||||
static bool ForwardKinematics(
|
||||
const FSGBasicHandModelImpl& Profile, ESGFinger Finger, const TArray<FVector>& JointAngles,
|
||||
TArray<FVector>& OutNewPositions, TArray<FQuat>& OutNewRotations);
|
||||
|
||||
public:
|
||||
FSGJointKinematicsImpl() = delete;
|
||||
virtual ~FSGJointKinematicsImpl() = delete;
|
||||
};
|
||||
@@ -57,4 +57,8 @@ public:
|
||||
static FString BackendVersion();
|
||||
|
||||
static FString SGConnectVersion();
|
||||
|
||||
public:
|
||||
FSGLibraryImpl() = delete;
|
||||
virtual ~FSGLibraryImpl() = delete;
|
||||
};
|
||||
@@ -0,0 +1,284 @@
|
||||
/**
|
||||
* @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 <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "Containers/UnrealString.h"
|
||||
#include "Math/Quat.h"
|
||||
#include "Math/Vector.h"
|
||||
#include "Runtime/Launch/Resources/Version.h"
|
||||
#include "Templates/SharedPointer.h"
|
||||
#include "Templates/UniquePtr.h"
|
||||
|
||||
#include "SGBuildHacks/SGPlatform.h"
|
||||
#include "SGCoreImpl/SGHapticGloveImpl.h"
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
namespace Nova
|
||||
{
|
||||
class Nova2Glove;
|
||||
}
|
||||
}
|
||||
|
||||
class FSGBasicHandModelImpl;
|
||||
class FSGHandInterpolatorImpl;
|
||||
class FSGHandPoseImpl;
|
||||
class FSGNova2GloveHandProfileImpl;
|
||||
class FSGNova2GloveSensorDataImpl;
|
||||
class FSGNovaGloveInfoImpl;
|
||||
class FSGSensorNormalizationImpl;
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGNova2GloveImpl final : public FSGHapticGloveImpl
|
||||
{
|
||||
#if ENGINE_MAJOR_VERSION >= 5
|
||||
friend class SharedPointerInternals::TIntrusiveReferenceController<FSGNova2GloveImpl, ESPMode::ThreadSafe>;
|
||||
#else
|
||||
friend class SharedPointerInternals::TIntrusiveReferenceController<FSGNova2GloveImpl>;
|
||||
#endif /* ENGINE_MAJOR_VERSION >= 5 */
|
||||
|
||||
public:
|
||||
typedef SGCore::Nova::Nova2Glove FNova2GloveType;
|
||||
|
||||
typedef std::vector<FNova2GloveType> FNova2GloveVectorType;
|
||||
|
||||
typedef std::shared_ptr<FNova2GloveType> FNova2GlovePtrType;
|
||||
typedef std::vector<FNova2GlovePtrType> FNova2GlovePtrVectorType;
|
||||
|
||||
public:
|
||||
static TSharedRef<FSGDeviceImpl> Parse(const FString& ConstantsString);
|
||||
|
||||
static TArray<FSGNova2GloveImpl> GetNova2Gloves();
|
||||
|
||||
static bool GetNova2Glove(FSGNova2GloveImpl& OutGlove);
|
||||
|
||||
static bool GetNova2Glove(bool bRightHanded, FSGNova2GloveImpl& OutGlove);
|
||||
|
||||
public:
|
||||
static void CalculateGloveLocation(
|
||||
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
|
||||
ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, const FString& HardwareVersion,
|
||||
FVector& OutGlovePosition, FQuat& OutGloveRotation);
|
||||
|
||||
static void CalculateWristLocation(
|
||||
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
|
||||
ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, const FString& HardwareVersion,
|
||||
FVector& OutWristPosition, FQuat& OutWristRotation);
|
||||
|
||||
public:
|
||||
static ANSICHAR GetStreamByte();
|
||||
|
||||
static const TArray<float>& GetNova2SensorRanges();
|
||||
|
||||
public:
|
||||
static TArray<float> ToNormalizedValues(const FSGNova2GloveSensorDataImpl& SensorData);
|
||||
|
||||
static TArray<float> ToNormalizedValues(
|
||||
const FSGNova2GloveSensorDataImpl& SensorData, FSGSensorNormalizationImpl& OutSensorNormalizer);
|
||||
|
||||
public:
|
||||
static TArray<TArray<FVector>> CalculateHandAngles(
|
||||
const TArray<float>& NormalizedValues, const FSGHandInterpolatorImpl& Interpolator, bool bInfluenceIndex);
|
||||
|
||||
static TArray<TArray<FVector>> ToNormalizedAngles(
|
||||
const TArray<float>& NormalizedData, const FSGNovaGloveInfoImpl& GloveInfo);
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
|
||||
struct FImplDeleter
|
||||
{
|
||||
void operator()(const FImpl* P) const;
|
||||
};
|
||||
|
||||
TUniquePtr<FImpl, FImplDeleter> Pimpl;
|
||||
FImplDeleter PimplDeleter;
|
||||
|
||||
public:
|
||||
FSGNova2GloveImpl();
|
||||
|
||||
explicit FSGNova2GloveImpl(const FSGNovaGloveInfoImpl& DeviceInfo);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast from underlying type constructor.
|
||||
*/
|
||||
explicit FSGNova2GloveImpl(const FNova2GloveType Nova2Glove);
|
||||
|
||||
/**
|
||||
* The cast from underlying pointer type constructor.
|
||||
*/
|
||||
explicit FSGNova2GloveImpl(const FNova2GlovePtrType Nova2Glove);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy constructor.
|
||||
*/
|
||||
FSGNova2GloveImpl(const FSGNova2GloveImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move constructor.
|
||||
*/
|
||||
FSGNova2GloveImpl(FSGNova2GloveImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The destructor.
|
||||
*/
|
||||
virtual ~FSGNova2GloveImpl() override;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy assignment operator.
|
||||
*/
|
||||
FSGNova2GloveImpl& operator=(const FSGNova2GloveImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move assignment operator.
|
||||
*/
|
||||
FSGNova2GloveImpl& operator=(FSGNova2GloveImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
const FNova2GloveType& ToNova2Glove() const;
|
||||
|
||||
/**
|
||||
* The cast to underlying pointer type method.
|
||||
*/
|
||||
FNova2GlovePtrType ToNova2GlovePtr() const;
|
||||
|
||||
/**
|
||||
* The checked cast to underlying pointer type method.
|
||||
*/
|
||||
FNova2GlovePtrType ToNova2GlovePtrChecked() const;
|
||||
|
||||
public:
|
||||
virtual ESGDeviceType GetDeviceType() const override;
|
||||
|
||||
virtual FString GetDeviceId() const override;
|
||||
|
||||
virtual FString GetHardwareVersion() const override;
|
||||
|
||||
virtual int32 GetFirmwareVersion() const override;
|
||||
|
||||
virtual int32 GetSubFirmwareVersion() const override;
|
||||
|
||||
public:
|
||||
virtual bool HasBattery() const override;
|
||||
|
||||
virtual bool IsCharging() override;
|
||||
|
||||
virtual bool GetBatteryLevel(float& OutBatteryLevel) override;
|
||||
|
||||
public:
|
||||
virtual bool IsRight() const override;
|
||||
|
||||
virtual bool GetImuRotation(FQuat& OutImu) override;
|
||||
|
||||
virtual bool GetHandPose(const FSGBasicHandModelImpl& HandGeometry, FSGHandPoseImpl& OutHandPose) const override;
|
||||
|
||||
virtual bool GetHandAngles(TArray<TArray<FVector>>& OutHandAngles) const override;
|
||||
|
||||
public:
|
||||
virtual ESGHapticGloveCalibrationState GetCalibrationState() const override;
|
||||
|
||||
virtual void EndCalibration() override;
|
||||
|
||||
virtual void ResetCalibration() override;
|
||||
|
||||
public:
|
||||
virtual void StopHaptics() override;
|
||||
|
||||
virtual void StopVibrations() override;
|
||||
|
||||
virtual bool SendHaptics() override;
|
||||
|
||||
public:
|
||||
virtual bool SupportsCustomWaveform(ESGHapticLocation AtLocation) const override;
|
||||
|
||||
virtual bool SendCustomWaveform(FSGCustomWaveformImpl& OutWaveform, ESGHapticLocation Location) override;
|
||||
|
||||
public:
|
||||
virtual bool QueueForceFeedbackLevels(const TArray<float>& Levels01) override;
|
||||
|
||||
virtual bool QueueForceFeedbackLevel(int32 Finger, float Level01) override;
|
||||
|
||||
virtual bool QueueSqueezeLevel(float SqueezeLevel01);
|
||||
|
||||
public:
|
||||
virtual void GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
|
||||
ESGPositionalTrackingHardware TrackingHardware,
|
||||
FVector& OutGlovePosition, FQuat& OutGloveRotation) const override;
|
||||
|
||||
virtual void GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
|
||||
ESGPositionalTrackingHardware TrackingHardware,
|
||||
FVector& OutWristPosition, FQuat& OutWristRotation) const override;
|
||||
|
||||
public:
|
||||
FSGNovaGloveInfoImpl GetGloveInfo() const;
|
||||
|
||||
bool DoesIndexInfluenceOthers() const;
|
||||
|
||||
void SetIndexInfluencesOthers(bool bInfluenceOthers);
|
||||
|
||||
bool SupportsOnBoardNormalization() const;
|
||||
|
||||
public:
|
||||
bool GetSensorData(FSGNova2GloveSensorDataImpl& OutSensorData) const;
|
||||
|
||||
bool GetNormalizedInput(TArray<float>& OutNormalizedValues) const;
|
||||
|
||||
virtual bool SendRawData();
|
||||
|
||||
virtual bool SendNormalizedData();
|
||||
|
||||
public:
|
||||
virtual ESGNova2VibroMotor ToNovaMotor(ESGHapticLocation Location) const;
|
||||
|
||||
virtual int32 ChannelIndex(ESGNova2VibroMotor Motor) const;
|
||||
|
||||
virtual void ValidateWaveform(FSGCustomWaveformImpl& OutWaveform, ESGNova2VibroMotor Motor) const;
|
||||
|
||||
virtual bool SendCustomWaveform_Nova2(FSGCustomWaveformImpl& OutWaveform, ESGNova2VibroMotor Motor,
|
||||
bool bValidateWaveform = true);
|
||||
|
||||
public:
|
||||
virtual FString ToString() const override;
|
||||
};
|
||||
+30
-31
@@ -42,28 +42,23 @@
|
||||
#include "SGBuildHacks/SGPlatform.h"
|
||||
#include "SGTypes/SGCoreTypes.h"
|
||||
|
||||
class FSGHandInterpolatorImpl;
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
namespace SG
|
||||
namespace Nova
|
||||
{
|
||||
class SenseGloveHandProfile;
|
||||
class Nova2GloveSensorData;
|
||||
}
|
||||
}
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGSenseGloveHandProfileImpl final
|
||||
class FSGNovaGloveInfoImpl;
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGNova2GloveSensorDataImpl final
|
||||
{
|
||||
public:
|
||||
typedef SGCore::SG::SenseGloveHandProfile FSenseGloveHandProfileType;
|
||||
typedef SGCore::Nova::Nova2GloveSensorData FNova2GloveSensorDataType;
|
||||
|
||||
public:
|
||||
static FSGSenseGloveHandProfileImpl Default(bool bRightHanded);
|
||||
|
||||
static FSGSenseGloveHandProfileImpl Deserialize(const FString& SerializedString);
|
||||
|
||||
public:
|
||||
static const FVector& GetDefaultThimbleOffset();
|
||||
static FSGNova2GloveSensorDataImpl Parse(const FString& RawData, const FSGNovaGloveInfoImpl& GloveInfo);
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
@@ -77,68 +72,72 @@ private:
|
||||
FImplDeleter PimplDeleter;
|
||||
|
||||
public:
|
||||
FSGSenseGloveHandProfileImpl();
|
||||
FSGNova2GloveSensorDataImpl();
|
||||
|
||||
FSGSenseGloveHandProfileImpl(bool bRightHanded, const FSGHandInterpolatorImpl& Interpolator,
|
||||
ESGThumbSolver ThumbSolver, ESGFingerSolver FingerSolver,
|
||||
const TArray<FVector>& FingerThimbleOffset);
|
||||
FSGNova2GloveSensorDataImpl(const ESGNormalizationState NormalizationState,
|
||||
const TArray<TArray<FVector>>& Values, int32 ParsedValues,
|
||||
const FQuat& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast from underlying type constructor.
|
||||
*/
|
||||
explicit FSGSenseGloveHandProfileImpl(const FSenseGloveHandProfileType& SenseGloveHandProfile);
|
||||
explicit FSGNova2GloveSensorDataImpl(const FNova2GloveSensorDataType& Nova2GloveSensorData);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy constructor.
|
||||
*/
|
||||
FSGSenseGloveHandProfileImpl(const FSGSenseGloveHandProfileImpl& Rhs);
|
||||
FSGNova2GloveSensorDataImpl(const FSGNova2GloveSensorDataImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move constructor.
|
||||
*/
|
||||
FSGSenseGloveHandProfileImpl(FSGSenseGloveHandProfileImpl&& Rhs) SG_NOEXCEPT;
|
||||
FSGNova2GloveSensorDataImpl(FSGNova2GloveSensorDataImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The destructor.
|
||||
*/
|
||||
virtual ~FSGSenseGloveHandProfileImpl();
|
||||
virtual ~FSGNova2GloveSensorDataImpl();
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy assignment operator.
|
||||
*/
|
||||
FSGSenseGloveHandProfileImpl& operator=(const FSGSenseGloveHandProfileImpl& Rhs);
|
||||
FSGNova2GloveSensorDataImpl& operator=(const FSGNova2GloveSensorDataImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move assignment operator.
|
||||
*/
|
||||
FSGSenseGloveHandProfileImpl& operator=(FSGSenseGloveHandProfileImpl&& Rhs) SG_NOEXCEPT;
|
||||
FSGNova2GloveSensorDataImpl& operator=(FSGNova2GloveSensorDataImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
const FSenseGloveHandProfileType& ToSenseGloveHandProfile() const;
|
||||
const FNova2GloveSensorDataType& ToNova2GloveSensorData() const;
|
||||
|
||||
public:
|
||||
bool IsRight() const;
|
||||
ESGNormalizationState GetSensorState() const;
|
||||
|
||||
FSGHandInterpolatorImpl GetInterpolationSet() const;
|
||||
TArray<TArray<FVector>> GetSensorValues() const;
|
||||
float GetSensorValue(ESGFinger Finger, ESGNova2SensorLocation Location) const;
|
||||
|
||||
ESGThumbSolver GetThumbSolver() const;
|
||||
int32 GetParsedValues() const;
|
||||
|
||||
ESGFingerSolver GetFingerSolver() const;
|
||||
FQuat GetImuRotation() const;
|
||||
|
||||
TArray<FVector> GetFingerThimbleOffset() const;
|
||||
bool IsImuParsed() const;
|
||||
|
||||
public:
|
||||
bool Equals(const FSGSenseGloveHandProfileImpl& SenseGloveHandProfileImpl) const;
|
||||
float GetBatteryLevel() const;
|
||||
|
||||
void Reset();
|
||||
bool IsCharging() const;
|
||||
|
||||
public:
|
||||
FString Serialize() const;
|
||||
bool Equals(const FSGNova2GloveSensorDataImpl& Nova2GloveSensorDataImpl) const;
|
||||
|
||||
public:
|
||||
FString ToString() const;
|
||||
};
|
||||
@@ -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
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Containers/Array.h"
|
||||
#include "Math/Vector.h"
|
||||
|
||||
class FSGNovaGloveHandProfileImpl;
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
namespace Calibration
|
||||
{
|
||||
class NovaGloveCalibration;
|
||||
}
|
||||
}
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGNovaGloveCalibrationImpl final
|
||||
{
|
||||
public:
|
||||
typedef SGCore::Calibration::NovaGloveCalibration FNovaGloveCalibrationType;
|
||||
|
||||
public:
|
||||
static void ApplyDefaultCalibrationInterpolationValues(
|
||||
const TArray<FVector>& RetractedValues,
|
||||
const TArray<FVector>& ExtendedValues,
|
||||
const FSGNovaGloveHandProfileImpl& Profile);
|
||||
|
||||
static void ApplyInterpolationValues(
|
||||
const TArray<FVector>& RetractedValues,
|
||||
const TArray<FVector>& ExtendedValues,
|
||||
const TArray<TArray<FVector>>& RetractedAngles,
|
||||
const TArray<TArray<FVector>>& ExtendedAngles,
|
||||
const FSGNovaGloveHandProfileImpl& Profile);
|
||||
|
||||
public:
|
||||
FSGNovaGloveCalibrationImpl() = delete;
|
||||
virtual ~FSGNovaGloveCalibrationImpl() = delete;
|
||||
};
|
||||
@@ -1,131 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @author Mamadou Babaei <mamadou@senseglove.com>
|
||||
*
|
||||
* @section LICENSE
|
||||
*
|
||||
* (The MIT License)
|
||||
*
|
||||
* Copyright (c) 2020 - 2024 NovaGlove
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* @section DESCRIPTION
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Containers/UnrealString.h"
|
||||
#include "Templates/UniquePtr.h"
|
||||
|
||||
#include "SGBuildHacks/SGPlatform.h"
|
||||
|
||||
class FSGHandInterpolatorImpl;
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
namespace Nova
|
||||
{
|
||||
class NovaGloveHandProfile;
|
||||
}
|
||||
}
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGNovaGloveHandProfileImpl final
|
||||
{
|
||||
public:
|
||||
typedef SGCore::Nova::NovaGloveHandProfile FNovaGloveHandProfileType;
|
||||
|
||||
public:
|
||||
static FSGNovaGloveHandProfileImpl Default(bool bRightHanded);
|
||||
|
||||
static FSGNovaGloveHandProfileImpl Deserialize(const FString& SerializedString);
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
|
||||
struct FImplDeleter
|
||||
{
|
||||
void operator()(const FImpl* P) const;
|
||||
};
|
||||
|
||||
TUniquePtr<FImpl, FImplDeleter> Pimpl;
|
||||
FImplDeleter PimplDeleter;
|
||||
|
||||
public:
|
||||
FSGNovaGloveHandProfileImpl();
|
||||
|
||||
FSGNovaGloveHandProfileImpl(bool bRightHanded, const FSGHandInterpolatorImpl& Interpolator);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast from underlying type constructor.
|
||||
*/
|
||||
explicit FSGNovaGloveHandProfileImpl(const FNovaGloveHandProfileType& NovaGloveHandProfile);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy constructor.
|
||||
*/
|
||||
FSGNovaGloveHandProfileImpl(const FSGNovaGloveHandProfileImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move constructor.
|
||||
*/
|
||||
FSGNovaGloveHandProfileImpl(FSGNovaGloveHandProfileImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The destructor.
|
||||
*/
|
||||
virtual ~FSGNovaGloveHandProfileImpl();
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy assignment operator.
|
||||
*/
|
||||
FSGNovaGloveHandProfileImpl& operator=(const FSGNovaGloveHandProfileImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move assignment operator.
|
||||
*/
|
||||
FSGNovaGloveHandProfileImpl& operator=(FSGNovaGloveHandProfileImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
const FNovaGloveHandProfileType& ToNovaGloveHandProfile() const;
|
||||
|
||||
public:
|
||||
bool IsRight() const;
|
||||
|
||||
FSGHandInterpolatorImpl GetInterpolationSet() const;
|
||||
|
||||
public:
|
||||
bool Equals(const FSGNovaGloveHandProfileImpl& NovaGloveHandProfileImpl) const;
|
||||
|
||||
void Reset();
|
||||
|
||||
public:
|
||||
FString Serialize() const;
|
||||
};
|
||||
@@ -38,6 +38,8 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "Containers/Array.h"
|
||||
#include "Containers/UnrealString.h"
|
||||
#include "Math/Quat.h"
|
||||
#include "Math/Vector.h"
|
||||
#include "Runtime/Launch/Resources/Version.h"
|
||||
@@ -56,14 +58,13 @@ namespace SGCore
|
||||
}
|
||||
|
||||
class FSGBasicHandModelImpl;
|
||||
class FSGBuzzCommandImpl;
|
||||
class FSGForceFeedbackCommandImpl;
|
||||
class FSGHandInterpolatorImpl;
|
||||
class FSGHandPoseImpl;
|
||||
class FSGHandProfileImpl;
|
||||
class FSGNovaGloveHandProfileImpl;
|
||||
class FSGNovaGloveInfoImpl;
|
||||
class FSGNovaGloveSensorDataImpl;
|
||||
class FSGThumperCommandImpl;
|
||||
class FSGSensorNormalizationImpl;
|
||||
class FSGThresholdCommandImpl;
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGNovaGloveImpl final : public FSGHapticGloveImpl
|
||||
{
|
||||
@@ -81,16 +82,6 @@ public:
|
||||
typedef std::shared_ptr<FNovaGloveType> FNovaGlovePtrType;
|
||||
typedef std::vector<FNovaGlovePtrType> FNovaGlovePtrVectorType;
|
||||
|
||||
public:
|
||||
static ANSICHAR GetHapticsByte();
|
||||
|
||||
static const FVector& GetMinCalibrationRange();
|
||||
|
||||
public:
|
||||
static FSGHandPoseImpl CalculateHandPose(const FSGBasicHandModelImpl& HandModel,
|
||||
const FSGNovaGloveSensorDataImpl& NovaData,
|
||||
const FSGNovaGloveHandProfileImpl& Profile);
|
||||
|
||||
public:
|
||||
static TSharedRef<FSGDeviceImpl> Parse(const FString& ConstantsString);
|
||||
|
||||
@@ -100,12 +91,6 @@ public:
|
||||
|
||||
static bool GetNovaGlove(bool bRightHanded, FSGNovaGloveImpl& OutGlove);
|
||||
|
||||
public:
|
||||
static TArray<FVector> GetCalibrationValues(const FSGNovaGloveSensorDataImpl& SensorData);
|
||||
|
||||
static void CalibrateInterpolation(const TArray<FVector>& MinValues, const TArray<FVector>& MaxValues,
|
||||
FSGNovaGloveHandProfileImpl& OutProfile);
|
||||
|
||||
public:
|
||||
static void CalculateGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
|
||||
ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded,
|
||||
@@ -116,11 +101,29 @@ public:
|
||||
FVector& OutWristPosition, FQuat& OutWristRotation);
|
||||
|
||||
public:
|
||||
static FString ToBytes(const FSGThumperCommandImpl& ThumperCommand);
|
||||
static ANSICHAR GetHapticsByte();
|
||||
|
||||
static FString ToBytes(const FSGForceFeedbackCommandImpl& ForceFeedbackCommand);
|
||||
static ANSICHAR GetThresholdsByte();
|
||||
|
||||
static FString ToBytes(const FSGBuzzCommandImpl& BuzzCommand);
|
||||
static ANSICHAR GetIgnoreThresholdsByte();
|
||||
|
||||
static const TArray<float>& GetNovaSensorRanges();
|
||||
|
||||
public:
|
||||
static TArray<float> ToNormalizedValues(const FSGNovaGloveSensorDataImpl& SensorData);
|
||||
|
||||
static TArray<float> ToNormalizedValues(
|
||||
const FSGNovaGloveSensorDataImpl& SensorData, FSGSensorNormalizationImpl& OutSensorNormalizer);
|
||||
|
||||
public:
|
||||
static TArray<TArray<FVector>> CalculateHandAngles(
|
||||
const TArray<float>& NormalizedValues, const FSGHandInterpolatorImpl& Interpolator);
|
||||
|
||||
public:
|
||||
static FString ToNovaCommandAsFlexion(const FSGThresholdCommandImpl& Thresholds);
|
||||
|
||||
static FString ToNovaCommandAsRaw(
|
||||
const FSGThresholdCommandImpl& Thresholds, const FSGSensorNormalizationImpl& Interpolator);
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
@@ -204,6 +207,9 @@ public:
|
||||
|
||||
virtual int32 GetSubFirmwareVersion() const override;
|
||||
|
||||
public:
|
||||
virtual void SetDeviceIndex(int32 NewIndex) override;
|
||||
|
||||
public:
|
||||
virtual bool HasBattery() const override;
|
||||
|
||||
@@ -212,40 +218,37 @@ public:
|
||||
virtual bool GetBatteryLevel(float& OutBatteryLevel) override;
|
||||
|
||||
public:
|
||||
bool GetSensorData(FSGNovaGloveSensorDataImpl& OutSensorData);
|
||||
virtual bool IsRight() const override;
|
||||
|
||||
virtual bool GetImuRotation(FQuat& OutImu) override;
|
||||
|
||||
/// HACK
|
||||
/// 'FSGNovaGloveImpl::GetHandPose' hides overloaded virtual functions [-Werror,-Woverloaded-virtual]
|
||||
/// tell the compiler we want both the GetHandPose from FSGHapticGloveImpl and FSGNovaGloveImpl
|
||||
using FSGHapticGloveImpl::GetHandPose;
|
||||
virtual bool GetHandPose(const FSGBasicHandModelImpl& HandGeometry, FSGHandPoseImpl& OutHandPose) const override;
|
||||
|
||||
bool GetHandPose(const FSGBasicHandModelImpl& HandModel, const FSGNovaGloveHandProfileImpl& Profile,
|
||||
FSGHandPoseImpl& OutHandPose);
|
||||
|
||||
virtual bool GetHandPose(const FSGBasicHandModelImpl& HandGeometry, const FSGHandProfileImpl& HandProfile,
|
||||
FSGHandPoseImpl& OutHandPose) override;
|
||||
|
||||
virtual bool GetHandPose(const FSGHandProfileImpl& HandProfile, FSGHandPoseImpl& OutHandPose) override;
|
||||
virtual bool GetHandAngles(TArray<TArray<FVector>>& OutHandAngles) const override;
|
||||
|
||||
public:
|
||||
virtual void SendHaptics(const FSGForceFeedbackCommandImpl& ForceFeedbackCommand,
|
||||
const FSGBuzzCommandImpl& BuzzCommand,
|
||||
const FSGThumperCommandImpl& ThumperCommand) override;
|
||||
virtual ESGHapticGloveCalibrationState GetCalibrationState() const override;
|
||||
|
||||
virtual void SendHaptics(const FSGForceFeedbackCommandImpl& ForceFeedbackCommand) override;
|
||||
virtual void EndCalibration() override;
|
||||
|
||||
virtual void SendHaptics(const FSGBuzzCommandImpl& BuzzCommand) override;
|
||||
|
||||
virtual void SendHaptics(const FSGThumperCommandImpl& ThumperCommand) override;
|
||||
virtual void ResetCalibration() override;
|
||||
|
||||
public:
|
||||
virtual bool GetCalibrationValues(TArray<FVector>& OutValues) override;
|
||||
virtual void StopHaptics() override;
|
||||
|
||||
virtual void ApplyCalibration(FSGHandProfileImpl& OutProfile) const override;
|
||||
virtual void StopVibrations() override;
|
||||
|
||||
void ApplyCalibration(FSGNovaGloveHandProfileImpl& OutProfile) const;
|
||||
virtual bool SendHaptics() override;
|
||||
|
||||
public:
|
||||
virtual bool SupportsCustomWaveform(ESGHapticLocation AtLocation) const override;
|
||||
|
||||
virtual bool SendCustomWaveform(FSGCustomWaveformImpl& OutWaveform, ESGHapticLocation Location) override;
|
||||
|
||||
public:
|
||||
virtual bool QueueForceFeedbackLevels(const TArray<float>& Levels01) override;
|
||||
|
||||
virtual bool QueueForceFeedbackLevel(int32 Finger, float Level01) override;
|
||||
|
||||
public:
|
||||
virtual void GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
|
||||
@@ -256,6 +259,45 @@ public:
|
||||
ESGPositionalTrackingHardware TrackingHardware,
|
||||
FVector& OutWristPosition, FQuat& OutWristRotation) const override;
|
||||
|
||||
public:
|
||||
FSGNovaGloveInfoImpl GetGloveInfo() const;
|
||||
|
||||
bool SupportsThresholds() const;
|
||||
|
||||
bool SupportsCustomWaveforms() const;
|
||||
|
||||
bool SupportsOnBoardNormalization() const;
|
||||
|
||||
public:
|
||||
bool GetSensorData(FSGNovaGloveSensorDataImpl& OutSensorData) const;
|
||||
|
||||
bool GetNormalizedInput(TArray<float>& OutNormalizedValues) const;
|
||||
|
||||
public:
|
||||
virtual FString ToNovaCommand(
|
||||
const TArray<float>& ForceFeedbackLevels, const TArray<float>& BuzzLevels, float WristLevel) const;
|
||||
|
||||
virtual bool QueueVibroLevels(const TArray<float>& Amplitudes);
|
||||
|
||||
virtual bool QueueVibroLevel(int32 Finger, float Amplitude);
|
||||
|
||||
virtual bool QueueWristLevel(float Amplitude);
|
||||
|
||||
public:
|
||||
virtual ESGNovaVibroMotor ToNovaMotor(ESGHapticLocation Location) const;
|
||||
|
||||
virtual int32 ChannelIndex(ESGNovaVibroMotor Motor) const;
|
||||
|
||||
virtual void ValidateWaveform(FSGCustomWaveformImpl& OutWaveform, ESGNovaVibroMotor Motor) const;
|
||||
|
||||
virtual bool SendCustomWaveform_Nova(FSGCustomWaveformImpl& OutWaveform, ESGNovaVibroMotor Motor,
|
||||
bool bValidateWaveform = true);
|
||||
|
||||
public:
|
||||
bool QueueThresholdCommand_Flexion(int32 Finger, float FlexionThreshold);
|
||||
|
||||
virtual bool QueueClearThreshold(int32 Finger);
|
||||
|
||||
public:
|
||||
virtual FString ToString() const override;
|
||||
};
|
||||
@@ -131,6 +131,11 @@ public:
|
||||
|
||||
int32 GetNumberOfSensors() const;
|
||||
|
||||
public:
|
||||
bool FirmwareNewerThan(int32 FirmwareMain, int32 FirmwareSub, bool bInclusive) const;
|
||||
|
||||
bool FirmwareOlderThan(int32 FirmwareMain, int32 FirmwareSub, bool bInclusive) const;
|
||||
|
||||
public:
|
||||
bool Equals(const FSGNovaGloveInfoImpl& SGNovaGloveInfo) const;
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "Templates/UniquePtr.h"
|
||||
|
||||
#include "SGBuildHacks/SGPlatform.h"
|
||||
#include "SGTypes/SGCoreTypes.h"
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
@@ -121,12 +122,16 @@ public:
|
||||
const FNovaGloveSensorDataType& ToNovaGloveSensorData() const;
|
||||
|
||||
public:
|
||||
TArray<FVector> GetSensorValues() const;
|
||||
ESGNormalizationState GetSensorState() const;
|
||||
|
||||
FQuat GetImuRotation() const;
|
||||
TArray<FVector> GetSensorValues() const;
|
||||
float GetSensorValue(ESGFinger Finger, ESGNovaSensorLocation Location) const;
|
||||
|
||||
int32 GetParsedValues() const;
|
||||
|
||||
public:
|
||||
FQuat GetImuRotation() const;
|
||||
|
||||
bool IsImuParsed() const;
|
||||
|
||||
public:
|
||||
|
||||
@@ -57,15 +57,13 @@ namespace SGCore
|
||||
}
|
||||
|
||||
class FSGBasicHandModelImpl;
|
||||
class FSGBuzzCommandImpl;
|
||||
class FSGForceFeedbackCommandImpl;
|
||||
class FSGHandInterpolatorImpl;
|
||||
class FSGHandPoseImpl;
|
||||
class FSGHandProfileImpl;
|
||||
class FSGSenseGloveHandProfileImpl;
|
||||
class FSGSenseGloveInfoImpl;
|
||||
class FSGSenseGlovePoseImpl;
|
||||
class FSGSenseGloveSensorDataImpl;
|
||||
class FSGThumperCommandImpl;
|
||||
class FSGSenseGloveSensorNormalizerImpl;
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGSenseGloveImpl final : public FSGHapticGloveImpl
|
||||
{
|
||||
@@ -83,22 +81,6 @@ public:
|
||||
typedef std::shared_ptr<FSenseGloveType> FSenseGlovePtrType;
|
||||
typedef std::vector<FSenseGlovePtrType> FSenseGlovePtrVectorType;
|
||||
|
||||
public:
|
||||
static ANSICHAR GetHapticsByte();
|
||||
|
||||
static ANSICHAR GetThumperByte();
|
||||
|
||||
public:
|
||||
static FSGSenseGlovePoseImpl CalculateGlovePose(const FSGSenseGloveSensorDataImpl& SensorData,
|
||||
const FSGSenseGloveInfoImpl& GloveModel);
|
||||
|
||||
static FSGSenseGlovePoseImpl CalculateGlovePose(const TArray<TArray<FVector>>& GloveAngles,
|
||||
const FSGSenseGloveInfoImpl& GloveModel);
|
||||
|
||||
static FSGHandPoseImpl CalculateHandPose(const FSGSenseGlovePoseImpl& GlovePose,
|
||||
const FSGBasicHandModelImpl& HandModel,
|
||||
const FSGSenseGloveHandProfileImpl& Profile);
|
||||
|
||||
public:
|
||||
static TSharedRef<FSGDeviceImpl> Parse(const FString& ConstantsString);
|
||||
|
||||
@@ -108,12 +90,6 @@ public:
|
||||
|
||||
static bool GetSenseGlove(bool bRightHanded, FSGSenseGloveImpl& OutGlove);
|
||||
|
||||
public:
|
||||
static TArray<FVector> GetCalibrationValues(const FSGSenseGlovePoseImpl& GlovePose);
|
||||
|
||||
static void CalibrateInterpolation(const TArray<FVector>& MinValues, const TArray<FVector>& MaxValues,
|
||||
bool bRightHanded, FSGSenseGloveHandProfileImpl& OutProfile);
|
||||
|
||||
public:
|
||||
static void CalculateGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
|
||||
ESGPositionalTrackingHardware TrackingHardware,
|
||||
@@ -127,6 +103,34 @@ public:
|
||||
const FQuat& GloveWristRotationOffset,
|
||||
FVector& OutWristPosition, FQuat& OutWristRotation);
|
||||
|
||||
public:
|
||||
static ANSICHAR GetHapticsByte();
|
||||
|
||||
static ANSICHAR GetThumperByte();
|
||||
|
||||
static const FVector& GetDefaultThimbleOffset();
|
||||
|
||||
public:
|
||||
static FSGSenseGlovePoseImpl CalculateGlovePose(const FSGSenseGloveSensorDataImpl& SensorData,
|
||||
const FSGSenseGloveInfoImpl& GloveModel);
|
||||
|
||||
static FSGSenseGlovePoseImpl CalculateGlovePose(const TArray<TArray<FVector>>& GloveAngles,
|
||||
const FSGSenseGloveInfoImpl& GloveModel);
|
||||
|
||||
static void NormalizeValues(const TArray<FVector>& SumAngles,
|
||||
const FSGSenseGloveSensorNormalizerImpl& Normalizer,
|
||||
TArray<float>& OutFlexions, TArray<float>& OutAbductions);
|
||||
|
||||
public:
|
||||
static void CalculateHandAngles(
|
||||
const FSGSenseGlovePoseImpl& GlovePose, const FSGSenseGloveSensorNormalizerImpl& Normalizer,
|
||||
const FSGHandInterpolatorImpl& NormalizedToAngles,
|
||||
TArray<TArray<FVector>>& OutHandAngles);
|
||||
|
||||
static void CalculateHandPose(const FSGSenseGlovePoseImpl& GlovePose, const FSGBasicHandModelImpl& HandModel,
|
||||
const FSGSenseGloveSensorNormalizerImpl& Normalizer,
|
||||
const FSGHandInterpolatorImpl& NormalizedToAngles, FSGHandPoseImpl& OutHandPose);
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
|
||||
@@ -198,11 +202,6 @@ public:
|
||||
*/
|
||||
FSenseGlovePtrType ToSenseGlovePtrChecked() const;
|
||||
|
||||
public:
|
||||
FSGSenseGloveInfoImpl GetGloveModel() const;
|
||||
|
||||
virtual bool IsRight() const override;
|
||||
|
||||
public:
|
||||
virtual ESGDeviceType GetDeviceType() const override;
|
||||
|
||||
@@ -215,55 +214,32 @@ public:
|
||||
virtual int32 GetSubFirmwareVersion() const override;
|
||||
|
||||
public:
|
||||
bool GetSensorData(FSGSenseGloveSensorDataImpl& OutSensorData) const;
|
||||
virtual bool IsRight() const override;
|
||||
|
||||
virtual bool GetImuRotation(FQuat& OutImu) override;
|
||||
|
||||
bool GetGlovePose(FSGSenseGlovePoseImpl& OutGlovePose);
|
||||
virtual bool GetHandPose(const FSGBasicHandModelImpl& HandGeometry, FSGHandPoseImpl& OutHandPose) const override;
|
||||
|
||||
bool GetGlovePose(const FSGSenseGloveSensorDataImpl& SensorData, FSGSenseGlovePoseImpl& OutGlovePose);
|
||||
|
||||
/// HACK
|
||||
/// 'FSGSenseGloveImpl::GetHandPose' hides overloaded virtual functions [-Werror,-Woverloaded-virtual]
|
||||
/// tell the compiler we want both the GetHandPose from FSGHapticGloveImpl and FSGSenseGloveImpl
|
||||
using FSGHapticGloveImpl::GetHandPose;
|
||||
|
||||
bool GetHandPose(const FSGBasicHandModelImpl& HandModel, const FSGSenseGloveHandProfileImpl& Profile,
|
||||
FSGHandPoseImpl& OutHandPose);
|
||||
|
||||
virtual bool GetHandPose(const FSGBasicHandModelImpl& HandGeometry, const FSGHandProfileImpl& HandProfile,
|
||||
FSGHandPoseImpl& OutHandPose) override;
|
||||
|
||||
virtual bool GetHandPose(const FSGHandProfileImpl& HandProfile, FSGHandPoseImpl& OutHandPose) override;
|
||||
virtual bool GetHandAngles(TArray<TArray<FVector>>& OutHandAngles) const override;
|
||||
|
||||
public:
|
||||
/// HACK
|
||||
/// 'FSGSenseGloveImpl::SendHaptics' hides overloaded virtual functions [-Werror,-Woverloaded-virtual]
|
||||
/// tell the compiler we want both the SendHaptics from FSGHapticGloveImpl and FSGSenseGloveImpl
|
||||
using FSGHapticGloveImpl::SendHaptics;
|
||||
virtual ESGHapticGloveCalibrationState GetCalibrationState() const override;
|
||||
|
||||
bool SendHaptics(const FSGForceFeedbackCommandImpl& ForceFeedbackCommand,
|
||||
const FSGBuzzCommandImpl& BuzzCommand,
|
||||
ESGSenseGloveThumperCommand ThumperCommand = ESGSenseGloveThumperCommand::None);
|
||||
virtual void EndCalibration() override;
|
||||
|
||||
bool SendHaptics(ESGSenseGloveThumperCommand ThumperCommand);
|
||||
|
||||
virtual void SendHaptics(const FSGForceFeedbackCommandImpl& ForceFeedbackCommand) override;
|
||||
|
||||
virtual void SendHaptics(const FSGBuzzCommandImpl& BuzzCommand) override;
|
||||
|
||||
virtual void SendHaptics(const FSGForceFeedbackCommandImpl& ForceFeedbackCommand,
|
||||
const FSGBuzzCommandImpl& BuzzCommand,
|
||||
const FSGThumperCommandImpl& ThumperCommand) override;
|
||||
virtual void ResetCalibration() override;
|
||||
|
||||
public:
|
||||
virtual bool GetCalibrationValues(TArray<FVector>& OutValues) override;
|
||||
virtual void StopHaptics() override;
|
||||
|
||||
virtual void ResetCalibrationRange() override;
|
||||
virtual void StopVibrations() override;
|
||||
|
||||
virtual void ApplyCalibration(FSGHandProfileImpl& OutProfile) const override;
|
||||
virtual bool SendHaptics() override;
|
||||
|
||||
void ApplyCalibration(FSGSenseGloveHandProfileImpl& OutProfile) const;
|
||||
public:
|
||||
virtual bool QueueForceFeedbackLevels(const TArray<float>& Levels01) override;
|
||||
|
||||
virtual bool QueueForceFeedbackLevel(int32 Finger, float Level01) override;
|
||||
|
||||
public:
|
||||
virtual void GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation,
|
||||
@@ -284,6 +260,29 @@ public:
|
||||
const FQuat& GloveWristRotationOffset,
|
||||
FVector& OutWristPosition, FQuat& OutWristRotation) const;
|
||||
|
||||
public:
|
||||
FSGSenseGloveInfoImpl GetGloveInfo() const;
|
||||
|
||||
TArray<FVector> GetFingerThimbleOffsets() const;
|
||||
|
||||
void SetFingerThimbleOffset(int32 Finger, const FVector& Offset);
|
||||
|
||||
bool SupportsWristActuator() const;
|
||||
|
||||
public:
|
||||
bool GetSensorData(FSGSenseGloveSensorDataImpl& OutSensorData) const;
|
||||
|
||||
bool GetGlovePose(FSGSenseGlovePoseImpl& OutGlovePose) const;
|
||||
|
||||
bool GetGlovePose(const FSGSenseGloveSensorDataImpl& SensorData, FSGSenseGlovePoseImpl& OutGlovePose) const;
|
||||
|
||||
public:
|
||||
virtual bool QueueVibroLevels(const TArray<float>& Amplitudes);
|
||||
|
||||
virtual bool QueueVibroLevel(int32 Finger, float Amplitude);
|
||||
|
||||
virtual bool QueueThumperCommand(ESGSenseGloveThumperCommand Command);
|
||||
|
||||
public:
|
||||
virtual FString ToString() const override;
|
||||
};
|
||||
@@ -137,9 +137,7 @@ public:
|
||||
|
||||
TArray<FVector> GetTotalGloveAngles() const;
|
||||
|
||||
TArray<FVector> CalculateFingerTips(const FSGSenseGloveHandProfileImpl& SenseGloveHandProfileImpl) const;
|
||||
|
||||
TArray<FVector> CalculateFingerTips(const TArray<FVector>& FingerOffsets) const;
|
||||
TArray<FVector> CalculateFingertips(const TArray<FVector>& FingerOffsets) const;
|
||||
|
||||
bool Equals(const FSGSenseGlovePoseImpl& SenseGlovePoseImpl) const;
|
||||
|
||||
|
||||
@@ -77,8 +77,8 @@ private:
|
||||
public:
|
||||
FSGSenseGloveSensorDataImpl();
|
||||
|
||||
FSGSenseGloveSensorDataImpl(const TArray<TArray<float>>& SensorAngles, const FQuat& ImuRotation, int32 ParsedValues,
|
||||
bool bImuParsed);
|
||||
FSGSenseGloveSensorDataImpl(const TArray<TArray<float>>& SensorAngles, const FQuat& ImuRotation,
|
||||
int32 ParsedValues, bool bImuParsed);
|
||||
|
||||
public:
|
||||
/**
|
||||
|
||||
+17
-19
@@ -35,23 +35,24 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Containers/UnrealString.h"
|
||||
#include "Templates/UniquePtr.h"
|
||||
|
||||
#include "SGBuildHacks/SGPlatform.h"
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
namespace Calibration
|
||||
namespace SG
|
||||
{
|
||||
class CalibrationDataPoint;
|
||||
class SenseGloveSensorNormalizer;
|
||||
}
|
||||
}
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGCalibrationDataPointImpl final
|
||||
class FSGSenseGloveInfoImpl;
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGSenseGloveSensorNormalizerImpl final
|
||||
{
|
||||
public:
|
||||
typedef SGCore::Calibration::CalibrationDataPoint FCalibrationDataPointType;
|
||||
typedef SGCore::SG::SenseGloveSensorNormalizer FSenseGloveSensorNormalizerType;
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
@@ -65,55 +66,52 @@ private:
|
||||
FImplDeleter PimplDeleter;
|
||||
|
||||
public:
|
||||
FSGCalibrationDataPointImpl();
|
||||
FSGSenseGloveSensorNormalizerImpl();
|
||||
|
||||
FSGCalibrationDataPointImpl(int32 CurrentStage, const TArray<FVector>& CalibrationValues);
|
||||
explicit FSGSenseGloveSensorNormalizerImpl(bool bRightHanded);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast from underlying type constructor.
|
||||
*/
|
||||
explicit FSGCalibrationDataPointImpl(const FCalibrationDataPointType& CalibrationDataPoint);
|
||||
explicit FSGSenseGloveSensorNormalizerImpl(const FSenseGloveSensorNormalizerType& SenseGloveSensorNormalizer);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy constructor.
|
||||
*/
|
||||
FSGCalibrationDataPointImpl(const FSGCalibrationDataPointImpl& Rhs);
|
||||
FSGSenseGloveSensorNormalizerImpl(const FSGSenseGloveSensorNormalizerImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move constructor.
|
||||
*/
|
||||
FSGCalibrationDataPointImpl(FSGCalibrationDataPointImpl&& Rhs) SG_NOEXCEPT;
|
||||
FSGSenseGloveSensorNormalizerImpl(FSGSenseGloveSensorNormalizerImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The destructor.
|
||||
*/
|
||||
virtual ~FSGCalibrationDataPointImpl();
|
||||
virtual ~FSGSenseGloveSensorNormalizerImpl();
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy assignment operator.
|
||||
*/
|
||||
FSGCalibrationDataPointImpl& operator=(const FSGCalibrationDataPointImpl& Rhs);
|
||||
FSGSenseGloveSensorNormalizerImpl& operator=(const FSGSenseGloveSensorNormalizerImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move assignment operator.
|
||||
*/
|
||||
FSGCalibrationDataPointImpl& operator=(FSGCalibrationDataPointImpl&& Rhs) SG_NOEXCEPT;
|
||||
FSGSenseGloveSensorNormalizerImpl& operator=(FSGSenseGloveSensorNormalizerImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
const FCalibrationDataPointType& ToCalibrationDataPoint() const;
|
||||
const FSenseGloveSensorNormalizerType& ToSenseGloveSensorNormalizer() const;
|
||||
|
||||
public:
|
||||
TArray<FVector> GetCalibrationValues() const;
|
||||
float NormalizeFlexion(int32 Finger, float SumFlexionAngles) const;
|
||||
|
||||
int32 GetStage() const;
|
||||
|
||||
public:
|
||||
FString ToLogData(const FString& Delimiter = "\t") const;
|
||||
float NormalizeAbduction(int32 Finger, float SumAbductionAngles) const;
|
||||
};
|
||||
+42
-23
@@ -35,26 +35,25 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "HAL/Platform.h"
|
||||
#include "Containers/Array.h"
|
||||
#include "Templates/UniquePtr.h"
|
||||
|
||||
#include "SGBuildHacks/SGPlatform.h"
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
namespace Haptics
|
||||
namespace Util
|
||||
{
|
||||
class ThumperCommand;
|
||||
class SensorNormalization;
|
||||
}
|
||||
}
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGThumperCommandImpl final
|
||||
class FSGSenseGloveInfoImpl;
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGSensorNormalizationImpl final
|
||||
{
|
||||
public:
|
||||
typedef SGCore::Haptics::ThumperCommand FThumperCommandType;
|
||||
|
||||
public:
|
||||
static const FSGThumperCommandImpl& Off();
|
||||
typedef SGCore::Util::SensorNormalization FSensorNormalizationType;
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
@@ -68,56 +67,76 @@ private:
|
||||
FImplDeleter PimplDeleter;
|
||||
|
||||
public:
|
||||
FSGThumperCommandImpl();
|
||||
explicit FSGThumperCommandImpl(int32 Magnitude);
|
||||
FSGSensorNormalizationImpl();
|
||||
|
||||
explicit FSGSensorNormalizationImpl(const TArray<float>& MovementRanges);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast from underlying type constructor.
|
||||
*/
|
||||
explicit FSGThumperCommandImpl(const FThumperCommandType& ThumperCommand);
|
||||
explicit FSGSensorNormalizationImpl(const FSensorNormalizationType& SensorNormalization);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy constructor.
|
||||
*/
|
||||
FSGThumperCommandImpl(const FSGThumperCommandImpl& Rhs);
|
||||
FSGSensorNormalizationImpl(const FSGSensorNormalizationImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move constructor
|
||||
* The move constructor.
|
||||
*/
|
||||
FSGThumperCommandImpl(FSGThumperCommandImpl&& Rhs) SG_NOEXCEPT;
|
||||
FSGSensorNormalizationImpl(FSGSensorNormalizationImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The destructor.
|
||||
*/
|
||||
virtual ~FSGThumperCommandImpl();
|
||||
virtual ~FSGSensorNormalizationImpl();
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy assignment operator.
|
||||
*/
|
||||
FSGThumperCommandImpl& operator=(const FSGThumperCommandImpl& Rhs);
|
||||
FSGSensorNormalizationImpl& operator=(const FSGSensorNormalizationImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move assignment operator.
|
||||
*/
|
||||
FSGThumperCommandImpl& operator=(FSGThumperCommandImpl&& Rhs) SG_NOEXCEPT;
|
||||
FSGSensorNormalizationImpl& operator=(FSGSensorNormalizationImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
const FThumperCommandType& ToThumperCommand() const;
|
||||
const FSensorNormalizationType& ToSensorNormalization() const;
|
||||
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
FSensorNormalizationType& ToSensorNormalization();
|
||||
|
||||
public:
|
||||
int32 GetMagnitude() const;
|
||||
void SetMagnitude(int32 Magnitude);
|
||||
bool CollectsNormalization() const;
|
||||
|
||||
FSGThumperCommandImpl Copy() const;
|
||||
void SetCollectNormalization(bool bCollectNormalization);
|
||||
|
||||
FSGThumperCommandImpl Merge(const FSGThumperCommandImpl& ThumperCommandImpl) const;
|
||||
public:
|
||||
int32 GetLength() const;
|
||||
|
||||
virtual bool Equals(const FSGThumperCommandImpl& ThumperCommandImpl) const;
|
||||
int32 GetMoveCount() const;
|
||||
|
||||
bool AllSensorsMoving() const;
|
||||
|
||||
void ResetNormalization();
|
||||
|
||||
void UpdateNormalization(float Value, int32 Index);
|
||||
|
||||
float NormalizeValue(float Value, int32 Index);
|
||||
|
||||
TArray<float> NormalizeValues(const TArray<float>& Values);
|
||||
|
||||
bool MovedEnough(int32 Index) const;
|
||||
|
||||
float Denormalize(float Value01, int32 Index, float FallbackValue = 1.0f) const;
|
||||
};
|
||||
+34
-37
@@ -35,33 +35,26 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Containers/Array.h"
|
||||
#include "Containers/UnrealString.h"
|
||||
#include "Math/Vector.h"
|
||||
#include "Templates/UniquePtr.h"
|
||||
|
||||
#include "SGBuildHacks/SGPlatform.h"
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
namespace Calibration
|
||||
namespace Haptics
|
||||
{
|
||||
class SensorRange;
|
||||
class ThresholdCommand;
|
||||
}
|
||||
}
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGSensorRangeImpl final
|
||||
class FSGSenseGloveInfoImpl;
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGThresholdCommandImpl final
|
||||
{
|
||||
public:
|
||||
typedef SGCore::Calibration::SensorRange FSensorRangeType;
|
||||
|
||||
public:
|
||||
static const FSGSensorRangeImpl& ForCalibration();
|
||||
|
||||
static FSGSensorRangeImpl Deserialize(const FString& SerializedString);
|
||||
|
||||
static void CheckMax(const FVector CurrentValues, FVector& OutMaxValues);
|
||||
|
||||
static void CheckMin(const FVector& CurrentValues, FVector& OutMinValues);
|
||||
typedef SGCore::Haptics::ThresholdCommand FThresholdCommandType;
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
@@ -75,70 +68,74 @@ private:
|
||||
FImplDeleter PimplDeleter;
|
||||
|
||||
public:
|
||||
FSGSensorRangeImpl();
|
||||
|
||||
FSGSensorRangeImpl(const TArray<FVector>& MinValues, const TArray<FVector>& MaxValues);
|
||||
FSGThresholdCommandImpl();
|
||||
FSGThresholdCommandImpl(const TArray<bool>& AffectedFingers, const TArray<float>& ThresholdValues);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast from underlying type constructor.
|
||||
*/
|
||||
explicit FSGSensorRangeImpl(const FSensorRangeType& SensorRange);
|
||||
explicit FSGThresholdCommandImpl(const FThresholdCommandType& ThresholdCommand);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy constructor.
|
||||
*/
|
||||
FSGSensorRangeImpl(const FSGSensorRangeImpl& Rhs);
|
||||
FSGThresholdCommandImpl(const FSGThresholdCommandImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move constructor.
|
||||
*/
|
||||
FSGSensorRangeImpl(FSGSensorRangeImpl&& Rhs) SG_NOEXCEPT;
|
||||
FSGThresholdCommandImpl(FSGThresholdCommandImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The destructor.
|
||||
*/
|
||||
virtual ~FSGSensorRangeImpl();
|
||||
virtual ~FSGThresholdCommandImpl();
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy assignment operator.
|
||||
*/
|
||||
FSGSensorRangeImpl& operator=(const FSGSensorRangeImpl& Rhs);
|
||||
FSGThresholdCommandImpl& operator=(const FSGThresholdCommandImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move assignment operator.
|
||||
*/
|
||||
FSGSensorRangeImpl& operator=(FSGSensorRangeImpl&& Rhs) SG_NOEXCEPT;
|
||||
FSGThresholdCommandImpl& operator=(FSGThresholdCommandImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
const FSensorRangeType& ToSensorRange() const;
|
||||
const FThresholdCommandType& ToThresholdCommand() const;
|
||||
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
FThresholdCommandType& ToThresholdCommand();
|
||||
|
||||
public:
|
||||
TArray<FVector> GetMinValues() const;
|
||||
float GetThreshold(int32 Finger) const;
|
||||
|
||||
void SetMinValues(const TArray<FVector>& Values);
|
||||
void SetThreshold(int32 Finger, float ThresholdValue);
|
||||
|
||||
TArray<FVector> GetMaxValues() const;
|
||||
TArray<float> GetThresholds() const;
|
||||
|
||||
void SetMaxValues(const TArray<FVector>& Values);
|
||||
void SetThresholds(const TArray<bool>& AffectedFingers, const TArray<float>& ThresholdValues);
|
||||
|
||||
TArray<FVector> GetRange() const;
|
||||
bool GetFingerActive(int32 Finger) const;
|
||||
|
||||
TArray<bool> GetActiveFingers() const;
|
||||
|
||||
void ClearThreshold(int32 Finger);
|
||||
|
||||
void ClearThresholds();
|
||||
|
||||
public:
|
||||
void UpdateRange();
|
||||
|
||||
void CheckForExtremes(const TArray<FVector>& OtherValues);
|
||||
bool Equals(const FSGThresholdCommandImpl& ThresholdCommand) const;
|
||||
|
||||
public:
|
||||
FString RangeString(bool bYOnly = true) const;
|
||||
|
||||
FString ToString(bool bYOnly = true) const;
|
||||
|
||||
FString Serialize() const;
|
||||
FString ToString() const;
|
||||
};
|
||||
@@ -1,163 +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/UnrealString.h"
|
||||
#include "HAL/Platform.h"
|
||||
#include "Templates/SharedPointer.h"
|
||||
#include "Templates/UniquePtr.h"
|
||||
|
||||
#include "SGBuildHacks/SGPlatform.h"
|
||||
#include "SGCoreImpl/SGBuzzCommandImpl.h"
|
||||
#include "SGTypes/SGCoreTypes.h"
|
||||
|
||||
namespace SGCore
|
||||
{
|
||||
namespace Haptics
|
||||
{
|
||||
class TimedBuzzCommand;
|
||||
}
|
||||
}
|
||||
|
||||
class SENSEGLOVECOREIMPL_API FSGTimedBuzzCommandImpl final : public FSGBuzzCommandImpl
|
||||
{
|
||||
public:
|
||||
typedef SGCore::Haptics::TimedBuzzCommand FTimedBuzzCommandType;
|
||||
|
||||
private:
|
||||
struct FImpl;
|
||||
|
||||
struct FImplDeleter
|
||||
{
|
||||
void operator()(const FImpl* P) const;
|
||||
};
|
||||
|
||||
TUniquePtr<FImpl, FImplDeleter> Pimpl;
|
||||
FImplDeleter PimplDeleter;
|
||||
|
||||
public:
|
||||
FSGTimedBuzzCommandImpl();
|
||||
|
||||
public:
|
||||
FSGTimedBuzzCommandImpl(ESGFinger Finger, int32 Magnitude, float DurationSeconds, float StartTimeSeconds = 0.0f);
|
||||
|
||||
FSGTimedBuzzCommandImpl(const FSGBuzzCommandImpl& BaseCommand, float DurationSeconds,
|
||||
float StartTimeSeconds = 0.0f);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast from underlying type constructor.
|
||||
*/
|
||||
explicit FSGTimedBuzzCommandImpl(const FTimedBuzzCommandType& TimedBuzzCommand);
|
||||
|
||||
/**
|
||||
* The cast from underlying pointer type constructor.
|
||||
*/
|
||||
explicit FSGTimedBuzzCommandImpl(TSharedRef<FTimedBuzzCommandType> TimedBuzzCommand);
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy constructor.
|
||||
*/
|
||||
FSGTimedBuzzCommandImpl(const FSGTimedBuzzCommandImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move constructor
|
||||
*/
|
||||
FSGTimedBuzzCommandImpl(FSGTimedBuzzCommandImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The destructor.
|
||||
*/
|
||||
virtual ~FSGTimedBuzzCommandImpl();
|
||||
|
||||
public:
|
||||
/**
|
||||
* The copy assignment operator.
|
||||
*/
|
||||
FSGTimedBuzzCommandImpl& operator=(const FSGTimedBuzzCommandImpl& Rhs);
|
||||
|
||||
/**
|
||||
* The move assignment operator.
|
||||
*/
|
||||
FSGTimedBuzzCommandImpl& operator=(FSGTimedBuzzCommandImpl&& Rhs) SG_NOEXCEPT;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The cast to underlying type method.
|
||||
*/
|
||||
const FTimedBuzzCommandType& ToTimedBuzzCommand() const;
|
||||
|
||||
/**
|
||||
* The cast to underlying pointer type method.
|
||||
*/
|
||||
TSharedRef<FTimedBuzzCommandType> ToTimedBuzzCommandRef() const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The non-const cast to underlying type method.
|
||||
*/
|
||||
FTimedBuzzCommandType& ToTimedBuzzCommand();
|
||||
|
||||
/**
|
||||
* The non-const cast to underlying type method.
|
||||
*/
|
||||
TSharedRef<FTimedBuzzCommandType> ToTimedBuzzCommandRef();
|
||||
|
||||
public:
|
||||
virtual FSGBuzzCommandImpl Copy() const override;
|
||||
|
||||
virtual FSGBuzzCommandImpl Merge(const FSGBuzzCommandImpl& BuzzCommand) const override;
|
||||
|
||||
public:
|
||||
virtual FSGBuzzCommandImpl GetBaseCommand() const;
|
||||
|
||||
float GetDuration() const;
|
||||
|
||||
float GetElapsedTime() const;
|
||||
|
||||
virtual bool HasTimeElapsed() const;
|
||||
|
||||
virtual float NormalizedTime(bool bClamp01 = true) const;
|
||||
|
||||
public:
|
||||
virtual void ResetTiming();
|
||||
virtual void UpdateTiming(float DeltaSeconds);
|
||||
|
||||
public:
|
||||
virtual FString ToString() const override;
|
||||
};
|
||||
@@ -68,19 +68,14 @@ public:
|
||||
FVector& OutPositionOffset, FQuat& OutRotationOffset);
|
||||
|
||||
static const FVector& GetSenseGloveViveToAttachPosition();
|
||||
|
||||
static const FQuat& GetSenseGloveViveToAttachRotation();
|
||||
|
||||
static const FVector& GetSenseGloveOculusTouchToAttachPosition();
|
||||
|
||||
static const FQuat& GetSenseGloveOculusTouchToAttachRotation();
|
||||
|
||||
static const FVector& GetNovaToWristPositionOffset();
|
||||
|
||||
static const FQuat& GetNovaToWristRotationOffset();
|
||||
|
||||
static void GetNovaGloveWristOffset(bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset);
|
||||
|
||||
static const FVector& GetRightNovaViveToAttachPosition();
|
||||
static const FQuat& GetRightNovaViveToAttachRotation();
|
||||
|
||||
@@ -95,11 +90,64 @@ public:
|
||||
|
||||
static const FVector& GetRightNovaPico2ToAttachPosition();
|
||||
static const FQuat& GetRightNovaPico2ToAttachRotation();
|
||||
|
||||
static const FQuat& GetLeftNovaPico2ToAttachRotation();
|
||||
|
||||
static const FVector& GetRightNovaQuestProToAttachPosition();
|
||||
static const FQuat& GetRightNovaQuestProToAttachRotation();
|
||||
|
||||
static const FVector& GetLeftNovaQuestProToAttachPosition();
|
||||
static const FQuat& GetLeftNovaQuestProToAttachRotation();
|
||||
|
||||
static const FVector& GetRightNovaViveFocus3ToAttachPosition();
|
||||
static const FQuat& GetRightNovaViveFocus3ToAttachRotation();
|
||||
|
||||
static const FVector& GetLeftNovaViveFocus3ToAttachPosition();
|
||||
static const FQuat& GetLeftNovaViveFocus3ToAttachRotation();
|
||||
|
||||
static void GetNovaGloveWristOffset(bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset);
|
||||
|
||||
static void GetNovaGloveTrackerOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded,
|
||||
FVector& OutPositionOffset, FQuat& OutRotationOffset);
|
||||
|
||||
static const FVector& GetRightNova2ToWristPositionOffset();
|
||||
static const FQuat& GetRightNova2ToWristRotationOffset();
|
||||
|
||||
static const FVector& GetLeftNova2ToWristPositionOffset();
|
||||
static const FQuat& GetLeftNova2ToWristRotationOffset();
|
||||
|
||||
static const FVector& GetRightNova2Quest2ToAttachPosition();
|
||||
static const FQuat& GetRightNova2Quest2ToAttachRotation();
|
||||
|
||||
static const FVector& GetLeftNova2Quest2ToAttachPosition();
|
||||
static const FQuat& GetLeftNova2Quest2ToAttachRotation();
|
||||
|
||||
static const FVector& GetRightNova2QuestProToAttachPosition();
|
||||
static const FQuat& GetRightNova2QuestProToAttachRotation();
|
||||
|
||||
static const FVector& GetLeftNova2QuestProToAttachPosition();
|
||||
static const FQuat& GetLeftNova2QuestProToAttachRotation();
|
||||
|
||||
static const FVector& GetRightNova2ViveTrackerToAttachPosition();
|
||||
static const FQuat& GetRightNova2ViveTrackerToAttachRotation();
|
||||
|
||||
static const FVector& GetLeftNova2ViveTrackerToAttachPosition();
|
||||
static const FQuat& GetLeftNova2ViveTrackerToAttachRotation();
|
||||
|
||||
static const FVector& GetRightNova2ViveWristTrackerToAttachPosition();
|
||||
static const FQuat& GetRightNova2ViveWristTrackerToAttachRotation();
|
||||
|
||||
static const FVector& GetLeftNova2ViveWristTrackerToAttachPosition();
|
||||
static const FQuat& GetLeftNova2ViveWristTrackerToAttachRotation();
|
||||
|
||||
static void GetNova2GloveWristOffset(bool bRightHanded, const FString& HardwareVersion,
|
||||
FVector& OutPositionOffset, FQuat& OutRotationOffset);
|
||||
|
||||
static void GetNova2GloveTrackerOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded,
|
||||
const FString& HardwareVersion,
|
||||
FVector& OutPositionOffset,
|
||||
FQuat& OutRotationOffset);
|
||||
|
||||
static FString ToString(ESGPositionalTrackingHardware Hardware);
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user