document some parts of the layer 3 and 4 api

This commit is contained in:
Mamadou Babaei
2022-11-18 15:02:21 +01:00
parent c1fb3eca31
commit 3c525227df
24 changed files with 1221 additions and 84 deletions
@@ -46,32 +46,32 @@ struct SENSEGLOVECONNECT_API FSGConnect
public: public:
/** /**
* Begin Scanning for Sense Glove Devices and set up communications with them. * Begin Scanning for Sense Glove Devices and set up communications with them.
* *
* @return * @return
* -3 : An Unexpected error occured. Please try again. * -3 : An Unexpected error occured. Please try again.
* -2 : Device Scanning is already running within a different program. * -2 : Device Scanning is already running within a different program.
* -1 : Device Scanning already being initialized (function called twice in short succession). * -1 : Device Scanning already being initialized (function called twice in short succession).
* 0 : Device Scanning is already running in within this program. * 0 : Device Scanning is already running in within this program.
* 1 : Successfully started up DeviceScanning from the current program. * 1 : Successfully started up DeviceScanning from the current program.
*/ */
static int32 Init(); static int32 Init();
/** /**
* Dispose of unmanaged resources and finalize Sense Glove devices. * Dispose of unmanaged resources and finalize Sense Glove devices.
* *
* @return * @return
* -3 : An Unexpected error occured. Please try again. * -3 : An Unexpected error occured. Please try again.
* -2 : Not allowed to dispose of Device Scanning because this is not the program which started it. * -2 : Not allowed to dispose of Device Scanning because this is not the program which started it.
* -1 : Device Scanning is currently being disposed off. This takes a second or two. (function called twice in short succession). * -1 : Device Scanning is currently being disposed off. This takes a second or two. (function called twice in short succession).
* 0 : There is no deviceScanner running from any program, so disposing is skipped. * 0 : There is no deviceScanner running from any program, so disposing is skipped.
* 1 : Successfully disposed of DeviceScanner resources. * 1 : Successfully disposed of DeviceScanner resources.
* @remark If the Dispose function returns 1, the resources were neatly disposed of. Only a value of -3 is cause for concern. * @remark If the Dispose function returns 1, the resources were neatly disposed of. Only a value of -3 is cause for concern.
*/ */
static int32 Dispose(); static int32 Dispose();
/** /**
* Check which version of SGConnect you are using. * Check which version of SGConnect you are using.
*/ */
static FString GetLibraryVersion(); static FString GetLibraryVersion();
}; };
@@ -50,34 +50,34 @@ class SENSEGLOVECONNECTKISMET_API USGConnectKismetLibrary final : public USGBlue
public: public:
public: public:
/** /**
* Begin Scanning for Sense Glove Devices and set up communications with them. * Begin Scanning for Sense Glove Devices and set up communications with them.
* *
* @return * @return
* -3 : An Unexpected error occured. Please try again. * -3 : An Unexpected error occured. Please try again.
* -2 : Device Scanning is already running within a different program. * -2 : Device Scanning is already running within a different program.
* -1 : Device Scanning already being initialized (function called twice in short succession). * -1 : Device Scanning already being initialized (function called twice in short succession).
* 0 : Device Scanning is already running in within this program. * 0 : Device Scanning is already running in within this program.
* 1 : Successfully started up DeviceScanning from the current program. * 1 : Successfully started up DeviceScanning from the current program.
*/ */
UFUNCTION(BlueprintCallable, Category="SenseGlove | Connect") UFUNCTION(BlueprintCallable, Category="SenseGlove | Connect")
static int32 Init(); static int32 Init();
/** /**
* Dispose of unmanaged resources and finalize Sense Glove devices. * Dispose of unmanaged resources and finalize Sense Glove devices.
* *
* @return * @return
* -3 : An Unexpected error occured. Please try again. * -3 : An Unexpected error occured. Please try again.
* -2 : Not allowed to dispose of Device Scanning because this is not the program which started it. * -2 : Not allowed to dispose of Device Scanning because this is not the program which started it.
* -1 : Device Scanning is currently being disposed off. This takes a second or two. (function called twice in short succession). * -1 : Device Scanning is currently being disposed off. This takes a second or two. (function called twice in short succession).
* 0 : There is no deviceScanner running from any program, so disposing is skipped. * 0 : There is no deviceScanner running from any program, so disposing is skipped.
* 1 : Successfully disposed of DeviceScanner resources. * 1 : Successfully disposed of DeviceScanner resources.
* @remark If the Dispose function returns 1, the resources were neatly disposed of. Only a value of -3 is cause for concern. * @remark If the Dispose function returns 1, the resources were neatly disposed of. Only a value of -3 is cause for concern.
*/ */
UFUNCTION(BlueprintCallable, Category="SenseGlove | Connect") UFUNCTION(BlueprintCallable, Category="SenseGlove | Connect")
static int32 Dispose(); static int32 Dispose();
/** /**
* Check which version of SGConnect you are using. * Check which version of SGConnect you are using.
*/ */
UFUNCTION(BlueprintCallable, Category="SenseGlove | Connect") UFUNCTION(BlueprintCallable, Category="SenseGlove | Connect")
static FString GetLibraryVersion(); static FString GetLibraryVersion();
@@ -29,7 +29,8 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * Hard-Coded Database that is used in calibration and in solving.
* Values herein are used to limit outputs within 'natural' ranges.
*/ */
@@ -41,33 +42,72 @@
#include "SGAnatomy.generated.h" #include "SGAnatomy.generated.h"
/**
* "Database" of anatomical values, such as joint limits.
*/
USTRUCT() USTRUCT()
struct SENSEGLOVECORE_API FSGAnatomy struct SENSEGLOVECORE_API FSGAnatomy
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
/**
* Total sum of all finger flexion that would be considered "total flexion".
*/
static float GetTotalFingerFlexion(); static float GetTotalFingerFlexion();
/**
* Total sum of all finger flexion that would be considered "total extension".
*/
static float GetTotalFingerExtension(); static float GetTotalFingerExtension();
/**
* Total sum of all thumb flexion that would be considered "total flexion".
*/
static float GetTotalThumbFlexion(); static float GetTotalThumbFlexion();
/**
* Total sum of all thumb flexion that would be considered "total extension".
*/
static float GetTotalThumbExtension(); static float GetTotalThumbExtension();
/**
* Retrieve one of the limits of a finger joint's movement.
*/
static float GetFingerJointLimit(bool bRightHanded, int32 Joint, int32 Movement, bool bMax); static float GetFingerJointLimit(bool bRightHanded, int32 Joint, int32 Movement, bool bMax);
/**
* Retrieve one of the limits of a thumb joint's movement.
*/
static float GetThumbJointLimit(bool bRightHanded, int32 Joint, int32 Movement, bool bMax); static float GetThumbJointLimit(bool bRightHanded, int32 Joint, int32 Movement, bool bMax);
/**
* Convert a total finger flexion in radians into a 0..1 representation.
*/
static float NormalizeFingerFlexion(float FlexionInRadians); static float NormalizeFingerFlexion(float FlexionInRadians);
/**
* Convert a total thumb flexion in radians into a 0..1 representation.
*/
static float NormalizeThumbFlexion(float FlexionInRadians); static float NormalizeThumbFlexion(float FlexionInRadians);
/**
* Get Hand Angles that would make a Default (Idle) Pose.
*/
static TArray<TArray<FVector>> GetDefaultHandAngles(bool bRightHanded); static TArray<TArray<FVector>> GetDefaultHandAngles(bool bRightHanded);
/**
* Get Hand Angles that would make a flat hand.
*/
static TArray<TArray<FVector>> GetFlatHandAngles(bool bRightHanded); static TArray<TArray<FVector>> GetFlatHandAngles(bool bRightHanded);
/**
* Get hand angles that would make a thumbs up.
*/
static TArray<TArray<FVector>> GetThumbsUpHandAngles(bool bRightHanded); static TArray<TArray<FVector>> GetThumbsUpHandAngles(bool bRightHanded);
/**
* Get Hand Angles that would make a fist.
*/
static TArray<TArray<FVector>> GetFistHandAngles(bool bRightHanded); static TArray<TArray<FVector>> GetFistHandAngles(bool bRightHanded);
}; };
@@ -29,7 +29,8 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * A data class containing the minimum required data for a hand's forward kinematics.
* Used in both kinematics and calibration.
*/ */
@@ -52,6 +53,9 @@
class FSGBasicHandModelImpl; class FSGBasicHandModelImpl;
/**
* Represents data of a user's hand required for forward kinematics.
*/
UCLASS(BlueprintType) UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGBasicHandModel final : public UObject class SENSEGLOVECORE_API USGBasicHandModel final : public UObject
{ {
@@ -62,46 +66,88 @@ public:
UObject* Outer, const FSGBasicHandModelImpl& BasicHandModelImpl); UObject* Outer, const FSGBasicHandModelImpl& BasicHandModelImpl);
public: public:
/**
* Basic class Constructor.
*/
static USGBasicHandModel* NewBasicHandModel(UObject* Outer); static USGBasicHandModel* NewBasicHandModel(UObject* Outer);
/**
* Create a new BasicHandModel with no starting rotations.
*/
static USGBasicHandModel* NewBasicHandModel( static USGBasicHandModel* NewBasicHandModel(
UObject* Outer, UObject* Outer,
bool bRightHanded, const TArray<TArray<float>>& Lengths, const TArray<FVector>& StartPositions); bool bRightHanded, const TArray<TArray<float>>& Lengths, const TArray<FVector>& StartPositions);
/**
* Create a new BasicHandModel with no starting rotations.
*/
static USGBasicHandModel* NewBasicHandModel( static USGBasicHandModel* NewBasicHandModel(
UObject* Outer, UObject* Outer,
bool bRightHanded, const TArray<FSGFloatArray>& Lengths, const TArray<FVector>& StartPositions); bool bRightHanded, const TArray<FSGFloatArray>& Lengths, const TArray<FVector>& StartPositions);
/**
* Create a new BasicHandModel.
*/
static USGBasicHandModel* NewBasicHandModel( static USGBasicHandModel* NewBasicHandModel(
UObject* Outer, UObject* Outer,
bool bRightHanded, const TArray<TArray<float>>& Lengths, bool bRightHanded, const TArray<TArray<float>>& Lengths,
const TArray<FVector>& StartPositions, const TArray<FQuat>& StartRotations); const TArray<FVector>& StartPositions, const TArray<FQuat>& StartRotations);
/**
* Create a new BasicHandModel.
*/
static USGBasicHandModel* NewBasicHandModel( static USGBasicHandModel* NewBasicHandModel(
UObject* Outer, UObject* Outer,
bool bRightHanded, const TArray<TArray<float>>& Lengths, bool bRightHanded, const TArray<TArray<float>>& Lengths,
const TArray<FVector>& StartPositions, const TArray<FRotator>& StartRotations); const TArray<FVector>& StartPositions, const TArray<FRotator>& StartRotations);
/**
* Create a new BasicHandModel.
*/
static USGBasicHandModel* NewBasicHandModel( static USGBasicHandModel* NewBasicHandModel(
UObject* Outer, UObject* Outer,
bool bRightHanded, const TArray<FSGFloatArray>& Lengths, bool bRightHanded, const TArray<FSGFloatArray>& Lengths,
const TArray<FVector>& StartPositions, const TArray<FQuat>& StartRotations); const TArray<FVector>& StartPositions, const TArray<FQuat>& StartRotations);
/**
* Create a new BasicHandModel.
*/
static USGBasicHandModel* NewBasicHandModel( static USGBasicHandModel* NewBasicHandModel(
UObject* Outer, UObject* Outer,
bool bRightHanded, const TArray<FSGFloatArray>& Lengths, bool bRightHanded, const TArray<FSGFloatArray>& Lengths,
const TArray<FVector>& StartPositions, const TArray<FRotator>& StartRotations); const TArray<FVector>& StartPositions, const TArray<FRotator>& StartRotations);
public: public:
/**
* Retrieve a default left or right hand model.
*/
static USGBasicHandModel* Default(UObject* Outer, bool bRightHanded); static USGBasicHandModel* Default(UObject* Outer, bool bRightHanded);
/**
* Convert a serialized HandModel back into its class representation.
*/
static USGBasicHandModel* Deserialize(UObject* Outer, const FString& SerializedString); static USGBasicHandModel* Deserialize(UObject* Outer, const FString& SerializedString);
public: public:
/**
* Default finger lengths (based on right hand).
*
* @remarks Any missing fingers are replaced with their respective value.
*/
static TArray<TArray<float>> GetBaseFingerLengths(); static TArray<TArray<float>> GetBaseFingerLengths();
/**
* Default joint positions (based on right hand).
*
* @remarks Any missing positions are replaced with their respective value.
*/
static TArray<FVector> GetBaseJointPositions(); static TArray<FVector> GetBaseJointPositions();
/**
* Default joint angles (based on right hand).
*
* @remarks Any missing angles are replaced with their respective value.
*/
static TArray<FVector> GetBaseJointAngles(); static TArray<FVector> GetBaseJointAngles();
private: private:
@@ -116,23 +162,44 @@ private:
FImplDeleter PimplDeleter; FImplDeleter PimplDeleter;
public: public:
/**
* Basic class Constructor.
*/
USGBasicHandModel(); USGBasicHandModel();
/**
* Create a new BasicHandModel with no starting rotations.
*/
USGBasicHandModel(bool bRightHanded, const TArray<TArray<float>>& Lengths, USGBasicHandModel(bool bRightHanded, const TArray<TArray<float>>& Lengths,
const TArray<FVector>& StartPositions); const TArray<FVector>& StartPositions);
/**
* Create a new BasicHandModel with no starting rotations.
*/
USGBasicHandModel(bool bRightHanded, const TArray<FSGFloatArray>& Lengths, USGBasicHandModel(bool bRightHanded, const TArray<FSGFloatArray>& Lengths,
const TArray<FVector>& StartPositions); const TArray<FVector>& StartPositions);
/**
* Create a new BasicHandModel.
*/
USGBasicHandModel(bool bRightHanded, const TArray<TArray<float>>& Lengths, USGBasicHandModel(bool bRightHanded, const TArray<TArray<float>>& Lengths,
const TArray<FVector>& StartPositions, const TArray<FQuat>& StartRotations); const TArray<FVector>& StartPositions, const TArray<FQuat>& StartRotations);
/**
* Create a new BasicHandModel.
*/
USGBasicHandModel(bool bRightHanded, const TArray<TArray<float>>& Lengths, USGBasicHandModel(bool bRightHanded, const TArray<TArray<float>>& Lengths,
const TArray<FVector>& StartPositions, const TArray<FRotator>& StartRotations); const TArray<FVector>& StartPositions, const TArray<FRotator>& StartRotations);
/**
* Create a new BasicHandModel.
*/
USGBasicHandModel(bool bRightHanded, const TArray<FSGFloatArray>& Lengths, USGBasicHandModel(bool bRightHanded, const TArray<FSGFloatArray>& Lengths,
const TArray<FVector>& StartPositions, const TArray<FQuat>& StartRotations); const TArray<FVector>& StartPositions, const TArray<FQuat>& StartRotations);
/**
* Create a new BasicHandModel.
*/
USGBasicHandModel(bool bRightHanded, const TArray<FSGFloatArray>& Lengths, USGBasicHandModel(bool bRightHanded, const TArray<FSGFloatArray>& Lengths,
const TArray<FVector>& StartPositions, const TArray<FRotator>& StartRotations); const TArray<FVector>& StartPositions, const TArray<FRotator>& StartRotations);
@@ -167,54 +234,133 @@ protected:
FSGBasicHandModelImpl& ToBasicHandModelImpl(); FSGBasicHandModelImpl& ToBasicHandModelImpl();
public: public:
/**
* Whether or not this BasicHandModel was created for a left- or right hand. Used for validation.
*/
bool IsRight() const; bool IsRight() const;
/**
* The length of individual finger phalangers in mm, sorted per finger. Generally 5x3.
*/
TArray<TArray<float>> GetFingerLengths() const; TArray<TArray<float>> GetFingerLengths() const;
/**
* Retrieve the finger lengths of a specific finger in cm.
*/
TArray<float> GetFingerLengths(ESGFinger Finger) const; TArray<float> GetFingerLengths(ESGFinger Finger) const;
/**
* Set the finger lengths of a specific finger in cm.
*/
void SetFingerLengths(ESGFinger Finger, const TArray<float>& Lengths); void SetFingerLengths(ESGFinger Finger, const TArray<float>& Lengths);
/**
* Set the finger lengths of a specific finger in cm.
*/
void SetFingerLengths(uint8 Finger, const TArray<float>& Lengths); void SetFingerLengths(uint8 Finger, const TArray<float>& Lengths);
/**
* Get the finger ratios of all fingers.
*/
TArray<TArray<float>> GetFingerRatios() const; TArray<TArray<float>> GetFingerRatios() const;
/**
* Get the finger ratios of a specific finger.
*/
TArray<float> GetFingerRatios(ESGFinger Finger) const; TArray<float> GetFingerRatios(ESGFinger Finger) const;
/**
* Starting joint positions relative to the device Origin.
*/
TArray<FVector> GetStartJointPositions() const; TArray<FVector> GetStartJointPositions() const;
/**
*
*/
void SetStartJointPosition(ESGFinger Finger, const FVector& Position); void SetStartJointPosition(ESGFinger Finger, const FVector& Position);
/**
*
*/
void SetStartJointPosition(uint8 Finger, const FVector& Position); void SetStartJointPosition(uint8 Finger, const FVector& Position);
/**
* Starting joint rotations relative to the device Origin.
*/
TArray<FQuat> GetStartJointRotationsQ() const; TArray<FQuat> GetStartJointRotationsQ() const;
/**
* Starting joint rotations relative to the device Origin.
*/
TArray<FRotator> GetStartJointRotations() const; TArray<FRotator> GetStartJointRotations() const;
/**
* Retrieve the start position of a specific finger.
*/
FVector GetJointPosition(ESGFinger Finger) const; FVector GetJointPosition(ESGFinger Finger) const;
/**
* Set the start position of a specific finger.
*/
void SetJointPosition(const FVector& NewPosition, ESGFinger Finger); void SetJointPosition(const FVector& NewPosition, ESGFinger Finger);
/**
* Retrieve the start rotation of a specific finger.
*/
FQuat GetJointRotationQ(ESGFinger Finger) const; FQuat GetJointRotationQ(ESGFinger Finger) const;
/**
* Retrieve the start rotation of a specific finger.
*/
FRotator GetJointRotation(ESGFinger Finger) const; FRotator GetJointRotation(ESGFinger Finger) const;
/**
* Set the start rotation of a specific finger.
*/
void SetJointRotation(const FQuat& NewRotation, ESGFinger Finger); void SetJointRotation(const FQuat& NewRotation, ESGFinger Finger);
/**
* Set the start rotation of a specific finger.
*/
void SetJointRotation(const FRotator& NewRotation, ESGFinger Finger); void SetJointRotation(const FRotator& NewRotation, ESGFinger Finger);
/**
* Get the total lengths of fingers, in cm.
*/
TArray<float> GetTotalLengths() const; TArray<float> GetTotalLengths() const;
/**
* Get the total length of a specific finger, in mm.
*/
float GetTotalLength(ESGFinger Finger) const; float GetTotalLength(ESGFinger Finger) const;
public: public:
/**
* Retrieve the lengths of a specific finger, as BasicHandModel representation (L, 0, 0).
*
* @remarks Used for forwards kinematics.
*/
TArray<FVector> Get3DLengths(ESGFinger Finger) const; TArray<FVector> Get3DLengths(ESGFinger Finger) const;
public: public:
/**
* Check if this BasicHandModel has the same values as another BasicHandModel.
*/
bool Equals(const USGBasicHandModel* BasicHandModel) const; bool Equals(const USGBasicHandModel* BasicHandModel) const;
public: public:
/**
* Convert this handModel into a string notation, readable for humans. Does not include starting positions / rotations.
*/
FString ToString() const; FString ToString() const;
/**
* Convert this handModel into a string notation, readable for humans. Optionally includes starting positions / rotations.
*/
FString ToString(bool bLengthsOnly) const; FString ToString(bool bLengthsOnly) const;
/**
* Serialize this HandModel into a string representation.
*/
FString SGSerialize() const; FString SGSerialize() const;
}; };
@@ -29,7 +29,9 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * Represents a Sense Glove Device that has no specific class within the API.
* Used to test different iterations of the same product before integrating it into the Core API.
* Allows access to raw sensor values and commands of such a device.
*/ */
@@ -45,6 +47,9 @@
class FSGDeviceImpl; class FSGDeviceImpl;
class FSGBetaDeviceImpl; class FSGBetaDeviceImpl;
/**
* A Device that adheres to the SenseGlove communications protocol, but which has no implementation in this API.
*/
UCLASS(BlueprintType) UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGBetaDevice final : public USGDevice class SENSEGLOVECORE_API USGBetaDevice final : public USGDevice
{ {
@@ -55,14 +60,24 @@ public:
static USGBetaDevice* NewBetaDevice(UObject* Outer, TSharedRef<FSGBetaDeviceImpl> BetaDeviceImpl); static USGBetaDevice* NewBetaDevice(UObject* Outer, TSharedRef<FSGBetaDeviceImpl> BetaDeviceImpl);
public:
/**
* Basic Class Constructor.
*/
static USGBetaDevice* NewBetaDevice(UObject* Outer); static USGBetaDevice* NewBetaDevice(UObject* Outer);
/**
* Creates a new instance of a Beta Device.
*/
static USGBetaDevice* NewBetaDevice( static USGBetaDevice* NewBetaDevice(
UObject* Outer, UObject* Outer,
const FString& ConstantsString, const FString& DeviceId, const FString& ConstantsString, const FString& DeviceId,
const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion); const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion);
public: public:
/**
* Deserialize a beta device from its basic constants string. Returns nullptr is unsuccessful.
*/
static USGBetaDevice* Parse(UObject* Outer, const FString& String); static USGBetaDevice* Parse(UObject* Outer, const FString& String);
private: private:
@@ -77,8 +92,14 @@ private:
FImplDeleter PimplDeleter; FImplDeleter PimplDeleter;
public: public:
/**
* Basic Class Constructor.
*/
USGBetaDevice(); USGBetaDevice();
/**
* Creates a new instance of a Beta Device.
*/
USGBetaDevice(const FString& ConstantsString, const FString& DeviceId, USGBetaDevice(const FString& ConstantsString, const FString& DeviceId,
const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion); const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion);
@@ -118,26 +139,56 @@ protected:
virtual void SyncUProperties() override; virtual void SyncUProperties() override;
public: public:
/**
* Get the DeviceType enumerator of this SenseGlove, used in DeviceList enumeration.
*/
virtual ESGDeviceType GetDeviceType() const override; virtual ESGDeviceType GetDeviceType() const override;
/**
* Get the unique identifier of this device.
*/
virtual FString GetDeviceId() const override; virtual FString GetDeviceId() const override;
/**
* Retrieve this device's hardware version.
*/
virtual FString GetHardwareVersion() const override; virtual FString GetHardwareVersion() const override;
/**
* Retrieve this device's firmware version.
*/
virtual int32 GetFirmwareVersion() const override; virtual int32 GetFirmwareVersion() const override;
/**
* Retrieve this device's sub-firmware version.
*/
virtual int32 GetSubFirmwareVersion() const override; virtual int32 GetSubFirmwareVersion() const override;
public: public:
/**
* Retrieve the constants string for additional processing.
*/
FString GetConstantsString() const; FString GetConstantsString() const;
/**
* Retrieve a raw sensor string from this Beta Device.
*/
FString GetSensorData() const; FString GetSensorData() const;
/**
* Retrieve the last command retrieved from this Beta Device.
*/
FString GetLastCommand() const; FString GetLastCommand() const;
public: public:
/**
* Send a raw string command to this device.
*/
bool SendHaptics(const FString& Command) const; bool SendHaptics(const FString& Command) const;
public: public:
/**
* Create a string representation of this device for reporting purposes.
*/
virtual FString ToString() const override; virtual FString ToString() const override;
}; };
@@ -29,7 +29,7 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * Buzz motor command specific for the Sense Glove.
*/ */
@@ -47,6 +47,9 @@
class FSGBuzzCommandImpl; class FSGBuzzCommandImpl;
/**
* A vibration command for the Sense Glove, with levels for each finger.
*/
UCLASS(BlueprintType) UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGBuzzCommand : public USGFingerCommand class SENSEGLOVECORE_API USGBuzzCommand : public USGFingerCommand
{ {
@@ -57,15 +60,32 @@ public:
static USGBuzzCommand* NewBuzzCommand(UObject* Outer, TSharedRef<FSGBuzzCommandImpl> BuzzCommandImpl); static USGBuzzCommand* NewBuzzCommand(UObject* Outer, TSharedRef<FSGBuzzCommandImpl> BuzzCommandImpl);
public:
/**
* Basic Constructor.
*/
static USGBuzzCommand* NewBuzzCommand(UObject* Outer); static USGBuzzCommand* NewBuzzCommand(UObject* Outer);
/**
* Create a new buzz motor command, where each finger level is contained inside an array of size 5.
*/
static USGBuzzCommand* NewBuzzCommand(UObject* Outer, const TArray<int32>& BuzzLevels); static USGBuzzCommand* NewBuzzCommand(UObject* Outer, const TArray<int32>& BuzzLevels);
static USGBuzzCommand* NewBuzzCommand(UObject* Outer, int32 Thumb, int32 Index, int32 Middle, int32 Ring, int32 Pinky); /**
* Create a new Buzz Motor command, indicating the intensity for each finger.
*/
static USGBuzzCommand* NewBuzzCommand(UObject* Outer, int32 Thumb, int32 Index, int32 Middle, int32 Ring,
int32 Pinky);
/**
* Create a new Buzz Motor command, with only one finger being activated.
*/
static USGBuzzCommand* NewBuzzCommand(UObject* Outer, ESGFinger Finger, int32 BuzzLevel); static USGBuzzCommand* NewBuzzCommand(UObject* Outer, ESGFinger Finger, int32 BuzzLevel);
public: public:
/**
* A command that turns off all vibration motors of the Sense Glove.
*/
static USGBuzzCommand* Off(UObject* Outer); static USGBuzzCommand* Off(UObject* Outer);
private: private:
@@ -80,9 +100,24 @@ private:
FImplDeleter PimplDeleter; FImplDeleter PimplDeleter;
public: public:
/**
* Basic Constructor.
*/
USGBuzzCommand(); USGBuzzCommand();
/**
* Create a new buzz motor command, where each finger level is contained inside an array of size 5.
*/
explicit USGBuzzCommand(const TArray<int32>& BuzzLevels); explicit USGBuzzCommand(const TArray<int32>& BuzzLevels);
/**
* Create a new Buzz Motor command, indicating the intensity for each finger.
*/
USGBuzzCommand(int32 Thumb, int32 Index, int32 Middle, int32 Ring, int32 Pinky); USGBuzzCommand(int32 Thumb, int32 Index, int32 Middle, int32 Ring, int32 Pinky);
/**
* Create a new Buzz Motor command, with only one finger being activated.
*/
USGBuzzCommand(ESGFinger Finger, int32 BuzzLevel); USGBuzzCommand(ESGFinger Finger, int32 BuzzLevel);
public: public:
@@ -121,7 +156,13 @@ protected:
virtual void SyncUProperties() override; virtual void SyncUProperties() override;
public: public:
/**
* Copy this Buzz Command into a new object.
*/
USGBuzzCommand* Copy(UObject* Outer) const; USGBuzzCommand* Copy(UObject* Outer) const;
/**
* Merge this command with another, taking the maximum value between the two.
*/
USGBuzzCommand* Merge(UObject* Outer, const USGBuzzCommand* BuzzCommand) const; USGBuzzCommand* Merge(UObject* Outer, const USGBuzzCommand* BuzzCommand) const;
}; };
@@ -47,6 +47,9 @@
class FSGCalibrationDataPointImpl; class FSGCalibrationDataPointImpl;
/**
*
*/
UCLASS(BlueprintType) UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGCalibrationDataPoint final : public UObject class SENSEGLOVECORE_API USGCalibrationDataPoint final : public UObject
{ {
@@ -57,11 +60,17 @@ public:
UObject* Outer, const FSGCalibrationDataPointImpl& CalibrationDataPointImpl); UObject* Outer, const FSGCalibrationDataPointImpl& CalibrationDataPointImpl);
public: public:
/**
*
*/
static USGCalibrationDataPoint* NewCalibrationDataPoint(UObject* Outer); static USGCalibrationDataPoint* NewCalibrationDataPoint(UObject* Outer);
/**
* Create a new data point.
*/
static USGCalibrationDataPoint* NewCalibrationDataPoint( static USGCalibrationDataPoint* NewCalibrationDataPoint(
UObject* Outer, UObject* Outer,
int32 CurrentStage,const TArray<FVector>& CalibrationValues); int32 CurrentStage, const TArray<FVector>& CalibrationValues);
private: private:
struct FImpl; struct FImpl;
@@ -75,8 +84,14 @@ private:
FImplDeleter PimplDeleter; FImplDeleter PimplDeleter;
public: public:
/**
*
*/
USGCalibrationDataPoint(); USGCalibrationDataPoint();
/**
* Create a new data point.
*/
USGCalibrationDataPoint(int32 CurrentStage, const TArray<FVector>& CalibrationValues); USGCalibrationDataPoint(int32 CurrentStage, const TArray<FVector>& CalibrationValues);
public: public:
@@ -104,10 +119,19 @@ public:
const FSGCalibrationDataPointImpl& ToCalibrationDataPointImpl() const; const FSGCalibrationDataPointImpl& ToCalibrationDataPointImpl() const;
public: public:
/**
* Actual calibration values.
*/
TArray<FVector> GetCalibrationValues() const; TArray<FVector> GetCalibrationValues() const;
/**
* The Calibration stage this data point belongs to.
*/
int32 GetStage() const; int32 GetStage() const;
public: public:
/**
* Log Calibration values for storing on disk.
*/
FString ToLogData(const FString& Delimiter = "\t") const; FString ToLogData(const FString& Delimiter = "\t") const;
}; };
@@ -29,7 +29,7 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * Interface for SenseCom, allows the retrieval of Devices and Data, but only as.
*/ */
@@ -46,41 +46,91 @@
class USGDevice; class USGDevice;
/**
* Interface for SenseCom, allows the retrieval of Devices and Data.
*/
USTRUCT() USTRUCT()
struct SENSEGLOVECORE_API FSGDeviceList struct SENSEGLOVECORE_API FSGDeviceList
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
/**
* Retrieve the number of devices that have been detected by the SenseCom executable.
*/
static int32 ActiveDevices(); static int32 ActiveDevices();
/**
* Returns true if the SenseCom program is running.
*/
static bool SenseCommRunning(); static bool SenseCommRunning();
/**
* Clear the device list, and block any further attempt to add to it until ReInitialize is called.
*
* @remarks Useful if your IDE has troubles unloading dlls (cough, Unity, Cough).
*/
static void Dispose(); static void Dispose();
/**
* When you've accidentally disposed of the list before you meant to.
*/
static void Reinitialize(); static void Reinitialize();
/**
* Retrieve all Sense Glove Devices connected to this system.
*/
static TArray<USGDevice*> GetDevices(UObject* Outer); static TArray<USGDevice*> GetDevices(UObject* Outer);
/// TODO /// TODO
// THIS PROBABLY SHOULD BE REMOVED! // THIS PROBABLY SHOULD BE REMOVED!
/**
* Retrieve a list of SGDevices of a specific class.
*/
static TArray<USGDevice*> GetDevices(UObject* Outer, const TSubclassOf<USGDevice>& DeviceType); static TArray<USGDevice*> GetDevices(UObject* Outer, const TSubclassOf<USGDevice>& DeviceType);
/**
* Retrieve a list of SGDevices of a specific type.
*/
static TArray<USGDevice*> GetDevices(UObject* Outer, ESGDeviceType DeviceType); static TArray<USGDevice*> GetDevices(UObject* Outer, ESGDeviceType DeviceType);
/**
* Retrieve the latest (raw) sensor data from a specific device in our list.
*/
static bool GetSensorDataString(int32 IpcIndex, const FString& IpcAddress, FString& OutString); static bool GetSensorDataString(int32 IpcIndex, const FString& IpcAddress, FString& OutString);
/**
* Send a (raw) command to a specific device in the list.
*/
static bool SendHaptics(int32 IpcIndex, const FString& IpcAddress, const FString& Commands); static bool SendHaptics(int32 IpcIndex, const FString& IpcAddress, const FString& Commands);
/**
*
*/
static FString GetDeviceStringAt(int32 IpcIndex, const FString& IpcAddress, int32 Index); static FString GetDeviceStringAt(int32 IpcIndex, const FString& IpcAddress, int32 Index);
/**
* Retrieve Device Address.
*/
static FString GetAddress(int32 IpcIndex, const FString& IpcAddress); static FString GetAddress(int32 IpcIndex, const FString& IpcAddress);
/**
* Retieve this device's connectionType.
*/
static ESGConnectionType GetConnectionType(int32 IpcIndex, const FString& IpcAddress); static ESGConnectionType GetConnectionType(int32 IpcIndex, const FString& IpcAddress);
/**
* Returns true if the device at this connection side is properly connected.
*/
static bool IsConnected(int32 IpcIndex, const FString& IpcAddress); static bool IsConnected(int32 IpcIndex, const FString& IpcAddress);
/**
* Retrieve the device's Packets per Second Variable.
*/
static int32 PacketsPerSecondReceived(int32 IpcIndex, const FString& IpcAddress); static int32 PacketsPerSecondReceived(int32 IpcIndex, const FString& IpcAddress);
/**
* Retrieve the device's Packets per Second sent Variable.
*/
static int32 PacketsPerSecondSent(int32 IpcIndex, const FString& IpcAddress); static int32 PacketsPerSecondSent(int32 IpcIndex, const FString& IpcAddress);
}; };
@@ -29,7 +29,8 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * Base class for Device Models containing the minimum amount of data gathered
* through Communications Protocol. Used for shared functionality.
*/ */
@@ -47,6 +48,9 @@
class FSGDeviceModelImpl; class FSGDeviceModelImpl;
/**
* Base class containing the minimum amount of data for device models.
*/
UCLASS(BlueprintType) UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGDeviceModel final : public UObject class SENSEGLOVECORE_API USGDeviceModel final : public UObject
{ {
@@ -57,15 +61,27 @@ public:
UObject* Outer, const FSGDeviceModelImpl& DeviceModelImpl); UObject* Outer, const FSGDeviceModelImpl& DeviceModelImpl);
public: public:
/**
*
*/
static USGDeviceModel* NewDeviceModel(UObject* Outer); static USGDeviceModel* NewDeviceModel(UObject* Outer);
/**
*
*/
static USGDeviceModel* NewDeviceModel( static USGDeviceModel* NewDeviceModel(
UObject* Outer, UObject* Outer,
const FString& Id, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion); const FString& Id, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion);
public: public:
/**
* Parse a 32-bit integer value into a set of booleans (010010011) that indicate which (optional) functions this device has.
*/
static TArray<bool> ParseFunctions(int32 Value, int32 Size); static TArray<bool> ParseFunctions(int32 Value, int32 Size);
/**
*
*/
static void ParseFirmware(const FString& RawFirmware, int32& OutMainVersion, int32& OutSubVersion); static void ParseFirmware(const FString& RawFirmware, int32& OutMainVersion, int32& OutSubVersion);
private: private:
@@ -80,8 +96,14 @@ private:
FImplDeleter PimplDeleter; FImplDeleter PimplDeleter;
public: public:
/**
* Empty constructor to be used by child classes.
*/
USGDeviceModel(); USGDeviceModel();
/**
*
*/
USGDeviceModel(const FString& Id, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion); USGDeviceModel(const FString& Id, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion);
public: public:
@@ -115,11 +137,23 @@ protected:
FSGDeviceModelImpl& ToDeviceModelImpl(); FSGDeviceModelImpl& ToDeviceModelImpl();
public: public:
/**
* Retrieve the Unique identifier of this device.
*/
FString GetDeviceId() const; FString GetDeviceId() const;
/**
* Retrieve the Hardware (sub) version of this Sense Glove Device.
*/
FString GetHardwareVersion() const; FString GetHardwareVersion() const;
/**
* Firmware version running on the device's MicroController. (as v4.12, this is the 4).
*/
int32 GetFirmwareVersion() const; int32 GetFirmwareVersion() const;
/**
* Sub firmware version running on the device's microcontroller (as v4.12, this is the 12).
*/
int32 GetSubFirmwareVersion() const; int32 GetSubFirmwareVersion() const;
}; };
@@ -29,7 +29,7 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * A command for five fingers that can be sent to a Sense Glove device.
*/ */
@@ -49,8 +49,11 @@ class FSGFingerCommandImpl;
class FSGForceFeedbackCommandImpl; class FSGForceFeedbackCommandImpl;
class FSGTimedBuzzCommandImpl; class FSGTimedBuzzCommandImpl;
/**
* A command that contains values (levels) for five fingers.
*/
UCLASS(Abstract, BlueprintType) UCLASS(Abstract, BlueprintType)
class SENSEGLOVECORE_API USGFingerCommand : public UObject class SENSEGLOVECORE_API USGFingerCommand : public UObject
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -66,8 +69,14 @@ private:
FImplDeleter PimplDeleter; FImplDeleter PimplDeleter;
protected: protected:
/**
*
*/
USGFingerCommand(); USGFingerCommand();
/**
*
*/
explicit USGFingerCommand(const TArray<int32>& InLevels); explicit USGFingerCommand(const TArray<int32>& InLevels);
public: public:
@@ -159,7 +168,6 @@ protected:
*/ */
void SetFingerCommandImpl(TSharedRef<FSGTimedBuzzCommandImpl> TimedBuzzCommandImpl); void SetFingerCommandImpl(TSharedRef<FSGTimedBuzzCommandImpl> TimedBuzzCommandImpl);
public: public:
/** /**
* The cast to underlying type method. * The cast to underlying type method.
@@ -178,13 +186,29 @@ protected:
virtual void SyncUProperties(); virtual void SyncUProperties();
public: public:
/**
*
*/
TArray<int32> GetLevels() const; TArray<int32> GetLevels() const;
public: public:
/**
*
*/
int32 GetLevel(int32 Finger) const; int32 GetLevel(int32 Finger) const;
/**
*
*/
void SetLevel(int32 Finger, int32 Value); void SetLevel(int32 Finger, int32 Value);
/**
* Check if this command contains the same values as another.
*/
bool Equals(const USGFingerCommand* FingerCommand) const; bool Equals(const USGFingerCommand* FingerCommand) const;
/**
* Create a string representation of this finger command.
*/
FString ToString() const; FString ToString() const;
}; };
@@ -29,7 +29,7 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * A command for five fingers that can be sent to a Sense Glove device.
*/ */
@@ -47,6 +47,9 @@
class FSGForceFeedbackCommandImpl; class FSGForceFeedbackCommandImpl;
/**
* A Force-Feedback command for the Sense Glove, with levels for each finger.
*/
UCLASS(BlueprintType) UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGForceFeedbackCommand final : public USGFingerCommand class SENSEGLOVECORE_API USGForceFeedbackCommand final : public USGFingerCommand
{ {
@@ -59,18 +62,34 @@ public:
static USGForceFeedbackCommand* NewForceFeedbackCommand( static USGForceFeedbackCommand* NewForceFeedbackCommand(
UObject* Outer, TSharedRef<FSGForceFeedbackCommandImpl> ForceFeedbackCommandImpl); UObject* Outer, TSharedRef<FSGForceFeedbackCommandImpl> ForceFeedbackCommandImpl);
public:
/**
* Empty constructor for internal initialization.
*/
static USGForceFeedbackCommand* NewForceFeedbackCommand(UObject* Outer); static USGForceFeedbackCommand* NewForceFeedbackCommand(UObject* Outer);
/**
* Create a new Force-Feedback Command, with levels for each finger stored in an int[5] array.
*/
static USGForceFeedbackCommand* NewForceFeedbackCommand( static USGForceFeedbackCommand* NewForceFeedbackCommand(
UObject* Outer, const TArray<int32>& ForceFeedbackLevels); UObject* Outer, const TArray<int32>& ForceFeedbackLevels);
/**
* Create a new Force-Feedback Command, with levels for each finger.
*/
static USGForceFeedbackCommand* NewForceFeedbackCommand( static USGForceFeedbackCommand* NewForceFeedbackCommand(
UObject* Outer, int32 Thumb, int32 Index, int32 Middle, int32 Ring, int32 Pinky); UObject* Outer, int32 Thumb, int32 Index, int32 Middle, int32 Ring, int32 Pinky);
/**
* Create a new Force-Feedback command, with only one finger being activated.
*/
static USGForceFeedbackCommand* NewForceFeedbackCommand( static USGForceFeedbackCommand* NewForceFeedbackCommand(
UObject* Outer, ESGFinger Finger, int32 BuzzLevel); UObject* Outer, ESGFinger Finger, int32 BuzzLevel);
public: public:
/**
* A command that turns off all force feedback on the Sense Glove.
*/
static USGForceFeedbackCommand* Off(UObject* Outer); static USGForceFeedbackCommand* Off(UObject* Outer);
private: private:
@@ -85,9 +104,24 @@ private:
FImplDeleter PimplDeleter; FImplDeleter PimplDeleter;
public: public:
/**
* Empty constructor for internal initialization.
*/
USGForceFeedbackCommand(); USGForceFeedbackCommand();
/**
* Create a new Force-Feedback Command, with levels for each finger stored in an int[5] array.
*/
explicit USGForceFeedbackCommand(const TArray<int32>& ForceFeedbackLevels); explicit USGForceFeedbackCommand(const TArray<int32>& ForceFeedbackLevels);
/**
* Create a new Force-Feedback Command, with levels for each finger.
*/
USGForceFeedbackCommand(int32 Thumb, int32 Index, int32 Middle, int32 Ring, int32 Pinky); USGForceFeedbackCommand(int32 Thumb, int32 Index, int32 Middle, int32 Ring, int32 Pinky);
/**
* Create a new Force-Feedback command, with only one finger being activated.
*/
USGForceFeedbackCommand(ESGFinger Finger, int32 BuzzLevel); USGForceFeedbackCommand(ESGFinger Finger, int32 BuzzLevel);
public: public:
@@ -126,7 +160,13 @@ protected:
virtual void SyncUProperties() override; virtual void SyncUProperties() override;
public: public:
/**
* Copy this ForceFeedback Command into a new object.
*/
USGForceFeedbackCommand* Copy(UObject* Outer) const; USGForceFeedbackCommand* Copy(UObject* Outer) const;
/**
* Merge this finger command with another, taking the maximum value between the two.
*/
USGForceFeedbackCommand* Merge(UObject* Outer, const USGForceFeedbackCommand* ForceFeedbackCommand) const; USGForceFeedbackCommand* Merge(UObject* Outer, const USGForceFeedbackCommand* ForceFeedbackCommand) const;
}; };
@@ -29,7 +29,8 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * Contains interpolation sets for all hand joint movements that can be
* calculated using the Sense Glove.
*/ */
@@ -52,6 +53,9 @@
class FSGHandInterpolatorImpl; class FSGHandInterpolatorImpl;
/**
* Contains interpolation sets of all joint movements that can be calculated into a HandPose.
*/
UCLASS(BlueprintType) UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGHandInterpolator final : public UObject class SENSEGLOVECORE_API USGHandInterpolator final : public UObject
{ {
@@ -62,44 +66,80 @@ public:
UObject* Outer, const FSGHandInterpolatorImpl& HandInterpolatorImpl); UObject* Outer, const FSGHandInterpolatorImpl& HandInterpolatorImpl);
public: public:
/**
* Basic Constructor.
*/
static USGHandInterpolator* NewHandInterpolator(UObject* Outer); static USGHandInterpolator* NewHandInterpolator(UObject* Outer);
/**
* Create a new basic HandInterpolator without a starting rotation.
*/
static USGHandInterpolator* NewHandInterpolator( static USGHandInterpolator* NewHandInterpolator(
UObject* Outer, UObject* Outer,
const TArray<TArray<USGInterpolationSet*>>& JointInterpolations); const TArray<TArray<USGInterpolationSet*>>& JointInterpolations);
/**
* Create a new basic HandInterpolator without a starting rotation.
*/
static USGHandInterpolator* NewHandInterpolator( static USGHandInterpolator* NewHandInterpolator(
UObject* Outer, UObject* Outer,
const TArray<FSGInterpolationSetArray>& JointInterpolations); const TArray<FSGInterpolationSetArray>& JointInterpolations);
/**
* Create a new basic HandInterpolator with a starting rotation.
*/
static USGHandInterpolator* NewHandInterpolator( static USGHandInterpolator* NewHandInterpolator(
UObject* Outer, UObject* Outer,
const TArray<TArray<USGInterpolationSet*>>& JointInterpolations, const FQuat& CmcStartRotation); const TArray<TArray<USGInterpolationSet*>>& JointInterpolations, const FQuat& CmcStartRotation);
/**
* Create a new basic HandInterpolator with a starting rotation.
*/
static USGHandInterpolator* NewHandInterpolator( static USGHandInterpolator* NewHandInterpolator(
UObject* Outer, UObject* Outer,
const TArray<TArray<USGInterpolationSet*>>& JointInterpolations, const FRotator& CmcStartRotation); const TArray<TArray<USGInterpolationSet*>>& JointInterpolations, const FRotator& CmcStartRotation);
/**
* Create a new basic HandInterpolator with a starting rotation.
*/
static USGHandInterpolator* NewHandInterpolator( static USGHandInterpolator* NewHandInterpolator(
UObject* Outer, UObject* Outer,
const TArray<FSGInterpolationSetArray>& JointInterpolations, const FQuat& CmcStartRotation); const TArray<FSGInterpolationSetArray>& JointInterpolations, const FQuat& CmcStartRotation);
/**
* Create a new basic HandInterpolator with a starting rotation.
*/
static USGHandInterpolator* NewHandInterpolator( static USGHandInterpolator* NewHandInterpolator(
UObject* Outer, UObject* Outer,
const TArray<FSGInterpolationSetArray>& JointInterpolations, const FRotator& CmcStartRotation); const TArray<FSGInterpolationSetArray>& JointInterpolations, const FRotator& CmcStartRotation);
public: public:
/**
* Create a default instance of a left- or right handed interpolator.
*/
static USGHandInterpolator* Default(UObject* Outer, const bool bRightHanded); static USGHandInterpolator* Default(UObject* Outer, const bool bRightHanded);
/**
* Convert a serialized HandInterpolator back into a class representation.
*/
static USGHandInterpolator* Deserialize(UObject* Outer, const FString& SerializedString); static USGHandInterpolator* Deserialize(UObject* Outer, const FString& SerializedString);
public: public:
/**
* Calculate all angles of a specific finger based on an Interpolator and input angles.
*/
static TArray<FVector> InterpolateFingerAngles(ESGFinger Finger, const USGHandInterpolator* Interpolator, static TArray<FVector> InterpolateFingerAngles(ESGFinger Finger, const USGHandInterpolator* Interpolator,
const FVector& TotalGloveAngles); const FVector& TotalGloveAngles);
/**
* Calculate all angles of the Thumb based on an Interpolator and input angles.
*/
static TArray<FVector> InterpolateThumbAngles(const USGHandInterpolator* Interpolator, static TArray<FVector> InterpolateThumbAngles(const USGHandInterpolator* Interpolator,
const FVector& TotalGloveAngles); const FVector& TotalGloveAngles);
/**
* Calculate all hand angles based on an interpolator and total xyz angles.
*/
static TArray<TArray<FVector>> InterpolateHandAngles(const USGHandInterpolator* Interpolator, static TArray<TArray<FVector>> InterpolateHandAngles(const USGHandInterpolator* Interpolator,
const TArray<FVector>& TotalAngles); const TArray<FVector>& TotalAngles);
@@ -115,21 +155,42 @@ private:
FImplDeleter PimplDeleter; FImplDeleter PimplDeleter;
public: public:
/**
* Basic Constructor.
*/
USGHandInterpolator(); USGHandInterpolator();
/**
* Create a new basic HandInterpolator without a starting rotation.
*/
explicit USGHandInterpolator(const TArray<TArray<USGInterpolationSet*>>& JointInterpolations); explicit USGHandInterpolator(const TArray<TArray<USGInterpolationSet*>>& JointInterpolations);
/**
* Create a new basic HandInterpolator without a starting rotation.
*/
explicit USGHandInterpolator(const TArray<FSGInterpolationSetArray>& JointInterpolations); explicit USGHandInterpolator(const TArray<FSGInterpolationSetArray>& JointInterpolations);
/**
* Create a new basic HandInterpolator without a starting rotation.
*/
USGHandInterpolator(const TArray<TArray<USGInterpolationSet*>>& JointInterpolations, USGHandInterpolator(const TArray<TArray<USGInterpolationSet*>>& JointInterpolations,
const FQuat& CmcStartRotation); const FQuat& CmcStartRotation);
/**
* Create a new basic HandInterpolator with a starting rotation.
*/
USGHandInterpolator(const TArray<TArray<USGInterpolationSet*>>& JointInterpolations, USGHandInterpolator(const TArray<TArray<USGInterpolationSet*>>& JointInterpolations,
const FRotator& CmcStartRotation); const FRotator& CmcStartRotation);
/**
* Create a new basic HandInterpolator with a starting rotation.
*/
USGHandInterpolator(const TArray<FSGInterpolationSetArray>& JointInterpolations, USGHandInterpolator(const TArray<FSGInterpolationSetArray>& JointInterpolations,
const FQuat& CmcStartRotation); const FQuat& CmcStartRotation);
/**
* Create a new basic HandInterpolator with a starting rotation.
*/
USGHandInterpolator(const TArray<FSGInterpolationSetArray>& JointInterpolations, USGHandInterpolator(const TArray<FSGInterpolationSetArray>& JointInterpolations,
const FRotator& CmcStartRotation); const FRotator& CmcStartRotation);
@@ -158,32 +219,68 @@ public:
const FSGHandInterpolatorImpl& ToHandInterpolatorImpl() const; const FSGHandInterpolatorImpl& ToHandInterpolatorImpl() const;
public: public:
/**
* Interpolation sets for each finger. First index indicates which finger, Second index indicates the joint movement.
*/
TArray<TArray<USGInterpolationSet*>> GetJointInterpolations(UObject* Outer) const; TArray<TArray<USGInterpolationSet*>> GetJointInterpolations(UObject* Outer) const;
/**
* Starting rotation of the thumb cmc joint.
*/
FQuat GetCmcStartRotationQ() const; FQuat GetCmcStartRotationQ() const;
/**
* Starting rotation of the thumb cmc joint.
*/
FRotator GetCmcStartRotation() const; FRotator GetCmcStartRotation() const;
public: public:
/**
* Calculate any finger's movement rotation, using an input value.
*/
float CalculateAngle(ESGFinger Finger, int32 Movement, float Value) const; float CalculateAngle(ESGFinger Finger, int32 Movement, float Value) const;
/**
* Calculate a finger movement's rotation, using an input value.
*/
float CalculateAngle(ESGFinger Finger, ESGFingerMovement Movement, float Value) const; float CalculateAngle(ESGFinger Finger, ESGFingerMovement Movement, float Value) const;
/**
* Calculate a thumb movement's rotation, using an input value.
*/
float CalculateAngle(ESGFinger Finger, ESGThumbMovement Movement, float Value) const; float CalculateAngle(ESGFinger Finger, ESGThumbMovement Movement, float Value) const;
public: public:
/**
* Updates a particular joint movement interpolation, without changing its limits.
*/
void SetInterpolation(int32 Finger, int32 Movement, float InputAt0, float InputAt1, float AngleAt0, float AngleAt1); void SetInterpolation(int32 Finger, int32 Movement, float InputAt0, float InputAt1, float AngleAt0, float AngleAt1);
/**
* Updates a particular joint movement interpolation, without changing its limits.
*/
void SetInterpolation(ESGFinger Finger, ESGFingerMovement Movement, void SetInterpolation(ESGFinger Finger, ESGFingerMovement Movement,
float InputAt0, float InputAt1, float AngleAt0, float AngleAt1); float InputAt0, float InputAt1, float AngleAt0, float AngleAt1);
/**
* Updates a particular joint movement interpolation, without changing its limits.
*/
void SetInterpolation(ESGThumbMovement Movement, float InputAt0, float InputAt1, float AngleAt0, float AngleAt1); void SetInterpolation(ESGThumbMovement Movement, float InputAt0, float InputAt1, float AngleAt0, float AngleAt1);
/**
* Returns an interpolationSet
*/
USGInterpolationSet* GetInterpolation(UObject* Outer, int32 Finger, int32 Movement) const; USGInterpolationSet* GetInterpolation(UObject* Outer, int32 Finger, int32 Movement) const;
public: public:
/**
* Check if this handInterpolator matches another.
*/
bool Equals(const USGHandInterpolator* HandInterpolator) const; bool Equals(const USGHandInterpolator* HandInterpolator) const;
public: public:
/**
* Serialize this HandInterpolator into a string representation.
*/
FString SGSerialize() const; FString SGSerialize() const;
}; };
@@ -29,7 +29,8 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * Data class containing all variables to draw or analyze a virtual hand
* in different formats.
*/ */
@@ -53,6 +54,9 @@
class FSGHandPoseImpl; class FSGHandPoseImpl;
/**
* Contains all variables required to draw or analyze a virtual hand.
*/
UCLASS(BlueprintType) UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGHandPose final : public UObject class SENSEGLOVECORE_API USGHandPose final : public UObject
{ {
@@ -63,6 +67,9 @@ public:
UObject* Outer, const FSGHandPoseImpl& HandPoseImpl); UObject* Outer, const FSGHandPoseImpl& HandPoseImpl);
public: public:
/**
* Default Constructor.
*/
static USGHandPose* NewHandPose(UObject* Outer); static USGHandPose* NewHandPose(UObject* Outer);
static USGHandPose* NewHandPose( static USGHandPose* NewHandPose(
@@ -70,45 +77,87 @@ public:
bool bRightHanded, const TArray<TArray<FVector>>& JointPositions, const TArray<TArray<FQuat>>& JointRotations, bool bRightHanded, const TArray<TArray<FVector>>& JointPositions, const TArray<TArray<FQuat>>& JointRotations,
const TArray<TArray<FVector>>& HandAngles); const TArray<TArray<FVector>>& HandAngles);
/**
* Create a new instance of HandPose.
*/
static USGHandPose* NewHandPose( static USGHandPose* NewHandPose(
UObject* Outer, UObject* Outer,
bool bRightHanded, bool bRightHanded,
const TArray<TArray<FVector>>& JointPositions, const TArray<TArray<FRotator>>& JointRotations, const TArray<TArray<FVector>>& JointPositions, const TArray<TArray<FRotator>>& JointRotations,
const TArray<TArray<FVector>>& HandAngles); const TArray<TArray<FVector>>& HandAngles);
/**
* Create a new instance of HandPose.
*/
static USGHandPose* NewHandPose( static USGHandPose* NewHandPose(
UObject* Outer, UObject* Outer,
bool bRightHanded, const TArray<FSGVectorArray>& JointPositions, const TArray<FSGQuatArray>& JointRotations, bool bRightHanded, const TArray<FSGVectorArray>& JointPositions, const TArray<FSGQuatArray>& JointRotations,
const TArray<FSGVectorArray>& HandAngles); const TArray<FSGVectorArray>& HandAngles);
/**
* Create a new instance of HandPose.
*/
static USGHandPose* NewHandPose( static USGHandPose* NewHandPose(
UObject* Outer, UObject* Outer,
bool bRightHanded, const TArray<FSGVectorArray>& JointPositions, const TArray<FSGRotatorArray>& JointRotations, bool bRightHanded, const TArray<FSGVectorArray>& JointPositions, const TArray<FSGRotatorArray>& JointRotations,
const TArray<FSGVectorArray>& HandAngles); const TArray<FSGVectorArray>& HandAngles);
public: public:
/**
* Deserialize a HandPose back into usable values.
*/
static USGHandPose* Deserialize(UObject* Outer, const FString& SerializedString); static USGHandPose* Deserialize(UObject* Outer, const FString& SerializedString);
/**
* Generate a HandPose based on articulation angles (handAngles).
*/
static USGHandPose* FromHandAngles(UObject* Outer, static USGHandPose* FromHandAngles(UObject* Outer,
const TArray<TArray<FVector>>& HandAngles, bool bRightHanded, const TArray<TArray<FVector>>& HandAngles, bool bRightHanded,
const USGBasicHandModel* HandDimensions); const USGBasicHandModel* HandDimensions);
/**
* Generate a HandPose based on articulation angles (handAngles), with a default HandModel.
*/
static USGHandPose* FromHandAngles(UObject* Outer, const TArray<TArray<FVector>>& HandAngles, bool bRightHanded); static USGHandPose* FromHandAngles(UObject* Outer, const TArray<TArray<FVector>>& HandAngles, bool bRightHanded);
/**
* Create a new instance of a left or right handed Pose that is "idle"; in a neutral position.
*/
static USGHandPose* DefaultIdle(UObject* Outer, bool bRightHanded, const USGBasicHandModel* HandDimensions); static USGHandPose* DefaultIdle(UObject* Outer, bool bRightHanded, const USGBasicHandModel* HandDimensions);
/**
* Create a new instance of a left or right handed Pose that is "idle"; in a neutral position.
*/
static USGHandPose* DefaultIdle(UObject* Outer, bool bRightHanded); static USGHandPose* DefaultIdle(UObject* Outer, bool bRightHanded);
/**
* Generates a HandPose representing an 'open hand', used in calibration to determine finger extension.
*/
static USGHandPose* FlatHand(UObject* Outer, bool bRightHanded, const USGBasicHandModel* HandDimensions); static USGHandPose* FlatHand(UObject* Outer, bool bRightHanded, const USGBasicHandModel* HandDimensions);
/**
* Generates a HandPose representing an 'open hand', used in calibration to determine finger extension.
*/
static USGHandPose* FlatHand(UObject* Outer, bool bRightHanded); static USGHandPose* FlatHand(UObject* Outer, bool bRightHanded);
/**
* Generates a HandPose representing a 'thumbs up', used in calibration to determine finger flexion, thumb extension and adduction.
*/
static USGHandPose* ThumbsUp(UObject* Outer, bool bRightHanded, const USGBasicHandModel* HandDimensions); static USGHandPose* ThumbsUp(UObject* Outer, bool bRightHanded, const USGBasicHandModel* HandDimensions);
/**
* Generates a HandPose representing a 'thumbs up', used in calibration to determine finger flexion, thumb extension and adduction.
*/
static USGHandPose* ThumbsUp(UObject* Outer, bool bRightHanded); static USGHandPose* ThumbsUp(UObject* Outer, bool bRightHanded);
/**
* Generates a HandPose representing a 'fist', used in calibration to determine, thumb flexion and abduction.
*/
static USGHandPose* Fist(UObject* Outer, bool bRightHanded, const USGBasicHandModel* HandDimensions); static USGHandPose* Fist(UObject* Outer, bool bRightHanded, const USGBasicHandModel* HandDimensions);
/**
* Generates a HandPose representing a 'fist', used in calibration to determine, thumb flexion and abduction.
*/
static USGHandPose* Fist(UObject* Outer, bool bRightHanded); static USGHandPose* Fist(UObject* Outer, bool bRightHanded);
private: private:
@@ -123,20 +172,35 @@ private:
FImplDeleter PimplDeleter; FImplDeleter PimplDeleter;
public: public:
/**
* Default Constructor.
*/
USGHandPose(); USGHandPose();
/**
* Create a new instance of HandPose.
*/
USGHandPose(bool bRightHanded, USGHandPose(bool bRightHanded,
const TArray<TArray<FVector>>& JointPositions, const TArray<TArray<FQuat>>& JointRotations, const TArray<TArray<FVector>>& JointPositions, const TArray<TArray<FQuat>>& JointRotations,
const TArray<TArray<FVector>>& HandAngles); const TArray<TArray<FVector>>& HandAngles);
/**
* Create a new instance of HandPose.
*/
USGHandPose(bool bRightHanded, USGHandPose(bool bRightHanded,
const TArray<TArray<FVector>>& JointPositions, const TArray<TArray<FRotator>>& JointRotations, const TArray<TArray<FVector>>& JointPositions, const TArray<TArray<FRotator>>& JointRotations,
const TArray<TArray<FVector>>& HandAngles); const TArray<TArray<FVector>>& HandAngles);
/**
* Create a new instance of HandPose.
*/
USGHandPose(bool bRightHanded, USGHandPose(bool bRightHanded,
const TArray<FSGVectorArray>& JointPositions, const TArray<FSGQuatArray>& JointRotations, const TArray<FSGVectorArray>& JointPositions, const TArray<FSGQuatArray>& JointRotations,
const TArray<FSGVectorArray>& HandAngles); const TArray<FSGVectorArray>& HandAngles);
/**
*
*/
USGHandPose(bool bRightHanded, USGHandPose(bool bRightHanded,
const TArray<FSGVectorArray>& JointPositions, const TArray<FSGRotatorArray>& JointRotations, const TArray<FSGVectorArray>& JointPositions, const TArray<FSGRotatorArray>& JointRotations,
const TArray<FSGVectorArray>& HandAngles); const TArray<FSGVectorArray>& HandAngles);
@@ -166,25 +230,59 @@ public:
const FSGHandPoseImpl& ToHandPoseImpl() const; const FSGHandPoseImpl& ToHandPoseImpl() const;
public: public:
/**
* Whether this HandPose was created to be a right- or left hand.
*/
bool IsRight() const; bool IsRight() const;
/**
* Positions of all hand joints relative to the Sense Glove origin. From thumb to pinky, proximal to distal.
*/
TArray<TArray<FVector>> GetJointPositions() const; TArray<TArray<FVector>> GetJointPositions() const;
/**
* Quaternion rotations of all hand joints. From thumb to pinky, proximal to distal.
*/
TArray<TArray<FQuat>> GetJointRotationsQ() const; TArray<TArray<FQuat>> GetJointRotationsQ() const;
/**
* Rotations of all hand joints. From thumb to pinky, proximal to distal.
*/
TArray<TArray<FRotator>> GetJointRotations() const; TArray<TArray<FRotator>> GetJointRotations() const;
/**
* Euler representations of all possible hand angles. From thumb to pinky, proximal to distal.
*/
TArray<TArray<FVector>> GetHandAngles() const; TArray<TArray<FVector>> GetHandAngles() const;
public: public:
/**
* Returns true of these two hand poses are roughly equal.
*/
bool Equals(const USGHandPose* HandPose) const; bool Equals(const USGHandPose* HandPose) const;
/**
* Returns the total flexion of a specific finger as a value between 0 (fully extended) and 1 (fully flexed).
*
* @remarks Useful for animation or for detecting gestures.
*/
float GetNormalizedFlexion(ESGFinger Finger, bool bClamp01 = true) const; float GetNormalizedFlexion(ESGFinger Finger, bool bClamp01 = true) const;
/**
* Returns the total flexion of a specific finger as a value between 0 (fully extended) and 1 (fully flexed).
*
* @remarks Useful for animation or for detecting gestures.
*/
TArray<float> GetNormalizedFlexion(bool bClamp01 = true) const; TArray<float> GetNormalizedFlexion(bool bClamp01 = true) const;
public: public:
/**
*
*/
FString ToString(bool bShortFormat = false) const; FString ToString(bool bShortFormat = false) const;
/**
* Serialize this HandPose into a string representation.
*/
FString SGSerialize() const; FString SGSerialize() const;
}; };
@@ -29,7 +29,8 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * Hard-Coded Database that is used in calibration and in solving.
* Values herein are used to limit outputs within 'natural' ranges.
*/ */
@@ -43,45 +44,84 @@
#include "SGAnatomyKismetLibrary.generated.h" #include "SGAnatomyKismetLibrary.generated.h"
/**
* "Database" of anatomical values, such as joint limits.
*/
UCLASS(meta=(ScriptName = "SesneGloveAnatomyKismetLibrary")) UCLASS(meta=(ScriptName = "SesneGloveAnatomyKismetLibrary"))
class SENSEGLOVECOREKISMET_API USGAnatomyKismetLibrary final : public USGBlueprintFunctionLibrary class SENSEGLOVECOREKISMET_API USGAnatomyKismetLibrary final : public USGBlueprintFunctionLibrary
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
/**
* Total sum of all finger flexion that would be considered "total flexion".
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy")
static float GetTotalFingerFlexion(); static float GetTotalFingerFlexion();
/**
* Total sum of all finger flexion that would be considered "total extension".
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy")
static float GetTotalFingerExtension(); static float GetTotalFingerExtension();
/**
* Total sum of all thumb flexion that would be considered "total flexion".
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy")
static float GetTotalThumbFlexion(); static float GetTotalThumbFlexion();
/**
* Total sum of all thumb flexion that would be considered "total extension".
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy")
static float GetTotalThumbExtension(); static float GetTotalThumbExtension();
/**
* Retrieve one of the limits of a finger joint's movement.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy")
static float GetFingerJointLimit(bool bRightHanded, int32 Joint, int32 Movement, bool bMax); static float GetFingerJointLimit(bool bRightHanded, int32 Joint, int32 Movement, bool bMax);
/**
* Retrieve one of the limits of a thumb joint's movement.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy")
static float GetThumbJointLimit(bool bRightHanded, int32 Joint, int32 Movement, bool bMax); static float GetThumbJointLimit(bool bRightHanded, int32 Joint, int32 Movement, bool bMax);
/**
* Convert a total finger flexion in radians into a 0..1 representation.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy")
static float NormalizeFingerFlexion(float FlexionInRadians); static float NormalizeFingerFlexion(float FlexionInRadians);
/**
* Convert a total thumb flexion in radians into a 0..1 representation.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy")
static float NormalizeThumbFlexion(float FlexionInRadians); static float NormalizeThumbFlexion(float FlexionInRadians);
/**
* Get Hand Angles that would make a Default (Idle) Pose.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy")
static TArray<FSGVectorArray> GetDefaultHandAngles(bool bRightHanded); static TArray<FSGVectorArray> GetDefaultHandAngles(bool bRightHanded);
/**
* Get Hand Angles that would make a flat hand.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy")
static TArray<FSGVectorArray> GetFlatHandAngles(bool bRightHanded); static TArray<FSGVectorArray> GetFlatHandAngles(bool bRightHanded);
/**
* Get hand angles that would make a thumbs up.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy")
static TArray<FSGVectorArray> GetThumbsUpHandAngles(bool bRightHanded); static TArray<FSGVectorArray> GetThumbsUpHandAngles(bool bRightHanded);
/**
* Get Hand Angles that would make a fist.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Anatomy")
static TArray<FSGVectorArray> GetFistHandAngles(bool bRightHanded); static TArray<FSGVectorArray> GetFistHandAngles(bool bRightHanded);
}; };
@@ -29,7 +29,8 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * A data class containing the minimum required data for a hand's forward kinematics.
* Used in both kinematics and calibration.
*/ */
@@ -43,16 +44,25 @@
class USGBasicHandModel; class USGBasicHandModel;
/**
* Represents data of a user's hand required for forward kinematics.
*/
UCLASS(meta=(ScriptName = "SesneGloveBasicHandModelKismetLibrary")) UCLASS(meta=(ScriptName = "SesneGloveBasicHandModelKismetLibrary"))
class SENSEGLOVECOREKISMET_API USGBasicHandModelKismetLibrary final : public USGBlueprintFunctionLibrary class SENSEGLOVECOREKISMET_API USGBasicHandModelKismetLibrary final : public USGBlueprintFunctionLibrary
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
/**
* Basic class Constructor.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model", UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGBasicHandModel* MakeBasicHandModel(UObject* WorldContextObject); static USGBasicHandModel* MakeBasicHandModel(UObject* WorldContextObject);
/**
* Create a new BasicHandModel with no starting rotations.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Basic Hand Model", UFUNCTION(BlueprintCallable, DisplayName="Make Basic Hand Model",
Category="SenseGlove | Core | Kinematics | Basic Hand Model", Category="SenseGlove | Core | Kinematics | Basic Hand Model",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
@@ -60,6 +70,9 @@ public:
UObject* WorldContextObject, UObject* WorldContextObject,
bool bRightHanded, const TArray<FSGFloatArray>& Lengths, const TArray<FVector>& StartPositions); bool bRightHanded, const TArray<FSGFloatArray>& Lengths, const TArray<FVector>& StartPositions);
/**
* Create a new BasicHandModel.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Basic Hand Model", UFUNCTION(BlueprintCallable, DisplayName="Make Basic Hand Model",
Category="SenseGlove | Core | Kinematics | Basic Hand Model", Category="SenseGlove | Core | Kinematics | Basic Hand Model",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
@@ -68,6 +81,9 @@ public:
bool bRightHanded, const TArray<FSGFloatArray>& Lengths, bool bRightHanded, const TArray<FSGFloatArray>& Lengths,
const TArray<FVector>& StartPositions, const TArray<FQuat>& StartRotations); const TArray<FVector>& StartPositions, const TArray<FQuat>& StartRotations);
/**
* Create a new BasicHandModel.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Basic Hand Model", UFUNCTION(BlueprintCallable, DisplayName="Make Basic Hand Model",
Category="SenseGlove | Core | Kinematics | Basic Hand Model", Category="SenseGlove | Core | Kinematics | Basic Hand Model",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
@@ -76,114 +92,212 @@ public:
bool bRightHanded, const TArray<FSGFloatArray>& Lengths, bool bRightHanded, const TArray<FSGFloatArray>& Lengths,
const TArray<FVector>& StartPositions, const TArray<FRotator>& StartRotations); const TArray<FVector>& StartPositions, const TArray<FRotator>& StartRotations);
/**
* Retrieve a default left or right hand model.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model", UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGBasicHandModel* Default(UObject* WorldContextObject, bool bRightHanded); static USGBasicHandModel* Default(UObject* WorldContextObject, bool bRightHanded);
/**
* Convert a serialized HandModel back into its class representation.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model", UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGBasicHandModel* Deserialize(UObject* WorldContextObject, const FString& SerializedString); static USGBasicHandModel* Deserialize(UObject* WorldContextObject, const FString& SerializedString);
/**
* Default finger lengths (based on right hand).
*
* @remarks Any missing fingers are replaced with their respective value.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static TArray<FSGFloatArray> GetBaseFingerLengths(); static TArray<FSGFloatArray> GetBaseFingerLengths();
/**
* Default joint positions (based on right hand).
*
* @remarks Any missing positions are replaced with their respective value.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static TArray<FVector> GetBaseJointPositions(); static TArray<FVector> GetBaseJointPositions();
/**
* Default joint angles (based on right hand).
*
* @remarks Any missing angles are replaced with their respective value.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static TArray<FVector> GetBaseJointAngles(); static TArray<FVector> GetBaseJointAngles();
/**
* Whether or not this BasicHandModel was created for a left- or right hand. Used for validation.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static bool IsRight(const USGBasicHandModel* BasicHandModel); static bool IsRight(const USGBasicHandModel* BasicHandModel);
/**
* The length of individual finger phalangers in mm, sorted per finger. Generally 5x3.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static TArray<FSGFloatArray> GetFingerLengths(const USGBasicHandModel* BasicHandModel); static TArray<FSGFloatArray> GetFingerLengths(const USGBasicHandModel* BasicHandModel);
/**
* Retrieve the finger lengths of a specific finger in cm.
*/
UFUNCTION(BlueprintPure, DisplayName="Get Finger Lengths", UFUNCTION(BlueprintPure, DisplayName="Get Finger Lengths",
Category="SenseGlove | Core | Kinematics | Basic Hand Model") Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static TArray<float> GetFingerLengths_F(const USGBasicHandModel* BasicHandModel, ESGFinger Finger); static TArray<float> GetFingerLengths_F(const USGBasicHandModel* BasicHandModel, ESGFinger Finger);
/**
* Set the finger lengths of a specific finger in cm.
*/
UFUNCTION(BlueprintCallable, DisplayName="Set Finger Lengths", UFUNCTION(BlueprintCallable, DisplayName="Set Finger Lengths",
Category="SenseGlove | Core | Kinematics | Basic Hand Model") Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static void SetFingerLengths_ESGFinger_F_L(UPARAM(ref) USGBasicHandModel* BasicHandModel, ESGFinger Finger, static void SetFingerLengths_ESGFinger_F_L(UPARAM(ref) USGBasicHandModel* BasicHandModel, ESGFinger Finger,
const TArray<float>& Lengths); const TArray<float>& Lengths);
/**
* Set the finger lengths of a specific finger in cm.
*/
UFUNCTION(BlueprintCallable, DisplayName="Set Finger Lengths", UFUNCTION(BlueprintCallable, DisplayName="Set Finger Lengths",
Category="SenseGlove | Core | Kinematics | Basic Hand Model") Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static void SetFingerLengths_uint8_F_L(UPARAM(ref) USGBasicHandModel* BasicHandModel, uint8 Finger, static void SetFingerLengths_uint8_F_L(UPARAM(ref) USGBasicHandModel* BasicHandModel, uint8 Finger,
const TArray<float>& Lengths); const TArray<float>& Lengths);
/**
* Get the finger ratios of all fingers.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
TArray<FSGFloatArray> GetFingerRatios(const USGBasicHandModel* BasicHandModel) const; TArray<FSGFloatArray> GetFingerRatios(const USGBasicHandModel* BasicHandModel) const;
/**
* Get the finger ratios of a specific finger.
*/
UFUNCTION(BlueprintPure, DisplayName="Get Finger Ratios", UFUNCTION(BlueprintPure, DisplayName="Get Finger Ratios",
Category="SenseGlove | Core | Kinematics | Basic Hand Model") Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static TArray<float> GetFingerRatios_F(const USGBasicHandModel* BasicHandModel, ESGFinger Finger); static TArray<float> GetFingerRatios_F(const USGBasicHandModel* BasicHandModel, ESGFinger Finger);
/**
* Starting joint positions relative to the device Origin.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static TArray<FVector> GetStartJointPositions(const USGBasicHandModel* BasicHandModel); static TArray<FVector> GetStartJointPositions(const USGBasicHandModel* BasicHandModel);
/**
*
*/
UFUNCTION(BlueprintCallable, DisplayName="Set Start Joint Position", UFUNCTION(BlueprintCallable, DisplayName="Set Start Joint Position",
Category="SenseGlove | Core | Kinematics | Basic Hand Model") Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static void SetStartJointPosition_ESGFinger_F_P(UPARAM(ref) USGBasicHandModel* BasicHandModel, ESGFinger Finger, static void SetStartJointPosition_ESGFinger_F_P(UPARAM(ref) USGBasicHandModel* BasicHandModel, ESGFinger Finger,
const FVector& Position); const FVector& Position);
/**
*
*/
UFUNCTION(BlueprintPure, DisplayName="Set Start Joint Position", UFUNCTION(BlueprintPure, DisplayName="Set Start Joint Position",
Category="SenseGlove | Core | Kinematics | Basic Hand Model") Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static void SetStartJointPosition_uint8_F_P(UPARAM(ref) USGBasicHandModel* BasicHandModel, uint8 Finger, static void SetStartJointPosition_uint8_F_P(UPARAM(ref) USGBasicHandModel* BasicHandModel, uint8 Finger,
const FVector& Position); const FVector& Position);
/**
* Starting joint rotations relative to the device Origin.
*/
UFUNCTION(BlueprintPure, DisplayName="Get Start Joint Rotations", UFUNCTION(BlueprintPure, DisplayName="Get Start Joint Rotations",
Category="SenseGlove | Core | Kinematics | Basic Hand Model") Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static TArray<FQuat> GetStartJointRotations_TArrayFQuat(const USGBasicHandModel* BasicHandModel); static TArray<FQuat> GetStartJointRotations_TArrayFQuat(const USGBasicHandModel* BasicHandModel);
/**
* Starting joint rotations relative to the device Origin.
*/
UFUNCTION(BlueprintPure, DisplayName="Get Start Joint Rotations", UFUNCTION(BlueprintPure, DisplayName="Get Start Joint Rotations",
Category="SenseGlove | Core | Kinematics | Basic Hand Model") Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static TArray<FRotator> GetStartJointRotations_TArrayFRotator(const USGBasicHandModel* BasicHandModel); static TArray<FRotator> GetStartJointRotations_TArrayFRotator(const USGBasicHandModel* BasicHandModel);
/**
* Retrieve the start position of a specific finger.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static FVector GetJointPosition(const USGBasicHandModel* BasicHandModel, ESGFinger Finger); static FVector GetJointPosition(const USGBasicHandModel* BasicHandModel, ESGFinger Finger);
/**
* Set the start position of a specific finger.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static void SetJointPosition(UPARAM(ref) USGBasicHandModel* BasicHandModel, const FVector& NewPosition, static void SetJointPosition(UPARAM(ref) USGBasicHandModel* BasicHandModel, const FVector& NewPosition,
ESGFinger Finger); ESGFinger Finger);
/**
* Retrieve the start rotation of a specific finger.
*/
UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotation", UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotation",
Category="SenseGlove | Core | Kinematics | Basic Hand Model") Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static FQuat GetJointRotation_FQuat(const USGBasicHandModel* BasicHandModel, ESGFinger Finger); static FQuat GetJointRotation_FQuat(const USGBasicHandModel* BasicHandModel, ESGFinger Finger);
/**
* Retrieve the start rotation of a specific finger.
*/
UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotation", UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotation",
Category="SenseGlove | Core | Kinematics | Basic Hand Model") Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static FRotator GetJointRotation_FRotator(const USGBasicHandModel* BasicHandModel, ESGFinger Finger); static FRotator GetJointRotation_FRotator(const USGBasicHandModel* BasicHandModel, ESGFinger Finger);
/**
* Set the start rotation of a specific finger.
*/
UFUNCTION(BlueprintCallable, DisplayName="Set Joint Rotation", UFUNCTION(BlueprintCallable, DisplayName="Set Joint Rotation",
Category="SenseGlove | Core | Kinematics | Basic Hand Model") Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static void SetJointRotation_FQuat_NR_F( static void SetJointRotation_FQuat_NR_F(
UPARAM(ref) USGBasicHandModel* BasicHandModel, const FQuat& NewRotation, ESGFinger Finger); UPARAM(ref) USGBasicHandModel* BasicHandModel, const FQuat& NewRotation, ESGFinger Finger);
/**
* Set the start rotation of a specific finger.
*/
UFUNCTION(BlueprintCallable, DisplayName="Set Joint Rotation", UFUNCTION(BlueprintCallable, DisplayName="Set Joint Rotation",
Category="SenseGlove | Core | Kinematics | Basic Hand Model") Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static void SetJointRotation_FRotator_NR_F( static void SetJointRotation_FRotator_NR_F(
UPARAM(ref) USGBasicHandModel* BasicHandModel, const FRotator& NewRotation, ESGFinger Finger); UPARAM(ref) USGBasicHandModel* BasicHandModel, const FRotator& NewRotation, ESGFinger Finger);
/**
* Get the total lengths of fingers, in cm.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static TArray<float> GetTotalLengths(const USGBasicHandModel* BasicHandModel); static TArray<float> GetTotalLengths(const USGBasicHandModel* BasicHandModel);
/**
* Get the total length of a specific finger, in mm.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static float GetTotalLength(const USGBasicHandModel* BasicHandModel, ESGFinger Finger); static float GetTotalLength(const USGBasicHandModel* BasicHandModel, ESGFinger Finger);
/**
* Retrieve the lengths of a specific finger, as BasicHandModel representation (L, 0, 0).
*
* @remarks Used for forwards kinematics.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static TArray<FVector> Get3DLengths(const USGBasicHandModel* BasicHandModel, ESGFinger Finger); static TArray<FVector> Get3DLengths(const USGBasicHandModel* BasicHandModel, ESGFinger Finger);
/**
* Check if this BasicHandModel has the same values as another BasicHandModel.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static bool Equals(const USGBasicHandModel* A, const USGBasicHandModel* B); static bool Equals(const USGBasicHandModel* A, const USGBasicHandModel* B);
/**
* Convert this handModel into a string notation, readable for humans. Does not include starting positions / rotations.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static FString ToString(const USGBasicHandModel* BasicHandModel); static FString ToString(const USGBasicHandModel* BasicHandModel);
/**
* Convert this handModel into a string notation, readable for humans. Optionally includes starting positions / rotations.
*/
UFUNCTION(BlueprintPure, DisplayName="To String", Category="SenseGlove | Core | Kinematics | Basic Hand Model") UFUNCTION(BlueprintPure, DisplayName="To String", Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static FString ToString_bLO(const USGBasicHandModel* BasicHandModel, bool bLengthsOnly); static FString ToString_bLO(const USGBasicHandModel* BasicHandModel, bool bLengthsOnly);
/**
* Serialize this HandModel into a string representation.
*/
UFUNCTION(BlueprintPure, DisplayName="Serialize", Category="SenseGlove | Core | Kinematics | Basic Hand Model") UFUNCTION(BlueprintPure, DisplayName="Serialize", Category="SenseGlove | Core | Kinematics | Basic Hand Model")
static FString SGSerialize(const USGBasicHandModel* BasicHandModel); static FString SGSerialize(const USGBasicHandModel* BasicHandModel);
}; };
@@ -29,7 +29,9 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * Represents a Sense Glove Device that has no specific class within the API.
* Used to test different iterations of the same product before integrating it into the Core API.
* Allows access to raw sensor values and commands of such a device.
*/ */
@@ -42,42 +44,78 @@
class USGBetaDevice; class USGBetaDevice;
/**
* A Device that adheres to the SenseGlove communications protocol, but which has no implementation in this API.
*/
UCLASS(meta=(ScriptName = "SesneGloveBetaDeviceKismetLibrary")) UCLASS(meta=(ScriptName = "SesneGloveBetaDeviceKismetLibrary"))
class SENSEGLOVECOREKISMET_API USGBetaDeviceKismetLibrary final : public USGBlueprintFunctionLibrary class SENSEGLOVECOREKISMET_API USGBetaDeviceKismetLibrary final : public USGBlueprintFunctionLibrary
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
/**
* Deserialize a beta device from its basic constants string. Returns nullptr is unsuccessful.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Beta Device", meta=(WorldContext="WorldContextObject")) UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Beta Device", meta=(WorldContext="WorldContextObject"))
static USGBetaDevice* Parse(UObject* WorldContextObject, const FString& String); static USGBetaDevice* Parse(UObject* WorldContextObject, const FString& String);
/**
* Get the DeviceType enumerator of this SenseGlove, used in DeviceList enumeration.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device")
static ESGDeviceType GetDeviceType(const USGBetaDevice* BetaDevice); static ESGDeviceType GetDeviceType(const USGBetaDevice* BetaDevice);
/**
* Get the unique identifier of this device.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device")
static FString GetDeviceId(const USGBetaDevice* BetaDevice); static FString GetDeviceId(const USGBetaDevice* BetaDevice);
/**
* Retrieve this device's hardware version.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device")
static FString GetHardwareVersion(const USGBetaDevice* BetaDevice); static FString GetHardwareVersion(const USGBetaDevice* BetaDevice);
/**
* Retrieve this device's firmware version.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device")
static int32 GetFirmwareVersion(const USGBetaDevice* BetaDevice); static int32 GetFirmwareVersion(const USGBetaDevice* BetaDevice);
/**
* Retrieve this device's sub-firmware version.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device")
static int32 GetSubFirmwareVersion(const USGBetaDevice* BetaDevice); static int32 GetSubFirmwareVersion(const USGBetaDevice* BetaDevice);
/**
* Retrieve the constants string for additional processing.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device")
static FString GetConstantsString(const USGBetaDevice* BetaDevice); static FString GetConstantsString(const USGBetaDevice* BetaDevice);
/**
* Retrieve a raw sensor string from this Beta Device.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device")
static FString GetSensorData(const USGBetaDevice* BetaDevice); static FString GetSensorData(const USGBetaDevice* BetaDevice);
/**
* Retrieve the last command retrieved from this Beta Device.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device")
static FString GetLastCommand(const USGBetaDevice* BetaDevice); static FString GetLastCommand(const USGBetaDevice* BetaDevice);
/**
* Send a raw string command to this device.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device")
static bool SendHaptics(const USGBetaDevice* BetaDevice, const FString& Command); static bool SendHaptics(const USGBetaDevice* BetaDevice, const FString& Command);
/**
* Create a string representation of this device for reporting purposes.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Beta Device")
static FString ToString(const USGBetaDevice* BetaDevice); static FString ToString(const USGBetaDevice* BetaDevice);
}; };
@@ -29,7 +29,7 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * Buzz motor command specific for the Sense Glove.
*/ */
@@ -42,38 +42,62 @@
class USGBuzzCommand; class USGBuzzCommand;
/**
* A vibration command for the Sense Glove, with levels for each finger.
*/
UCLASS(meta=(ScriptName = "SesneGloveBuzzCommandKismetLibrary")) UCLASS(meta=(ScriptName = "SesneGloveBuzzCommandKismetLibrary"))
class SENSEGLOVECOREKISMET_API USGBuzzCommandKismetLibrary final : public USGBlueprintFunctionLibrary class SENSEGLOVECOREKISMET_API USGBuzzCommandKismetLibrary final : public USGBlueprintFunctionLibrary
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
/**
* Basic Constructor.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Buzz Command", UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Buzz Command",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGBuzzCommand* MakeBuzzCommand(UObject* WorldContextObject); static USGBuzzCommand* MakeBuzzCommand(UObject* WorldContextObject);
/**
* Create a new buzz motor command, where each finger level is contained inside an array of size 5.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Buzz Command", Category="SenseGlove | Core | Haptics | Buzz Command", UFUNCTION(BlueprintCallable, DisplayName="Make Buzz Command", Category="SenseGlove | Core | Haptics | Buzz Command",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGBuzzCommand* MakeBuzzCommand_BL(UObject* WorldContextObject, const TArray<int32>& BuzzLevels); static USGBuzzCommand* MakeBuzzCommand_BL(UObject* WorldContextObject, const TArray<int32>& BuzzLevels);
/**
* Create a new Buzz Motor command, indicating the intensity for each finger.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Buzz Command", Category="SenseGlove | Core | Haptics | Buzz Command", UFUNCTION(BlueprintCallable, DisplayName="Make Buzz Command", Category="SenseGlove | Core | Haptics | Buzz Command",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGBuzzCommand* MakeBuzzCommand_T_I_M_R_P(UObject* WorldContextObject, static USGBuzzCommand* MakeBuzzCommand_T_I_M_R_P(UObject* WorldContextObject,
int32 Thumb, int32 Index, int32 Middle, int32 Ring, int32 Pinky); int32 Thumb, int32 Index, int32 Middle, int32 Ring, int32 Pinky);
/**
* Create a new Buzz Motor command, with only one finger being activated.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Buzz Command", Category="SenseGlove | Core | Haptics | Buzz Command", UFUNCTION(BlueprintCallable, DisplayName="Make Buzz Command", Category="SenseGlove | Core | Haptics | Buzz Command",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGBuzzCommand* MakeBuzzCommand_F_BL(UObject* WorldContextObject, ESGFinger Finger, int32 BuzzLevel); static USGBuzzCommand* MakeBuzzCommand_F_BL(UObject* WorldContextObject, ESGFinger Finger, int32 BuzzLevel);
/**
* A command that turns off all vibration motors of the Sense Glove.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Buzz Command", UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Buzz Command",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGBuzzCommand* Off(UObject* WorldContextObject); static USGBuzzCommand* Off(UObject* WorldContextObject);
/**
* Copy this Buzz Command into a new object.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Buzz Command", UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Buzz Command",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGBuzzCommand* Copy(UObject* WorldContextObject, const USGBuzzCommand* BuzzCommand); static USGBuzzCommand* Copy(UObject* WorldContextObject, const USGBuzzCommand* BuzzCommand);
/**
* Merge this command with another, taking the maximum value between the two.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Buzz Command", UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Buzz Command",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGBuzzCommand* Merge(UObject* WorldContextObject, const USGBuzzCommand* A, const USGBuzzCommand* B); static USGBuzzCommand* Merge(UObject* WorldContextObject, const USGBuzzCommand* A, const USGBuzzCommand* B);
}; };
@@ -47,22 +47,37 @@ class SENSEGLOVECOREKISMET_API USGCalibrationDataPointKismetLibrary final : publ
GENERATED_BODY() GENERATED_BODY()
public: public:
/**
*
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Calibraion Data Point", UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Calibraion Data Point",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGCalibrationDataPoint* MakeCalibrationDataPoint(UObject* WorldContextObject); static USGCalibrationDataPoint* MakeCalibrationDataPoint(UObject* WorldContextObject);
/**
* Create a new data point.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Calibration Data Point", UFUNCTION(BlueprintCallable, DisplayName="Make Calibration Data Point",
Category="SenseGlove | Core | Calibration | Calibraion Data Point", meta=(WorldContext="WorldContextObject")) Category="SenseGlove | Core | Calibration | Calibraion Data Point", meta=(WorldContext="WorldContextObject"))
static USGCalibrationDataPoint* MakeCalibrationDataPoint_CS_CV( static USGCalibrationDataPoint* MakeCalibrationDataPoint_CS_CV(
UObject* WorldContextObject, UObject* WorldContextObject,
int32 CurrentStage, const TArray<FVector>& CalibrationValues); int32 CurrentStage, const TArray<FVector>& CalibrationValues);
/**
* Actual calibration values.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Calibraion Data Point") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Calibraion Data Point")
static TArray<FVector> GetCalibrationValues(const USGCalibrationDataPoint* CalibrationDataPoint); static TArray<FVector> GetCalibrationValues(const USGCalibrationDataPoint* CalibrationDataPoint);
/**
* The Calibration stage this data point belongs to.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Calibraion Data Point") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Calibraion Data Point")
static int32 GetStage(const USGCalibrationDataPoint* CalibrationDataPoint); static int32 GetStage(const USGCalibrationDataPoint* CalibrationDataPoint);
/**
* Log Calibration values for storing on disk.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Calibraion Data Point") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Calibraion Data Point")
static FString ToLogData(const USGCalibrationDataPoint* CalibrationDataPoint, const FString& Delimiter = "\t"); static FString ToLogData(const USGCalibrationDataPoint* CalibrationDataPoint, const FString& Delimiter = "\t");
}; };
@@ -29,7 +29,7 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * Interface for SenseCom, allows the retrieval of Devices and Data, but only as.
*/ */
@@ -46,57 +46,104 @@
class USGDevice; class USGDevice;
/**
* Interface for SenseCom, allows the retrieval of Devices and Data.
*/
UCLASS(meta=(ScriptName = "SesneGloveDeviceListKismetLibrary")) UCLASS(meta=(ScriptName = "SesneGloveDeviceListKismetLibrary"))
class SENSEGLOVECOREKISMET_API USGDeviceListKismetLibrary final : public USGBlueprintFunctionLibrary class SENSEGLOVECOREKISMET_API USGDeviceListKismetLibrary final : public USGBlueprintFunctionLibrary
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
/**
* Retrieve the number of devices that have been detected by the SenseCom executable.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List")
static int32 ActiveDevices(); static int32 ActiveDevices();
/**
* Returns true if the SenseCom program is running.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List")
static bool SenseCommRunning(); static bool SenseCommRunning();
/**
* Clear the device list, and block any further attempt to add to it until ReInitialize is called.
*
* @remarks Useful if your IDE has troubles unloading dlls (cough, Unity, Cough).
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List")
static void Dispose(); static void Dispose();
/**
* When you've accidentally disposed of the list before you meant to.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List")
static void Reinitialize(); static void Reinitialize();
/**
* Retrieve all Sense Glove Devices connected to this system.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List", meta=(WorldContext="WorldContextObject")) UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List", meta=(WorldContext="WorldContextObject"))
static TArray<USGDevice*> GetDevices(UObject* WorldContextObject); static TArray<USGDevice*> GetDevices(UObject* WorldContextObject);
/**
* Retrieve a list of SGDevices of a specific class.
*/
UFUNCTION(BlueprintCallable, DisplayName="Get Devices", Category="SenseGlove | Core | Device List", UFUNCTION(BlueprintCallable, DisplayName="Get Devices", Category="SenseGlove | Core | Device List",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static TArray<USGDevice*> GetDevices_TSubclassOfUSGDevice_DT(UObject* WorldContextObject, static TArray<USGDevice*> GetDevices_TSubclassOfUSGDevice_DT(UObject* WorldContextObject,
const TSubclassOf<USGDevice>& DeviceType); const TSubclassOf<USGDevice>& DeviceType);
/**
* Retrieve a list of SGDevices of a specific type.
*/
UFUNCTION(BlueprintCallable, DisplayName="Get Devices", Category="SenseGlove | Core | Device List", UFUNCTION(BlueprintCallable, DisplayName="Get Devices", Category="SenseGlove | Core | Device List",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static TArray<USGDevice*> GetDevices_ESGDeviceType_DT(UObject* WorldContextObject, ESGDeviceType DeviceType); static TArray<USGDevice*> GetDevices_ESGDeviceType_DT(UObject* WorldContextObject, ESGDeviceType DeviceType);
/**
* Retrieve the latest (raw) sensor data from a specific device in our list.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List")
static bool GetSensorDataString(int32 IpcIndex, const FString& IpcAddress, FString& OutString); static bool GetSensorDataString(int32 IpcIndex, const FString& IpcAddress, FString& OutString);
/**
* Send a (raw) command to a specific device in the list.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List")
static bool SendHaptics(int32 IpcIndex, const FString& IpcAddress, const FString& Commands); static bool SendHaptics(int32 IpcIndex, const FString& IpcAddress, const FString& Commands);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List")
static FString GetDeviceStringAt(int32 IpcIndex, const FString& IpcAddress, int32 Index); static FString GetDeviceStringAt(int32 IpcIndex, const FString& IpcAddress, int32 Index);
/**
* Retrieve Device Address.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List")
static FString GetAddress(int32 IpcIndex, const FString& IpcAddress); static FString GetAddress(int32 IpcIndex, const FString& IpcAddress);
/**
* Retieve this device's connectionType.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List")
static ESGConnectionType GetConnectionType(int32 IpcIndex, const FString& IpcAddress); static ESGConnectionType GetConnectionType(int32 IpcIndex, const FString& IpcAddress);
/**
* Returns true if the device at this connection side is properly connected.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List")
static bool IsConnected(int32 IpcIndex, const FString& IpcAddress); static bool IsConnected(int32 IpcIndex, const FString& IpcAddress);
/**
* Retrieve the device's Packets per Second Variable.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List")
static int32 PacketsPerSecondReceived(int32 IpcIndex, const FString& IpcAddress); static int32 PacketsPerSecondReceived(int32 IpcIndex, const FString& IpcAddress);
/**
* Retrieve the device's Packets per Second sent Variable.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device List")
static int32 PacketsPerSecondSent(int32 IpcIndex, const FString& IpcAddress); static int32 PacketsPerSecondSent(int32 IpcIndex, const FString& IpcAddress);
}; };
@@ -29,7 +29,8 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * Base class for Device Models containing the minimum amount of data gathered
* through Communications Protocol. Used for shared functionality.
*/ */
@@ -45,36 +46,60 @@
class USGDeviceModel; class USGDeviceModel;
/**
* Base class containing the minimum amount of data for device models.
*/
UCLASS(meta=(ScriptName = "SesneGloveDeviceModelKismetLibrary")) UCLASS(meta=(ScriptName = "SesneGloveDeviceModelKismetLibrary"))
class SENSEGLOVECOREKISMET_API USGDeviceModelKismetLibrary final : public USGBlueprintFunctionLibrary class SENSEGLOVECOREKISMET_API USGDeviceModelKismetLibrary final : public USGBlueprintFunctionLibrary
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
/**
* Empty constructor to be used by child classes.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device Model", meta=(WorldContext="WorldContextObject")) UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device Model", meta=(WorldContext="WorldContextObject"))
static USGDeviceModel* MakeDeviceModel(UObject* WorldContextObject); static USGDeviceModel* MakeDeviceModel(UObject* WorldContextObject);
/**
*
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Device Model", Category="SenseGlove | Core | Device Model", UFUNCTION(BlueprintCallable, DisplayName="Make Device Model", Category="SenseGlove | Core | Device Model",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGDeviceModel* MakeDeviceModel_I_HV_FV_SFV( static USGDeviceModel* MakeDeviceModel_I_HV_FV_SFV(
UObject* WorldContextObject, UObject* WorldContextObject,
const FString& Id, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion); const FString& Id, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion);
/**
* Parse a 32-bit integer value into a set of booleans (010010011) that indicate which (optional) functions this device has.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device Model") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device Model")
static TArray<bool> ParseFunctions(int32 Value, int32 Size); static TArray<bool> ParseFunctions(int32 Value, int32 Size);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device Model") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Device Model")
static void ParseFirmware(const FString& RawFirmware, int32& OutMainVersion, int32& OutSubVersion); static void ParseFirmware(const FString& RawFirmware, int32& OutMainVersion, int32& OutSubVersion);
/**
* Retrieve the Unique identifier of this device.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Device Model") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Device Model")
static FString GetDeviceId(const USGDeviceModel* DeviceModel); static FString GetDeviceId(const USGDeviceModel* DeviceModel);
/**
* Retrieve the Hardware (sub) version of this Sense Glove Device.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Device Model") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Device Model")
static FString GetHardwareVersion(const USGDeviceModel* DeviceModel); static FString GetHardwareVersion(const USGDeviceModel* DeviceModel);
/**
* Firmware version running on the device's MicroController. (as v4.12, this is the 4).
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Device Model") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Device Model")
static int32 GetFirmwareVersion(const USGDeviceModel* DeviceModel); static int32 GetFirmwareVersion(const USGDeviceModel* DeviceModel);
/**
* Sub firmware version running on the device's microcontroller (as v4.12, this is the 12).
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Device Model") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Device Model")
static int32 GetSubFirmwareVersion(const USGDeviceModel* DeviceModel); static int32 GetSubFirmwareVersion(const USGDeviceModel* DeviceModel);
}; };
@@ -29,7 +29,7 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * A command for five fingers that can be sent to a Sense Glove device.
*/ */
@@ -41,24 +41,42 @@
class USGFingerCommand; class USGFingerCommand;
/**
* A command that contains values (levels) for five fingers.
*/
UCLASS(meta=(ScriptName = "SesneGloveFingerCommandKismetLibrary")) UCLASS(meta=(ScriptName = "SesneGloveFingerCommandKismetLibrary"))
class SENSEGLOVECOREKISMET_API USGFingerCommandKismetLibrary : public USGBlueprintFunctionLibrary class SENSEGLOVECOREKISMET_API USGFingerCommandKismetLibrary : public USGBlueprintFunctionLibrary
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
/**
*
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Finger Command") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Finger Command")
static TArray<int32> GetLevels(const USGFingerCommand* FingerCommand); static TArray<int32> GetLevels(const USGFingerCommand* FingerCommand);
/**
*
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Finger Command") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Finger Command")
static int32 GetLevel(const USGFingerCommand* FingerCommand, int32 Finger); static int32 GetLevel(const USGFingerCommand* FingerCommand, int32 Finger);
/**
*
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Finger Command") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Finger Command")
static void SetLevel(USGFingerCommand* FingerCommand, int32 Finger, int32 Value); static void SetLevel(USGFingerCommand* FingerCommand, int32 Finger, int32 Value);
/**
* Check if this command contains the same values as another.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Finger Command") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Finger Command")
static bool Equals(const USGFingerCommand* A, const USGFingerCommand* B); static bool Equals(const USGFingerCommand* A, const USGFingerCommand* B);
/**
* Create a string representation of this finger command.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Finger Command") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Finger Command")
static FString ToString(const USGFingerCommand* FingerCommand); static FString ToString(const USGFingerCommand* FingerCommand);
}; };
@@ -29,7 +29,7 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * A command for five fingers that can be sent to a Sense Glove device.
*/ */
@@ -42,45 +42,69 @@
class USGForceFeedbackCommand; class USGForceFeedbackCommand;
/**
* A Force-Feedback command for the Sense Glove, with levels for each finger.
*/
UCLASS(meta=(ScriptName = "SesneGloveForceFeedbackCommandKismetLibrary")) UCLASS(meta=(ScriptName = "SesneGloveForceFeedbackCommandKismetLibrary"))
class SENSEGLOVECOREKISMET_API USGForceFeedbackCommandKismetLibrary final : public USGBlueprintFunctionLibrary class SENSEGLOVECOREKISMET_API USGForceFeedbackCommandKismetLibrary final : public USGBlueprintFunctionLibrary
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
/**
* Empty constructor for internal initialization.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Force Feedback Command", UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Force Feedback Command",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGForceFeedbackCommand* MakeForceFeedbackCommand(UObject* WorldContextObject); static USGForceFeedbackCommand* MakeForceFeedbackCommand(UObject* WorldContextObject);
/**
* Create a new Force-Feedback Command, with levels for each finger stored in an int[5] array.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Force Feedback Command", UFUNCTION(BlueprintCallable, DisplayName="Make Force Feedback Command",
Category="SenseGlove | Core | Haptics | Force Feedback Command", Category="SenseGlove | Core | Haptics | Force Feedback Command",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGForceFeedbackCommand* MakeForceFeedbackCommand_FFL( static USGForceFeedbackCommand* MakeForceFeedbackCommand_FFL(
UObject* WorldContextObject, const TArray<int32>& ForceFeedbackLevels); UObject* WorldContextObject, const TArray<int32>& ForceFeedbackLevels);
/**
* Create a new Force-Feedback Command, with levels for each finger.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Force Feedback Command", UFUNCTION(BlueprintCallable, DisplayName="Make Force Feedback Command",
Category="SenseGlove | Core | Haptics | Force Feedback Command", Category="SenseGlove | Core | Haptics | Force Feedback Command",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGForceFeedbackCommand* MakeForceFeedbackCommand_T_I_M_R_P( static USGForceFeedbackCommand* MakeForceFeedbackCommand_T_I_M_R_P(
UObject* WorldContextObject, int32 Thumb, int32 Index, int32 Middle, int32 Ring, int32 Pinky); UObject* WorldContextObject, int32 Thumb, int32 Index, int32 Middle, int32 Ring, int32 Pinky);
/**
* Create a new Force-Feedback command, with only one finger being activated.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Force Feedback Command", UFUNCTION(BlueprintCallable, DisplayName="Make Force Feedback Command",
Category="SenseGlove | Core | Haptics | Force Feedback Command", Category="SenseGlove | Core | Haptics | Force Feedback Command",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGForceFeedbackCommand* MakeForceFeedbackCommand_F_BL( static USGForceFeedbackCommand* MakeForceFeedbackCommand_F_BL(
UObject* WorldContextObject, ESGFinger Finger, int32 BuzzLevel); UObject* WorldContextObject, ESGFinger Finger, int32 BuzzLevel);
/**
* A command that turns off all force feedback on the Sense Glove.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Force Feedback Command", UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Force Feedback Command",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGForceFeedbackCommand* Off(UObject* WorldContextObject); static USGForceFeedbackCommand* Off(UObject* WorldContextObject);
/**
* Copy this ForceFeedback Command into a new object.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Force Feedback Command", UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Force Feedback Command",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGForceFeedbackCommand* Copy(UObject* WorldContextObject, static USGForceFeedbackCommand* Copy(UObject* WorldContextObject,
const USGForceFeedbackCommand* ForceFeedbackCommand); const USGForceFeedbackCommand* ForceFeedbackCommand);
/**
* Merge this finger command with another, taking the maximum value between the two.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Force Feedback Command", UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Force Feedback Command",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGForceFeedbackCommand* Merge(UObject* WorldContextObject, static USGForceFeedbackCommand* Merge(UObject* WorldContextObject,
const USGForceFeedbackCommand* A, const USGForceFeedbackCommand* B); const USGForceFeedbackCommand* A, const USGForceFeedbackCommand* B);
}; };
@@ -29,7 +29,8 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * Contains interpolation sets for all hand joint movements that can be
* calculated using the Sense Glove.
*/ */
@@ -44,109 +45,175 @@
class USGHandInterpolator; class USGHandInterpolator;
/**
* Contains interpolation sets of all joint movements that can be calculated into a HandPose.
*/
UCLASS(meta=(ScriptName = "SesneGloveHandInterpolatorKismetLibrary")) UCLASS(meta=(ScriptName = "SesneGloveHandInterpolatorKismetLibrary"))
class SENSEGLOVECOREKISMET_API USGHandInterpolatorKismetLibrary final : public USGBlueprintFunctionLibrary class SENSEGLOVECOREKISMET_API USGHandInterpolatorKismetLibrary final : public USGBlueprintFunctionLibrary
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
/**
* Basic Constructor.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Hand Interpolator", UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Hand Interpolator",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGHandInterpolator* MakeHandInterpolator(UObject* WorldContextObject); static USGHandInterpolator* MakeHandInterpolator(UObject* WorldContextObject);
/**
* Create a new basic HandInterpolator without a starting rotation.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Hand Interpolator", UFUNCTION(BlueprintCallable, DisplayName="Make Hand Interpolator",
Category="SenseGlove | Core | Kinematics | Hand Interpolator", meta=(WorldContext="WorldContextObject")) Category="SenseGlove | Core | Kinematics | Hand Interpolator", meta=(WorldContext="WorldContextObject"))
static USGHandInterpolator* MakeHandInterpolator_JI( static USGHandInterpolator* MakeHandInterpolator_JI(
UObject* WorldContextObject, UObject* WorldContextObject,
const TArray<FSGInterpolationSetArray>& JointInterpolations); const TArray<FSGInterpolationSetArray>& JointInterpolations);
/**
* Create a new basic HandInterpolator with a starting rotation.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Hand Interpolator", UFUNCTION(BlueprintCallable, DisplayName="Make Hand Interpolator",
Category="SenseGlove | Core | Kinematics | Hand Interpolator", meta=(WorldContext="WorldContextObject")) Category="SenseGlove | Core | Kinematics | Hand Interpolator", meta=(WorldContext="WorldContextObject"))
static USGHandInterpolator* MakeHandInterpolator_JI_FQuat_CSR( static USGHandInterpolator* MakeHandInterpolator_JI_FQuat_CSR(
UObject* WorldContextObject, UObject* WorldContextObject,
const TArray<FSGInterpolationSetArray>& JointInterpolations, const FQuat& CmcStartRotation); const TArray<FSGInterpolationSetArray>& JointInterpolations, const FQuat& CmcStartRotation);
/**
* Create a new basic HandInterpolator with a starting rotation.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Hand Interpolator", UFUNCTION(BlueprintCallable, DisplayName="Make Hand Interpolator",
Category="SenseGlove | Core | Kinematics | Hand Interpolator", meta=(WorldContext="WorldContextObject")) Category="SenseGlove | Core | Kinematics | Hand Interpolator", meta=(WorldContext="WorldContextObject"))
static USGHandInterpolator* MakeHandInterpolator_JI_FRotator_CSR( static USGHandInterpolator* MakeHandInterpolator_JI_FRotator_CSR(
UObject* WorldContextObject, UObject* WorldContextObject,
const TArray<FSGInterpolationSetArray>& JointInterpolations, const FRotator& CmcStartRotation); const TArray<FSGInterpolationSetArray>& JointInterpolations, const FRotator& CmcStartRotation);
/**
* Create a default instance of a left- or right handed interpolator.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Hand Interpolator", UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Hand Interpolator",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGHandInterpolator* Default(UObject* WorldContextObject, bool bRightHanded); static USGHandInterpolator* Default(UObject* WorldContextObject, bool bRightHanded);
/**
* Convert a serialized HandInterpolator back into a class representation.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Hand Interpolator", UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Hand Interpolator",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGHandInterpolator* Deserialize(UObject* WorldContextObject, const FString& SerializedString); static USGHandInterpolator* Deserialize(UObject* WorldContextObject, const FString& SerializedString);
/**
* Calculate all angles of a specific finger based on an Interpolator and input angles.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Hand Interpolator") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Hand Interpolator")
static TArray<FVector> InterpolateFingerAngles(ESGFinger Finger, const USGHandInterpolator* Interpolator, static TArray<FVector> InterpolateFingerAngles(ESGFinger Finger, const USGHandInterpolator* Interpolator,
const FVector& TotalGloveAngles); const FVector& TotalGloveAngles);
/**
* Calculate all angles of the Thumb based on an Interpolator and input angles.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Hand Interpolator") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Hand Interpolator")
static TArray<FVector> InterpolateThumbAngles(const USGHandInterpolator* Interpolator, static TArray<FVector> InterpolateThumbAngles(const USGHandInterpolator* Interpolator,
const FVector& TotalGloveAngles); const FVector& TotalGloveAngles);
/**
* Calculate all hand angles based on an interpolator and total xyz angles.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Hand Interpolator") UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Hand Interpolator")
static TArray<FSGVectorArray> InterpolateHandAngles(const USGHandInterpolator* Interpolator, static TArray<FSGVectorArray> InterpolateHandAngles(const USGHandInterpolator* Interpolator,
const TArray<FVector>& TotalAngles); const TArray<FVector>& TotalAngles);
/**
* Interpolation sets for each finger. First index indicates which finger, Second index indicates the joint movement.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Hand Interpolator", UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Hand Interpolator",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
TArray<FSGInterpolationSetArray> GetJointInterpolations( TArray<FSGInterpolationSetArray> GetJointInterpolations(
UObject* WorldContextObject, const USGHandInterpolator* HandInterpolator) const; UObject* WorldContextObject, const USGHandInterpolator* HandInterpolator) const;
/**
* Starting rotation of the thumb cmc joint.
*/
UFUNCTION(BlueprintPure, DisplayName="Get Cmc Start Rotation", UFUNCTION(BlueprintPure, DisplayName="Get Cmc Start Rotation",
Category="SenseGlove | Core | Kinematics | Hand Interpolator") Category="SenseGlove | Core | Kinematics | Hand Interpolator")
FQuat GetCmcStartRotation_FQuat(const USGHandInterpolator* HandInterpolator) const; FQuat GetCmcStartRotation_FQuat(const USGHandInterpolator* HandInterpolator) const;
/**
* Starting rotation of the thumb cmc joint.
*/
UFUNCTION(BlueprintPure, DisplayName="Get Cmc Start Rotation", UFUNCTION(BlueprintPure, DisplayName="Get Cmc Start Rotation",
Category="SenseGlove | Core | Kinematics | Hand Interpolator") Category="SenseGlove | Core | Kinematics | Hand Interpolator")
FRotator GetCmcStartRotation_FRotator(const USGHandInterpolator* HandInterpolator) const; FRotator GetCmcStartRotation_FRotator(const USGHandInterpolator* HandInterpolator) const;
/**
* Calculate any finger's movement rotation, using an input value.
*/
UFUNCTION(BlueprintPure, DisplayName="CalculateAngle", UFUNCTION(BlueprintPure, DisplayName="CalculateAngle",
Category="SenseGlove | Core | Kinematics | Hand Interpolator") Category="SenseGlove | Core | Kinematics | Hand Interpolator")
static float CalculateAngle_F_int32_M_V(const USGHandInterpolator* HandInterpolator, static float CalculateAngle_F_int32_M_V(const USGHandInterpolator* HandInterpolator,
ESGFinger Finger, int32 Movement, float Value); ESGFinger Finger, int32 Movement, float Value);
/**
* Calculate a finger movement's rotation, using an input value.
*/
UFUNCTION(BlueprintPure, DisplayName="CalculateAngle", UFUNCTION(BlueprintPure, DisplayName="CalculateAngle",
Category="SenseGlove | Core | Kinematics | Hand Interpolator") Category="SenseGlove | Core | Kinematics | Hand Interpolator")
static float CalculateAngle_F_ESGFingerMovement_M_V(const USGHandInterpolator* HandInterpolator, static float CalculateAngle_F_ESGFingerMovement_M_V(const USGHandInterpolator* HandInterpolator,
ESGFinger Finger, ESGFingerMovement Movement, float Value); ESGFinger Finger, ESGFingerMovement Movement, float Value);
/**
* Calculate a thumb movement's rotation, using an input value.
*/
UFUNCTION(BlueprintPure, DisplayName="CalculateAngle", UFUNCTION(BlueprintPure, DisplayName="CalculateAngle",
Category="SenseGlove | Core | Kinematics | Hand Interpolator") Category="SenseGlove | Core | Kinematics | Hand Interpolator")
static float CalculateAngle_F_ESGThumbMovement_M_V(const USGHandInterpolator* HandInterpolator, static float CalculateAngle_F_ESGThumbMovement_M_V(const USGHandInterpolator* HandInterpolator,
ESGFinger Finger, ESGThumbMovement Movement, float Value); ESGFinger Finger, ESGThumbMovement Movement, float Value);
/**
* Updates a particular joint movement interpolation, without changing its limits.
*/
UFUNCTION(BlueprintCallable, DisplayName="SetInterpolation", UFUNCTION(BlueprintCallable, DisplayName="SetInterpolation",
Category="SenseGlove | Core | Kinematics | Hand Interpolator") Category="SenseGlove | Core | Kinematics | Hand Interpolator")
static void SetInterpolation_int32_F_int32_M_IA0_IA1_AA0_AA1( static void SetInterpolation_int32_F_int32_M_IA0_IA1_AA0_AA1(
UPARAM(ref) USGHandInterpolator* HandInterpolator, int32 Finger, int32 Movement, UPARAM(ref) USGHandInterpolator* HandInterpolator, int32 Finger, int32 Movement,
float InputAt0, float InputAt1, float AngleAt0, float AngleAt1); float InputAt0, float InputAt1, float AngleAt0, float AngleAt1);
/**
* Updates a particular joint movement interpolation, without changing its limits.
*/
UFUNCTION(BlueprintCallable, DisplayName="SetInterpolation", UFUNCTION(BlueprintCallable, DisplayName="SetInterpolation",
Category="SenseGlove | Core | Kinematics | Hand Interpolator") Category="SenseGlove | Core | Kinematics | Hand Interpolator")
static void SetInterpolation_ESGFinger_F_ESGFingerMovement_M_IA0_IA1_AA0_AA1( static void SetInterpolation_ESGFinger_F_ESGFingerMovement_M_IA0_IA1_AA0_AA1(
UPARAM(ref) USGHandInterpolator* HandInterpolator, ESGFinger Finger, ESGFingerMovement Movement, UPARAM(ref) USGHandInterpolator* HandInterpolator, ESGFinger Finger, ESGFingerMovement Movement,
float InputAt0, float InputAt1, float AngleAt0, float AngleAt1); float InputAt0, float InputAt1, float AngleAt0, float AngleAt1);
/**
* Updates a particular joint movement interpolation, without changing its limits.
*/
UFUNCTION(BlueprintCallable, DisplayName="SetInterpolation", UFUNCTION(BlueprintCallable, DisplayName="SetInterpolation",
Category="SenseGlove | Core | Kinematics | Hand Interpolator") Category="SenseGlove | Core | Kinematics | Hand Interpolator")
static void SetInterpolation_M_IA0_IA1_AA0_AA1( static void SetInterpolation_M_IA0_IA1_AA0_AA1(
UPARAM(ref) USGHandInterpolator* HandInterpolator, ESGThumbMovement Movement, UPARAM(ref) USGHandInterpolator* HandInterpolator, ESGThumbMovement Movement,
float InputAt0, float InputAt1, float AngleAt0, float AngleAt1); float InputAt0, float InputAt1, float AngleAt0, float AngleAt1);
/**
* Returns an interpolationSet
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Hand Interpolator", UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Hand Interpolator",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGInterpolationSet* GetInterpolation( static USGInterpolationSet* GetInterpolation(
UObject* WorldContextObject, UObject* WorldContextObject,
const USGHandInterpolator* HandInterpolator, int32 Finger, int32 Movement); const USGHandInterpolator* HandInterpolator, int32 Finger, int32 Movement);
/**
* Check if this handInterpolator matches another.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Hand Interpolator") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Hand Interpolator")
static bool Equals(const USGHandInterpolator* A, const USGHandInterpolator* B); static bool Equals(const USGHandInterpolator* A, const USGHandInterpolator* B);
/**
* Serialize this HandInterpolator into a string representation.
*/
UFUNCTION(BlueprintPure, DisplayName="Serialize", Category="SenseGlove | Core | Kinematics | Hand Interpolator") UFUNCTION(BlueprintPure, DisplayName="Serialize", Category="SenseGlove | Core | Kinematics | Hand Interpolator")
static FString SGSerialize(const USGHandInterpolator* HandInterpolator); static FString SGSerialize(const USGHandInterpolator* HandInterpolator);
}; };
@@ -29,7 +29,8 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * Data class containing all variables to draw or analyze a virtual hand
* in different formats.
*/ */
@@ -46,15 +47,24 @@
class USGBasicHandModel; class USGBasicHandModel;
class USGHandPose; class USGHandPose;
/**
* Contains all variables required to draw or analyze a virtual hand.
*/
UCLASS(meta=(ScriptName = "SesneGloveHandPoseKismetLibrary")) UCLASS(meta=(ScriptName = "SesneGloveHandPoseKismetLibrary"))
class SENSEGLOVECOREKISMET_API USGHandPoseKismetLibrary final : public USGBlueprintFunctionLibrary class SENSEGLOVECOREKISMET_API USGHandPoseKismetLibrary final : public USGBlueprintFunctionLibrary
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
/**
* Default Constructor.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Hand Pose", meta=(WorldContext="WorldContextObject")) UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Hand Pose", meta=(WorldContext="WorldContextObject"))
static USGHandPose* MakeHandPose(UObject* WorldContextObject); static USGHandPose* MakeHandPose(UObject* WorldContextObject);
/**
* Create a new instance of HandPose.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Hand Pose", Category="SenseGlove | Core | Hand Pose", UFUNCTION(BlueprintCallable, DisplayName="Make Hand Pose", Category="SenseGlove | Core | Hand Pose",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGHandPose* MakeHandPose_bRH_JP_FSGQuatArray_JR_HA( static USGHandPose* MakeHandPose_bRH_JP_FSGQuatArray_JR_HA(
@@ -62,6 +72,9 @@ public:
bool bRightHanded, const TArray<FSGVectorArray>& JointPositions, const TArray<FSGQuatArray>& JointRotations, bool bRightHanded, const TArray<FSGVectorArray>& JointPositions, const TArray<FSGQuatArray>& JointRotations,
const TArray<FSGVectorArray>& HandAngles); const TArray<FSGVectorArray>& HandAngles);
/**
* Create a new instance of HandPose.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Hand Pose", Category="SenseGlove | Core | Hand Pose", UFUNCTION(BlueprintCallable, DisplayName="Make Hand Pose", Category="SenseGlove | Core | Hand Pose",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGHandPose* MakeHandPose_bRH_JP_FSGRotatorArray_JR_HA( static USGHandPose* MakeHandPose_bRH_JP_FSGRotatorArray_JR_HA(
@@ -69,83 +82,150 @@ public:
bool bRightHanded, const TArray<FSGVectorArray>& JointPositions, const TArray<FSGRotatorArray>& JointRotations, bool bRightHanded, const TArray<FSGVectorArray>& JointPositions, const TArray<FSGRotatorArray>& JointRotations,
const TArray<FSGVectorArray>& HandAngles); const TArray<FSGVectorArray>& HandAngles);
/**
* Deserialize a HandPose back into usable values.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Hand Pose", meta=(WorldContext="WorldContextObject")) UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Hand Pose", meta=(WorldContext="WorldContextObject"))
static USGHandPose* Deserialize(UObject* WorldContextObject, const FString& SerializedString); static USGHandPose* Deserialize(UObject* WorldContextObject, const FString& SerializedString);
/**
* Generate a HandPose based on articulation angles (handAngles).
*/
UFUNCTION(BlueprintCallable, DisplayName="From Hand Angles", Category="SenseGlove | Core | Hand Pose", UFUNCTION(BlueprintCallable, DisplayName="From Hand Angles", Category="SenseGlove | Core | Hand Pose",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGHandPose* FromHandAngles_HA_bRH_HD( static USGHandPose* FromHandAngles_HA_bRH_HD(
UObject* WorldContextObject, UObject* WorldContextObject,
const TArray<FSGVectorArray>& HandAngles, bool bRightHanded, const USGBasicHandModel* HandDimensions); const TArray<FSGVectorArray>& HandAngles, bool bRightHanded, const USGBasicHandModel* HandDimensions);
/**
* Generate a HandPose based on articulation angles (handAngles), with a default HandModel.
*/
UFUNCTION(BlueprintCallable, DisplayName="From Hand Angles", Category="SenseGlove | Core | Hand Pose", UFUNCTION(BlueprintCallable, DisplayName="From Hand Angles", Category="SenseGlove | Core | Hand Pose",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGHandPose* FromHandAngles_HA_bRH(UObject* WorldContextObject, static USGHandPose* FromHandAngles_HA_bRH(UObject* WorldContextObject,
const TArray<FSGVectorArray>& HandAngles, bool bRightHanded); const TArray<FSGVectorArray>& HandAngles, bool bRightHanded);
/**
* Create a new instance of a left or right handed Pose that is "idle"; in a neutral position.
*/
UFUNCTION(BlueprintCallable, DisplayName="Default Idle", Category="SenseGlove | Core | Hand Pose", UFUNCTION(BlueprintCallable, DisplayName="Default Idle", Category="SenseGlove | Core | Hand Pose",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGHandPose* DefaultIdle_bRH_HD(UObject* WorldContextObject, static USGHandPose* DefaultIdle_bRH_HD(UObject* WorldContextObject,
bool bRightHanded, const USGBasicHandModel* HandDimensions); bool bRightHanded, const USGBasicHandModel* HandDimensions);
/**
* Create a new instance of a left or right handed Pose that is "idle"; in a neutral position.
*/
UFUNCTION(BlueprintCallable, DisplayName="Default Idle", Category="SenseGlove | Core | Hand Pose", UFUNCTION(BlueprintCallable, DisplayName="Default Idle", Category="SenseGlove | Core | Hand Pose",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGHandPose* DefaultIdle_bRH(UObject* WorldContextObject, bool bRightHanded); static USGHandPose* DefaultIdle_bRH(UObject* WorldContextObject, bool bRightHanded);
/**
* Generates a HandPose representing an 'open hand', used in calibration to determine finger extension.
*/
UFUNCTION(BlueprintCallable, DisplayName="Flat Hand", Category="SenseGlove | Core | Hand Pose", UFUNCTION(BlueprintCallable, DisplayName="Flat Hand", Category="SenseGlove | Core | Hand Pose",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGHandPose* FlatHand_bRH_HD(UObject* WorldContextObject, static USGHandPose* FlatHand_bRH_HD(UObject* WorldContextObject,
bool bRightHanded, const USGBasicHandModel* HandDimensions); bool bRightHanded, const USGBasicHandModel* HandDimensions);
/**
* Generates a HandPose representing an 'open hand', used in calibration to determine finger extension.
*/
UFUNCTION(BlueprintCallable, DisplayName="Flat Hand", Category="SenseGlove | Core | Hand Pose", UFUNCTION(BlueprintCallable, DisplayName="Flat Hand", Category="SenseGlove | Core | Hand Pose",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGHandPose* FlatHand_bRH(UObject* WorldContextObject, bool bRightHanded); static USGHandPose* FlatHand_bRH(UObject* WorldContextObject, bool bRightHanded);
/**
* Generates a HandPose representing a 'thumbs up', used in calibration to determine finger flexion, thumb extension and adduction.
*/
UFUNCTION(BlueprintCallable, DisplayName="Thumbs Up", Category="SenseGlove | Core | Hand Pose", UFUNCTION(BlueprintCallable, DisplayName="Thumbs Up", Category="SenseGlove | Core | Hand Pose",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGHandPose* ThumbsUp_bRH_HD(UObject* WorldContextObject, bool bRightHanded, static USGHandPose* ThumbsUp_bRH_HD(UObject* WorldContextObject, bool bRightHanded,
const USGBasicHandModel* HandDimensions); const USGBasicHandModel* HandDimensions);
/**
* Generates a HandPose representing a 'thumbs up', used in calibration to determine finger flexion, thumb extension and adduction.
*/
UFUNCTION(BlueprintCallable, DisplayName="Thumbs Up", Category="SenseGlove | Core | Hand Pose", UFUNCTION(BlueprintCallable, DisplayName="Thumbs Up", Category="SenseGlove | Core | Hand Pose",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGHandPose* ThumbsUp_bRH(UObject* WorldContextObject, bool bRightHanded); static USGHandPose* ThumbsUp_bRH(UObject* WorldContextObject, bool bRightHanded);
/**
* Generates a HandPose representing a 'fist', used in calibration to determine, thumb flexion and abduction.
*/
UFUNCTION(BlueprintCallable, DisplayName="Fist", Category="SenseGlove | Core | Hand Pose", UFUNCTION(BlueprintCallable, DisplayName="Fist", Category="SenseGlove | Core | Hand Pose",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGHandPose* Fist_bRH_HD(UObject* WorldContextObject, static USGHandPose* Fist_bRH_HD(UObject* WorldContextObject,
bool bRightHanded, const USGBasicHandModel* HandDimensions); bool bRightHanded, const USGBasicHandModel* HandDimensions);
/**
* Generates a HandPose representing a 'fist', used in calibration to determine, thumb flexion and abduction.
*/
UFUNCTION(BlueprintCallable, DisplayName="Fist", Category="SenseGlove | Core | Hand Pose", UFUNCTION(BlueprintCallable, DisplayName="Fist", Category="SenseGlove | Core | Hand Pose",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGHandPose* Fist_bRH(UObject* WorldContextObject, bool bRightHanded); static USGHandPose* Fist_bRH(UObject* WorldContextObject, bool bRightHanded);
/**
* Whether this HandPose was created to be a right- or left hand.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose")
static bool IsRight(const USGHandPose* HandPose); static bool IsRight(const USGHandPose* HandPose);
/**
* Positions of all hand joints relative to the Sense Glove origin. From thumb to pinky, proximal to distal.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose")
static TArray<FSGVectorArray> GetJointPositions(const USGHandPose* HandPose); static TArray<FSGVectorArray> GetJointPositions(const USGHandPose* HandPose);
/**
* Quaternion rotations of all hand joints. From thumb to pinky, proximal to distal.
*/
UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotations", Category="SenseGlove | Core | Hand Pose") UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotations", Category="SenseGlove | Core | Hand Pose")
static TArray<FSGQuatArray> GetJointRotationsQ(const USGHandPose* HandPose); static TArray<FSGQuatArray> GetJointRotationsQ(const USGHandPose* HandPose);
/**
* Rotations of all hand joints. From thumb to pinky, proximal to distal.
*/
UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotations", Category="SenseGlove | Core | Hand Pose") UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotations", Category="SenseGlove | Core | Hand Pose")
static TArray<FSGRotatorArray> GetJointRotations(const USGHandPose* HandPose); static TArray<FSGRotatorArray> GetJointRotations(const USGHandPose* HandPose);
/**
* Euler representations of all possible hand angles. From thumb to pinky, proximal to distal.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose")
static TArray<FSGVectorArray> GetHandAngles(const USGHandPose* HandPose); static TArray<FSGVectorArray> GetHandAngles(const USGHandPose* HandPose);
/**
* Returns true of these two hand poses are roughly equal.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose")
static bool Equals(const USGHandPose* A, const USGHandPose* B); static bool Equals(const USGHandPose* A, const USGHandPose* B);
/**
* Returns the total flexion of a specific finger as a value between 0 (fully extended) and 1 (fully flexed).
*
* @remarks Useful for animation or for detecting gestures.
*/
UFUNCTION(BlueprintPure, DisplayName="Get Normalized Flexion", Category="SenseGlove | Core | Hand Pose") UFUNCTION(BlueprintPure, DisplayName="Get Normalized Flexion", Category="SenseGlove | Core | Hand Pose")
static float GetNormalizedFlexion_F_bC01(const USGHandPose* HandPose, ESGFinger Finger, bool bClamp01 = true); static float GetNormalizedFlexion_F_bC01(const USGHandPose* HandPose, ESGFinger Finger, bool bClamp01 = true);
/**
* Returns the total flexion of a specific finger as a value between 0 (fully extended) and 1 (fully flexed).
*
* @remarks Useful for animation or for detecting gestures.
*/
UFUNCTION(BlueprintPure, DisplayName="Get Normalized Flexion", Category="SenseGlove | Core | Hand Pose") UFUNCTION(BlueprintPure, DisplayName="Get Normalized Flexion", Category="SenseGlove | Core | Hand Pose")
static TArray<float> GetNormalizedFlexion_bC01(const USGHandPose* HandPose, bool bClamp01 = true); static TArray<float> GetNormalizedFlexion_bC01(const USGHandPose* HandPose, bool bClamp01 = true);
/**
*
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose")
static FString ToString(const USGHandPose* HandPose, bool bShortFormat = false); static FString ToString(const USGHandPose* HandPose, bool bShortFormat = false);
/**
* Serialize this HandPose into a string representation.
*/
UFUNCTION(BlueprintPure, DisplayName="Serialize", Category="SenseGlove | Core | Hand Pose") UFUNCTION(BlueprintPure, DisplayName="Serialize", Category="SenseGlove | Core | Hand Pose")
static FString SGSerialize(const USGHandPose* HandPose); static FString SGSerialize(const USGHandPose* HandPose);
}; };