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