document some parts of the layer 3 and 4 api
This commit is contained in:
@@ -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;
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user