From 5226c91874664d3031124c1ceee1e957bdbac533 Mon Sep 17 00:00:00 2001 From: Mamadou Babaei Date: Fri, 18 Nov 2022 14:32:55 +0100 Subject: [PATCH] add more documentation --- .../Public/SGCore/SGHapticGloveHandProfiles.h | 50 +++++- .../SGCore/SGHapticGloveQuickCalibration.h | 60 +++++++- .../Public/SGCore/SGInterpolationSet.h | 80 +++++++++- .../Public/SGCore/SGJointKinematics.h | 21 ++- .../SenseGloveCore/Public/SGCore/SGLibrary.h | 2 +- .../Public/SGCore/SGNovaGlove.h | 142 +++++++++++++++++- .../Public/SGCore/SGNovaGloveCalibration.h | 11 +- .../Public/SGCore/SGNovaGloveSensorData.h | 64 +++++++- .../SenseGloveCore/Public/SGCore/SGSenseCom.h | 23 ++- .../Public/SGCore/SGSenseGlove.h | 8 +- .../Public/SGCore/SGSenseGloveHandProfile.h | 53 ++++++- .../Public/SGCore/SGSenseGloveInfo.h | 109 +++++++++++++- .../Public/SGCore/SGSenseGlovePose.h | 88 ++++++++++- .../Public/SGCore/SGSenseGloveSensorData.h | 76 +++++++++- .../Public/SGCore/SGSenseGloveVars.h | 45 +++++- .../Public/SGCore/SGSensorRange.h | 59 +++++++- .../Public/SGCore/SGThumperCommand.h | 38 ++++- .../Public/SGCore/SGTimedBuzzCommand.h | 65 +++++++- .../Public/SGCore/SGTimedThumpCommand.h | 58 ++++++- .../SenseGloveCore/Public/SGCore/SGTracking.h | 136 ++++++++++++++++- .../SGHapticGloveHandProfilesKismetLibrary.h | 50 +++++- ...HapticGloveQuickCalibrationKismetLibrary.h | 53 ++++++- .../SGInterpolationSetKismetLibrary.h | 71 ++++++++- .../SGJointKinematicsKismetLibrary.h | 21 ++- .../SGCoreKismet/SGLibraryKismetLibrary.h | 7 +- .../SGNovaGloveCalibrationKismetLibrary.h | 11 +- .../SGCoreKismet/SGNovaGloveKismetLibrary.h | 134 ++++++++++++++++- .../SGNovaGloveSensorDataKismetLibrary.h | 55 ++++++- .../SGCoreKismet/SGSenseComKismetLibrary.h | 23 ++- .../SGSenseGloveHandProfileKismetLibrary.h | 47 +++++- .../SGSenseGloveInfoKismetLibrary.h | 88 ++++++++++- .../SGSenseGlovePoseKismetLibrary.h | 67 ++++++++- .../SGSenseGloveSensorDataKismetLibrary.h | 55 ++++++- .../SGSenseGloveVarsKismetLibrary.h | 45 +++++- .../SGCoreKismet/SGSensorRangeKismetLibrary.h | 53 ++++++- .../SGThumperCommandKismetLibrary.h | 31 +++- .../SGTimedBuzzCommandKismetLibrary.h | 53 ++++++- .../SGTimedThumpCommandKismetLibrary.h | 47 +++++- .../SGCoreKismet/SGTrackingKismetLibrary.h | 136 ++++++++++++++++- 39 files changed, 2167 insertions(+), 68 deletions(-) diff --git a/Source/SenseGloveCore/Public/SGCore/SGHapticGloveHandProfiles.h b/Source/SenseGloveCore/Public/SGCore/SGHapticGloveHandProfiles.h index 5623bcde..af236885 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGHapticGloveHandProfiles.h +++ b/Source/SenseGloveCore/Public/SGCore/SGHapticGloveHandProfiles.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * An interface to get calibration to / from disk. */ @@ -44,37 +44,83 @@ class USGHapticGlove; +/** + * A glove developed by SenseGlove, that has hand tracking and/or haptic feedback functionality. + */ USTRUCT() struct SENSEGLOVECORE_API FSGHapticGloveHandProfiles { GENERATED_BODY() public: + /** + * Returns the directory where our HandProfiles are stored. + */ static FString GetProfileDirectory(); + /** + * Set the directory where our HandProfiles are stored. + */ static void SetProfileDirectory(const FString& Directory); + /** + * Access the latest Left Hand Profile from disk. + */ static void GetLeftHandProfile(UObject* Outer, USGHandProfile*& OutHandProfile); + /** + * Sets the newest Left Hand Profile - also stores it on disk. + */ static void SetLeftHandProfile(const USGHandProfile* HandProfile); + /** + * Access the latest Right Hand Profile from disk. + */ static void GetRightHandProfile(UObject* Outer, USGHandProfile*& OutHandProfile); + /** + * Sets the newest Right Hand Profile - also stores it on disk. + */ static void SetRightHandProfile(const USGHandProfile* HandProfile); + /** + * Retrieve a left- or right handed profile. + */ static void GetProfile(UObject* Outer, bool bRightHanded, USGHandProfile*& OutHandProfile); + /** + * Store a profile in the global variables and on disk. The profile determines if this is a left or right hand. + */ static void SetProfile(const USGHandProfile* HandProfile); + /** + * Store a profile in the global variables and on disk. You determine if this is a left or right hand. + */ static void SetProfile(const USGHandProfile* HandProfile, bool bRightHanded); + /** + * Restore both profiles back to their default values. + */ static void RestoreDefaults(); + /** + * Restore the left- or right hand profiles back to their default values. + */ static void RestoreDefaults(bool bRightHanded); + /** + * Load the latest profiles from disk. Automatically called when you first try to access a profile. + * Exposed so you can force-reload profiles. + */ static void TryLoadingFromDisk(); + /** + * Stores the last sensor range of a glove. + */ static bool SaveLastRange(const USGSensorRange* CurrentRange, const USGHapticGlove* ForGlove); + /** + * Loads the last sensor range of a glove. + */ static bool LoadLastRange(UObject* Outer, const USGHapticGlove* ForGlove, USGSensorRange*& OutLastRange); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCore/Public/SGCore/SGHapticGloveQuickCalibration.h b/Source/SenseGloveCore/Public/SGCore/SGHapticGloveQuickCalibration.h index 1c6a8f26..5025fd52 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGHapticGloveQuickCalibration.h +++ b/Source/SenseGloveCore/Public/SGCore/SGHapticGloveQuickCalibration.h @@ -45,6 +45,9 @@ class FSGHapticGloveQuickCalibrationImpl; +/** + * + */ UCLASS(BlueprintType) class SENSEGLOVECORE_API USGHapticGloveQuickCalibration final : public USGHapticGloveCalibrationSequence { @@ -57,14 +60,24 @@ public: static USGHapticGloveQuickCalibration* NewHapticGloveQuickCalibration( UObject* Outer, TSharedRef HapticGloveQuickCalibration); +public: + /** + * + */ static USGHapticGloveQuickCalibration* NewHapticGloveQuickCalibration(UObject* Outer); + /** + * Create a new instance of a QuickCalibration for Haptic Gloves. + */ static USGHapticGloveQuickCalibration* NewHapticGloveQuickCalibration( UObject* Outer, const USGHapticGlove* GloveToCalibrate, float AutoEndTimeout = GetDefaultAutoEndTimeout()); public: + /** + * Default time in seconds, to end this sequence. 15 seconds is very quick for some people. + */ static float GetDefaultAutoEndTimeout(); private: @@ -79,8 +92,14 @@ private: FImplDeleter PimplDeleter; public: + /** + * + */ USGHapticGloveQuickCalibration(); + /** + * Create a new instance of a QuickCalibration for Haptic Gloves. + */ explicit USGHapticGloveQuickCalibration(const USGHapticGlove* GloveToCalibrate, float AutoEndTimeout = GetDefaultAutoEndTimeout()); @@ -121,31 +140,70 @@ protected: virtual void SyncUProperties() override; public: + /** + * Time, in seconds, after which this sequence stops gathering data. Based on the deltaSeconds variable passed in the Update() function. + */ float GetAutoEndTimeout() const; + /** + * When compiling the final profile, we use a Weighted Moving Average filter with this period to filer out some outliers. + */ int32 GetSmoothingSamples() const; + /** + * The min/max values recorded during this calibration sequence. + */ USGSensorRange* GetSensorRange(UObject* Outer) const; + /** + * A temporary profile to apply the sensorRange to. Used to generate a 'preview' HandPose. + */ USGHandProfile* GetTemporaryProfile(UObject* Outer) const; + /** + * Determines if the user has moved enough so that we can animate. + */ bool CanAnimate() const; public: + /** + * This sequence autocompletes after its autoEndTime has elapsed. + */ bool AutoCompleted() const; public: + /** + * Resets data points, min/max ranges and profile. + */ void Reset(); + /** + * Update this calibration sequence with new data. We use deltaSeconds to check for things like stability. + */ void Update(float DeltaSeconds); + /** + * Add a new datapoint to this sequence's collection. Updates the range and profile used to generate a preview. + */ void AddDataPoint(const TArray& CalibrationData); + /** + * After we confirm the current step, we're basically done. + */ void ConfirmCurrentStep(); + /** + * Compile a sensor range from the data points collected while the sequence was running. Smoothed by a Moving Average Filter. + */ bool CompileRange(UObject* Outer, USGSensorRange*& OutSensorRange) const; + /** + * Returns a 'preview' of what a HandPose with this sequence's current settings would look like. + */ bool GetHandPose(UObject* Outer, bool bRightHanded, USGHandPose*& OutCurrentHandPose) const; + /** + * Retrieve instructions on what to do during the current step. + */ FString GetCurrentInstruction(const FString& NextStepKey = FString{""}) const; -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCore/Public/SGCore/SGInterpolationSet.h b/Source/SenseGloveCore/Public/SGCore/SGInterpolationSet.h index 9f2b0cdc..016804e3 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGInterpolationSet.h +++ b/Source/SenseGloveCore/Public/SGCore/SGInterpolationSet.h @@ -29,7 +29,8 @@ * * @section DESCRIPTION * - * + * Data class containing all variables to map an input value from one range to + * another. */ @@ -47,6 +48,9 @@ class FSGInterpolationSetImpl; +/** + * Set of variables to map a value from one range to the next. + */ UCLASS(BlueprintType) class SENSEGLOVECORE_API USGInterpolationSet final : public UObject { @@ -57,14 +61,26 @@ public: UObject* Outer, const FSGInterpolationSetImpl& InterpolationSetImpl); public: + /** + * Creates a basic interpolation set, without limits. + */ static USGInterpolationSet* NewInterpolationSet(UObject* Outer); + /** + * Create a new interpolation set without limits. + */ static USGInterpolationSet* NewInterpolationSet(UObject* Outer, float From1, float From2, float To1, float To2); + /** + * Create a new interpolation set with limits. + */ static USGInterpolationSet* NewInterpolationSet( UObject* Outer, float From1, float From2, float To1, float To2, float Min, float Max); public: + /** + * Convert a string notation of an InterpolationSet into a new class instance. + */ static USGInterpolationSet* Deserialize(UObject* Outer, const FString& SerializedString); private: @@ -79,10 +95,19 @@ private: FImplDeleter PimplDeleter; public: + /** + * Creates a basic interpolation set, without limits. + */ USGInterpolationSet(); + /** + * Create a new interpolation set without limits. + */ USGInterpolationSet(float From1, float From2, float To1, float To2); + /** + * Create a new interpolation set with limits. + */ USGInterpolationSet(float From1, float From2, float To1, float To2, float Min, float Max); public: @@ -110,40 +135,91 @@ public: const FSGInterpolationSetImpl& ToInterpolationSetImpl() const; public: + /** + * First value of input range. + */ float GetX0() const; + /** + * + */ void SetX0(float X0); + /** + * Second value of input range. + */ float GetX1() const; + /** + * + */ void SetX1(float X1); + /** + * First value of output range. + */ float GetY0() const; + /** + * + */ void SetY0(float Y0); + /** + * Second value of output range. + */ float GetY1() const; + /** + * + */ void SetY1(float Y1); + /** + * Minimum range of the output value. + */ float GetMin() const; + /** + * + */ void SetMin(float Min); + /** + * Maximum range of the output value. + */ float GetMax() const; + /** + * + */ void SetMax(float Max); public: + /** + * Calculate an output value in range [x0...x1] to [y0..y1] + */ float Get(float Value, bool bLimit, bool bNormalizeAngle = false) const; public: + /** + * Returns true if this InterpolationSet has the same values as another set. + */ bool Equals(const USGInterpolationSet* InterpolationSet) const; public: + /** + * + */ FString ToString() const; + /** + * + */ FString ToString(bool bLimits) const; + /** + * Convert this InterpolationSet into a string notation so it can be stored on disk. + */ FString SGSerialize() const; -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCore/Public/SGCore/SGJointKinematics.h b/Source/SenseGloveCore/Public/SGCore/SGJointKinematics.h index 2247fc46..a6e46fd6 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGJointKinematics.h +++ b/Source/SenseGloveCore/Public/SGCore/SGJointKinematics.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * Contains kinematic formulae and wrappers for Sense Glove mathematics. */ @@ -44,27 +44,44 @@ #include "SGJointKinematics.generated.h" +/** + * + */ USTRUCT() struct SENSEGLOVECORE_API FSGJointKinematics { GENERATED_BODY() public: + /** + * Perform forward Kinematics on a set of joints, defined by a start position- and rotation, + * joint angles and the lengths in between. Outputs the calculated positions and rotations. + */ static bool ForwardKinematics( const FVector& StartPosition, const FQuat& StartRotation, const TArray& JointLengths, const TArray& JointAngles, TArray& OutNewPositions, TArray& OutNewRotations); + /** + * Perform forward Kinematics on a set of joints, defined by a start position- and rotation, + * joint angles and the lengths in between. Outputs the calculated positions and rotations. + */ static bool ForwardKinematics( const FVector& StartPosition, const FRotator& StartRotation, const TArray& JointLengths, const TArray& JointAngles, TArray& OutNewPositions, TArray& OutNewRotations); + /** + * Calculate positions and rotations of a finger based on input angles and profile. + */ static bool ForwardKinematics( const USGBasicHandModel* Profile, ESGFinger Finger, const TArray& JointAngles, TArray& OutNewPositions, TArray& OutNewRotations); + /** + * Calculate positions and rotations of a finger based on input angles and profile. + */ static bool ForwardKinematics( const USGBasicHandModel* Profile, ESGFinger Finger, const TArray& JointAngles, TArray& OutNewPositions, TArray& OutNewRotations); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCore/Public/SGCore/SGLibrary.h b/Source/SenseGloveCore/Public/SGCore/SGLibrary.h index 21c6e9f4..9a1cf825 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGLibrary.h +++ b/Source/SenseGloveCore/Public/SGCore/SGLibrary.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * Information about the SGCore C++ Library. */ diff --git a/Source/SenseGloveCore/Public/SGCore/SGNovaGlove.h b/Source/SenseGloveCore/Public/SGCore/SGNovaGlove.h index 2e094482..c3aa1f5c 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGNovaGlove.h +++ b/Source/SenseGloveCore/Public/SGCore/SGNovaGlove.h @@ -29,7 +29,8 @@ * * @section DESCRIPTION * - * + * An interface for the "Nova" - a soft glove. + * Contains methods for Kinematics, Haptics and Serialization. */ @@ -55,6 +56,9 @@ class USGBuzzCommand; class USGForceFeedbackCommand; class USGThumperCommand; +/** + * A soft glove with Force- and Vibrotactile Feedback and limited tracking. + */ UCLASS(BlueprintType) class SENSEGLOVECORE_API USGNovaGlove final : public USGHapticGlove { @@ -66,59 +70,113 @@ public: static USGNovaGlove* NewNovaGlove(UObject* Outer, TSharedRef NovaGloveImpl); public: + /** + * + */ static USGNovaGlove* NewNovaGlove(UObject* Outer); + /** + * + */ static USGNovaGlove* NewNovaGlove(UObject* Outer, const USGNovaGloveInfo& DeviceInfo); public: + /** + * Byte indicating a new Nova haptic command. + */ static ANSICHAR GetHapticsByte(); + /** + * Minimum calibration value distance until we apply the range. + */ static FVector GetMinCalibrationRange(); public: + /** + * Calculate a Hand Pose based on a HandMode; sensor data from a Nova, and a UserProfile. + */ static USGHandPose* CalculateHandPose(UObject* Outer, const USGBasicHandModel* HandModel, const USGNovaGloveSensorData* NovaData, const USGNovaGloveHandProfile* Profile); public: + /** + * Deserializes a Nova from its ConstantsString. Returns a nullptr if unsuccessful. + */ static USGDevice* Parse(UObject* Outer, const FString& ConstantsString); + /** + * Retrieve all Nova's. + */ static TArray GetNovaGloves(UObject* Outer); + /** + * Retrieve the first connected Nova there is. + */ static bool GetNovaGlove(UObject* Outer, USGNovaGlove*& OutGlove); + /** + * Retrieve the first (connected) right or left handed Nova. + */ static bool GetNovaGlove(UObject* Outer, bool bRightHanded, USGNovaGlove*& OutGlove); public: + /** + * Convert a SenseGlove GlovePose into calibrationValues. + */ static TArray GetCalibrationValues(const USGNovaGloveSensorData* SensorData); + /** + * + */ static void CalibrateInterpolation(UObject* Outer, const TArray& MinValues, const TArray& MaxValues, USGNovaGloveHandProfile*& OutProfile); public: + /** + * Retrieve the location of the glove origin, based on a reference location without requiring an object reference. + */ static void CalculateGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, FVector& OutGlovePosition, FQuat& OutGloveRotation); + /** + * Retrieve the location of the glove origin, based on a reference location without requiring an object reference. + */ static void CalculateGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, FVector& OutGlovePosition, FRotator& OutGloveRotation); + /** + * Retrieve the location of the wrist, based on a reference location and default glove-hand offsets, without needing an object reference. + */ static void CalculateWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, FVector& OutWristPosition, FQuat& OutWristRotation); + /** + * Retrieve the location of the wrist, based on a reference location and default glove-hand offsets, without needing an object reference. + */ static void CalculateWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, FVector& OutWristPosition, FRotator& OutWristRotation); public: + /** + * Converts a thumper command into bytes that the Nova can understand. + */ static FString ToBytes(const USGThumperCommand* ThumperCommand); + /** + * Converts a force-feedback command into bytes that the Nova can understand. + */ static FString ToBytes(const USGForceFeedbackCommand* ForceFeedbackCommand); + /** + * Converts a buzz-motor command into bytes that the Nova can understand. + */ static FString ToBytes(const USGBuzzCommand* BuzzCommand); private: @@ -193,78 +251,156 @@ protected: virtual void SyncUProperties() override; public: + /** + * Return the DeviceType of this Nova. + */ virtual ESGDeviceType GetDeviceType() const override; + /** + * Returns this device's unique identifier. + */ virtual FString GetDeviceId() const override; + /** + * Access this device's hardware designation. + */ virtual FString GetHardwareVersion() const override; + /** + * Access this device's main firmware version. (ex: v3.2 -> 3). + */ virtual int32 GetFirmwareVersion() const override; + /** + * Access this device's sub-firmware version. (ex: v3.2 -> 2). + */ virtual int32 GetSubFirmwareVersion() const override; public: + /** + * Returns true if this device operates on a battery. + */ virtual bool HasBattery() const override; + /** + * Returns true if this device is currently charging. + */ virtual bool IsCharging() override; + /** + * Returns the device's battery level, as a value between 0 (empty) and 1 (full). + */ virtual bool GetBatteryLevel(float& OutBatteryLevel) override; public: + /** + * Get the latest Sensor Data from this Sense Glove. + */ bool GetSensorData(UObject* Outer, USGNovaGloveSensorData*& OutSensorData); + /** + * Retrieve Nova rotation. + */ virtual bool GetImuRotation(FQuat& OutImu) override; + /** + * Retrieve Nova rotation. + */ virtual bool GetImuRotation(FRotator& OutImu) override; /// HACK /// 'FSGNovaGlove::GetHandPose' hides overloaded virtual functions [-Werror,-Woverloaded-virtual] - /// tell the compiler we want both the GetHandPose from FSGHapticGlove and FSGNovaGlove + /// tell the compiler we want both the GetHandPose from USGHapticGlove and USGNovaGlove using USGHapticGlove::GetHandPose; + /** + * Retrieve a new hand pose using this glove, based on (calibrated) user data. + */ bool GetHandPose(UObject* Outer, const USGBasicHandModel* HandModel, const USGNovaGloveHandProfile* Profile, USGHandPose*& OutHandPose); + /** + * Retrieve a new hand pose using this glove, based on (calibrated) user data. + */ virtual bool GetHandPose(UObject* Outer, const USGBasicHandModel* HandGeometry, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose) override; + /** + * Calculate the HandPose of this Device, taking into account user values, but not hand geometry. + */ virtual bool GetHandPose(UObject* Outer, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose) override; public: + /** + * Send all available haptics to a Nova. + */ virtual void SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand, const USGBuzzCommand* BuzzCommand, const USGThumperCommand* ThumperCommand) override; + /** + * Send Haptic Commands to this Glove. + */ virtual void SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand) override; + /** + * Send Haptic Commands to this Glove. + */ virtual void SendHaptics(const USGBuzzCommand* BuzzCommand) override; + /** + * Send Haptic Commands to this Glove. + */ virtual void SendHaptics(const USGThumperCommand* ThumperCommand) override; public: + /** + * Retrieve calibration values of this glove, as an array of size 5, containing x (roll), y (flexion), z (abduction) values. + */ virtual bool GetCalibrationValues(TArray& OutValues) override; + /** + * Applies the calibration range of this Nova a HandProfile. + */ virtual void ApplyCalibration(UObject* Outer, USGHandProfile*& OutProfile) const override; + /** + * Applies the calibration range of this SenseGlove to a NovaGloveHandProfile. + */ void ApplyCalibration(UObject* Outer, USGNovaGloveHandProfile*& OutProfile) const; public: + /** + * Retrieve the location of the glove origin, based on a reference location. + */ virtual void GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, FVector& OutGlovePosition, FQuat& OutGloveRotation) const override; + /** + * Retrieve the location of the glove origin, based on a reference location. + */ virtual void GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, FVector& OutGlovePosition, FRotator& OutGloveRotation) const override; + /** + * Retrieve the location of the wrist, based on a reference location and default glove-hand offsets. + */ virtual void GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, FVector& OutWristPosition, FQuat& OutWristRotation) const override; + /** + * Retrieve the location of the wrist, based on a reference location and default glove-hand offsets. + */ virtual void GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, FVector& OutWristPosition, FRotator& OutWristRotation) const override; public: + /** + * Create a string representation of this device for reporting purposes. + */ virtual FString ToString() const override; -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCore/Public/SGCore/SGNovaGloveCalibration.h b/Source/SenseGloveCore/Public/SGCore/SGNovaGloveCalibration.h index a410a67d..a98ba1ba 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGNovaGloveCalibration.h +++ b/Source/SenseGloveCore/Public/SGCore/SGNovaGloveCalibration.h @@ -42,21 +42,30 @@ #include "SGNovaGloveCalibration.generated.h" +/** + * + */ USTRUCT() struct SENSEGLOVECORE_API FSGNovaGloveCalibration { GENERATED_BODY() public: + /** + * Apply a glove's default interpolation values to a profile, using the 'default' hand angles from calibration. + */ static void ApplyDefaultCalibrationInterpolationValues( const TArray& RetractedValues, const TArray& ExtendedValues, const USGNovaGloveHandProfile* Profile); + /** + * Apply a set of sensor-to-joint-angle interpolations to a nova profile. + */ static void ApplyInterpolationValues( const TArray& RetractedValues, const TArray& ExtendedValues, const TArray>& RetractedAngles, const TArray>& ExtendedAngles, const USGNovaGloveHandProfile* Profile); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCore/Public/SGCore/SGNovaGloveSensorData.h b/Source/SenseGloveCore/Public/SGCore/SGNovaGloveSensorData.h index d8fadd9f..dc8ba1c3 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGNovaGloveSensorData.h +++ b/Source/SenseGloveCore/Public/SGCore/SGNovaGloveSensorData.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * Nova SensorData, parsed from rae string representations. */ @@ -49,6 +49,9 @@ class FSGNovaGloveSensorDataImpl; +/** + * Sensor Data coming from a Nova, converted into useful values. + */ UCLASS(BlueprintType) class SENSEGLOVECORE_API USGNovaGloveSensorData final : public UObject { @@ -59,21 +62,39 @@ public: UObject* Outer, const FSGNovaGloveSensorDataImpl& NovaGloveSensorDataImpl); public: + /** + * Default constructor for NovaGloveSensorData. + */ static USGNovaGloveSensorData* NewNovaGloveSensorData(UObject* Outer); + /** + * Create a new instance of a NovaGloveSensorData. + */ static USGNovaGloveSensorData* NewNovaGloveSensorData( UObject* Outer, const TArray& Values, int32 ParsedValues, const FQuat& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging); + /** + * Create a new instance of a NovaGloveSensorData. + */ static USGNovaGloveSensorData* NewNovaGloveSensorData( UObject* Outer, const TArray& Values, int32 ParsedValues, const FRotator& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging); public: + /** + * Returns a NovaGloveSensorData without any values. + */ static USGNovaGloveSensorData* Empty(UObject* Outer); + /** + * Parse the bytes as they come in from the device into useable values. + */ static USGNovaGloveSensorData* Parse(UObject* Outer, const FString& RawData, const USGNovaGloveInfo* GloveInfo); + /** + * Convert this sensor data into ta string representation. + */ static USGNovaGloveSensorData* Deserialize(UObject* Outer, const FString& SerializedString); private: @@ -88,11 +109,20 @@ private: FImplDeleter PimplDeleter; public: + /** + * Default constructor for NovaGloveSensorData. + */ USGNovaGloveSensorData(); + /** + * Create a new instance of a NovaGloveSensorData. + */ USGNovaGloveSensorData(const TArray& Values, int32 ParsedValues, const FQuat& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging); + /** + * Create a new instance of a NovaGloveSensorData. + */ USGNovaGloveSensorData(const TArray& Values, int32 ParsedValues, const FRotator& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging); @@ -121,25 +151,55 @@ public: const FSGNovaGloveSensorDataImpl& ToNovaGloveSensorDataImpl() const; public: + /** + * Pronation/Supination, Flexion/Extension and Abduction/Adduction values for each finger. + */ TArray GetSensorValues() const; + /** + * Quaternion rotation relative to magnetic north. + */ FQuat GetImuRotationQ() const; + /** + * Rotation relative to magnetic north. + */ FRotator GetImuRotation() const; + /** + * The number of values that were parsed from the sensor string. + */ int32 GetParsedValues() const; + /** + * Whether the IMU values were all successfully parsed, or not. + */ bool IsImuParsed() const; + /** + * A value between 0..1 that represents the battery level of this Nova Glove (0 .. 100%). Returns -1 if the value wasn't received. + */ float GetBatteryLevel() const; + /** + * Returns true if this NovaGlove is connected to a power source + */ bool IsCharging() const; public: + /** + * Returns true if this sensor data contains the same values as another. + */ bool Equals(const USGNovaGloveSensorData* NovaGloveSensorData) const; public: + /** + * Create a readable string representation of this Sensor Data + */ FString ToString() const; + /** + * Convert this sensor data into a string so it can be stored on disk. + */ FString SGSerialize() const; -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCore/Public/SGCore/SGSenseCom.h b/Source/SenseGloveCore/Public/SGCore/SGSenseCom.h index abb691c7..bd0b88cb 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGSenseCom.h +++ b/Source/SenseGloveCore/Public/SGCore/SGSenseCom.h @@ -40,21 +40,42 @@ #include "SGSenseCom.generated.h" +/** + * + */ USTRUCT() struct SENSEGLOVECORE_API FSGSenseCom { GENERATED_BODY() public: + /** + * Registers current process as the latest SenseCom build. + */ static bool RegisterExe(); + /** + * Register a particular path as the SenseGlove executable location. + */ static bool RegisterExe(const FString& ExePath); + /** + * Retrieve the location of SenseGlove executable. + */ static bool GetExePath(FString& OutExePath); + /** + * Returns true if SenseCom scanning is active. + */ static bool ScanningActive(); + /** + * Returns the directory of the current process. + */ static bool GetCurrentExeDirectory(FString& OutDirectory); + /** + * Force-starts the SenseCom application if it is active on the system. + */ static bool StartupSenseCom(); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCore/Public/SGCore/SGSenseGlove.h b/Source/SenseGloveCore/Public/SGCore/SGSenseGlove.h index da24ff85..35668a82 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGSenseGlove.h +++ b/Source/SenseGloveCore/Public/SGCore/SGSenseGlove.h @@ -447,14 +447,14 @@ public: FVector& OutWristPosition, FQuat& OutWristRotation) const override; /** - * + * Retrieve the location of the wrist, based on a reference location and default glove-hand offsets. */ virtual void GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, FVector& OutWristPosition, FRotator& OutWristRotation) const override; /** - * + * Retrieve the location of the wrist, based on a reference location and default glove-hand offsets. */ void GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, @@ -463,7 +463,7 @@ public: FVector& OutWristPosition, FQuat& OutWristRotation) const; /** - * + * Retrieve the location of the wrist, based on a reference location and default glove-hand offsets. */ void GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, ESGPositionalTrackingHardware TrackingHardware, @@ -473,7 +473,7 @@ public: public: /** - * + * Create a string representation of this device for reporting purposes. */ virtual FString ToString() const override; }; diff --git a/Source/SenseGloveCore/Public/SGCore/SGSenseGloveHandProfile.h b/Source/SenseGloveCore/Public/SGCore/SGSenseGloveHandProfile.h index 3f102c2b..67ff0972 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGSenseGloveHandProfile.h +++ b/Source/SenseGloveCore/Public/SGCore/SGSenseGloveHandProfile.h @@ -29,7 +29,8 @@ * * @section DESCRIPTION * - * + * Input for Sense Glove kinematics to calculate a HandPose. + * Output of calibration algorithms. */ @@ -49,6 +50,9 @@ class FSGSenseGloveHandProfileImpl; +/** + * Contains everything a Sense Glove needs to calculate a HandPose. + */ UCLASS(BlueprintType) class SENSEGLOVECORE_API USGSenseGloveHandProfile final : public UObject { @@ -59,18 +63,33 @@ public: UObject* Outer, const FSGSenseGloveHandProfileImpl& SenseGloveHandProfileImpl); public: + /** + * The basic constructor. + */ static USGSenseGloveHandProfile* NewSenseGloveHandProfile(UObject* Outer); + /** + * Create a new Hand Profile for the Sense Glove. + */ static USGSenseGloveHandProfile* NewSenseGloveHandProfile( UObject* Outer, bool bRightHanded, const USGHandInterpolator* Interpolator, ESGThumbSolver ThumbSolver, ESGFingerSolver FingerSolver, const TArray& FingerThimbleOffset); public: + /** + * Retrieve a 'new' profile, for either a left or right hand. + */ static USGSenseGloveHandProfile* Default(UObject* Outer, bool bRightHanded); + /** + * Deserialize a HandProfile back into usable values. + */ static USGSenseGloveHandProfile* Deserialize(UObject* Outer, const FString& SerializedString); public: + /** + * Default offset from thimble to fingertip. + */ static FVector GetDefaultThimbleOffset(); private: @@ -85,8 +104,14 @@ private: FImplDeleter PimplDeleter; public: + /** + * The basic constructor. + */ USGSenseGloveHandProfile(); + /** + * Create a new Hand Profile for the Sense Glove. + */ USGSenseGloveHandProfile(bool bRightHanded, const USGHandInterpolator* Interpolator, ESGThumbSolver ThumbSolver, ESGFingerSolver FingerSolver, const TArray& FingerThimbleOffset); @@ -116,21 +141,45 @@ public: const FSGSenseGloveHandProfileImpl& ToSenseGloveHandProfileImpl() const; public: + /** + * Check whether this profile has been created for a right hand (true) or left hand (false). + */ bool IsRight() const; + /** + * Interpolation set to estimate joint angles. + */ USGHandInterpolator* GetInterpolationSet(UObject* Outer) const; + /** + * Solver property that determines _how_ HandPoses are calculated. + */ ESGThumbSolver GetThumbSolver() const; + /** + * Solver property that determines _how_ finger poses are calculated. + */ ESGFingerSolver GetFingerSolver() const; + /** + * Offset from thimble to fingertip, used for Inverse Kinematics. + */ TArray GetFingerThimbleOffset() const; public: + /** + * + */ bool Equals(const USGSenseGloveHandProfile* SenseGloveHandProfile) const; + /** + * Reset calibration on this profile. + */ void Reset(); public: + /** + * Serialize this HandProfile into a string representation. + */ FString SGSerialize() const; -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCore/Public/SGCore/SGSenseGloveInfo.h b/Source/SenseGloveCore/Public/SGCore/SGSenseGloveInfo.h index f8c08488..dac98080 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGSenseGloveInfo.h +++ b/Source/SenseGloveCore/Public/SGCore/SGSenseGloveInfo.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * Glove information taken from the Sense Glove. */ @@ -49,6 +49,9 @@ class FSGSenseGloveInfoImpl; +/** + * Glove Information taken from a SenseGlove. Contains everything from unique ID, firmware version, etc. + */ UCLASS(BlueprintType) class SENSEGLOVECORE_API USGSenseGloveInfo final : public UObject { @@ -59,8 +62,14 @@ public: UObject* Outer, const FSGSenseGloveInfoImpl& SenseGloveInfoImpl); public: + /** + * The default constructor. + */ static USGSenseGloveInfo* NewSenseGloveInfo(UObject* Outer); + /** + * Create a new Sense Glove device model. + */ static USGSenseGloveInfo* NewSenseGloveInfo( UObject* Outer, const FString& DeviceId, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, @@ -68,6 +77,9 @@ public: const TArray& StartPositions, const TArray& StartRotations, const TArray>& GloveLengths, const TArray& Functions); + /** + * Create a new Sense Glove device model. + */ static USGSenseGloveInfo* NewSenseGloveInfo( UObject* Outer, const FString& DeviceId, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, @@ -75,6 +87,9 @@ public: const TArray& StartPositions, const TArray& StartRotations, const TArray>& GloveLengths, const TArray& Functions); + /** + * Create a new Sense Glove device model. + */ static USGSenseGloveInfo* NewSenseGloveInfo( UObject* Outer, const FString& DeviceId, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, @@ -82,6 +97,9 @@ public: const TArray& StartPositions, const TArray& StartRotations, const TArray& GloveLengths, const TArray& Functions); + /** + * Create a new Sense Glove device model. + */ static USGSenseGloveInfo* NewSenseGloveInfo( UObject* Outer, const FString& DeviceId, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, @@ -90,9 +108,15 @@ public: const TArray& GloveLengths, const TArray& Functions); public: + /** + * Create an instance of the SGModel from its string representation. + */ static bool Parse(UObject* Outer, const FString& ConstantsString, USGSenseGloveInfo*& OutGloveInfo, bool bUpdateOldModels = true); + /** + * Deserialize a HandProfile back into usable values. + */ static USGSenseGloveInfo* Deserialize(UObject* Outer, const FString& SerializedString); private: @@ -107,26 +131,41 @@ private: FImplDeleter PimplDeleter; public: + /** + * The default constructor. + */ USGSenseGloveInfo(); + /** + * Create a new Sense Glove device model. + */ USGSenseGloveInfo(const FString& DeviceId, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, bool bRightHanded, int32 NumberOfSensors, const FQuat& ImuCorrection, const TArray& StartPositions, const TArray& StartRotations, const TArray>& GloveLengths, const TArray& Functions); + /** + * Create a new Sense Glove device model. + */ USGSenseGloveInfo(const FString& DeviceId, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, bool bRightHanded, int32 NumberOfSensors, const FRotator& ImuCorrection, const TArray& StartPositions, const TArray& StartRotations, const TArray>& GloveLengths, const TArray& Functions); + /** + * Create a new Sense Glove device model. + */ USGSenseGloveInfo(const FString& DeviceId, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, bool bRightHanded, int32 NumberOfSensors, const FQuat& ImuCorrection, const TArray& StartPositions, const TArray& StartRotations, const TArray& GloveLengths, const TArray& Functions); + /** + * Create a new Sense Glove device model. + */ USGSenseGloveInfo(const FString& DeviceId, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, bool bRightHanded, int32 NumberOfSensors, const FRotator& ImuCorrection, @@ -164,50 +203,116 @@ protected: FSGSenseGloveInfoImpl& ToSenseGloveInfoImpl(); public: + /** + * Unique identifier of this device. + */ FString GetDeviceId() const; + /** + * Hardware (sub) version of this Sense Glove Device. + */ FString GetHardwareVersion() const; + /** + * Firmware version running on the device's MicroController. + */ int32 GetFirmwareVersion() const; + /** + * Sub-Firmware version running on the device's MicroController. + */ int32 GetSubFirmwareVersion() const; + /** + * Check if this Sense Glove belongs to a left or right hand. + */ bool IsRight() const; + /** + * The number of Sensors in this SenseGlove. + */ int32 GetNumberOfSensors() const; + /** + * The IMU correction of this Sense Glove. + */ FQuat GetImuCorrectionQ() const; + /** + * The IMU correction of this Sense Glove. + */ FRotator GetImuCorrection() const; + /** + * The starting positions of each Sense Glove finger, relative to the glove origin. + */ TArray GetStartPositions() const; + /** + * The starting rotations of each Sense Glove finger, relative to the glove origin. + */ TArray GetStartRotationsQ() const; + /** + * The starting rotations of each Sense Glove finger, relative to the glove origin. + */ TArray GetStartRotations() const; + /** + * The lengths of each Sense Glove finger section, in cm. + */ TArray> GetGloveLengths() const; + /** + * Whether this device has a specific function (T/F). + */ TArray GetFunctions() const; public: + /** + * The starting position of one Sense Glove finger, relative to the glove origin. + */ FVector GetStartPosition(ESGFinger Finger) const; + /** + * The starting rotation of one Sense Glove finger, relative to the glove origin. + */ FQuat GetStartRotationQ(ESGFinger Finger) const; + /** + * The starting rotation of one Sense Glove finger, relative to the glove origin. + */ FRotator GetStartRotation(ESGFinger Finger) const; + /** + * The lengths of one Sense Glove finger's sections, in cm. + */ TArray GetGloveLengths(ESGFinger Finger) const; public: + /** + * Place incoming sensor data into the right format, according to this glove's model. + */ TArray> ToGloveAngles(const TArray>& SensorAngles) const; + /** + * Returns true if this SG_Model has the same values as another. + */ bool Equals(const USGSenseGloveInfo* SenseGloveInfo) const; public: + /** + * Create a string representation for logging. If shortNotation is false, all values are reported. + */ FString ToString() const; + /** + * Create a string representation for fast logging. + */ FString ToString(bool bShortNotation) const; + /** + * Serialize this HandProfile into a string representation. + */ FString SGSerialize() const; -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCore/Public/SGCore/SGSenseGlovePose.h b/Source/SenseGloveCore/Public/SGCore/SGSenseGlovePose.h index 5bf66616..a2e7ba67 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGSenseGlovePose.h +++ b/Source/SenseGloveCore/Public/SGCore/SGSenseGlovePose.h @@ -29,7 +29,8 @@ * * @section DESCRIPTION * - * + * Contains position and rotation data of a SenseGlove's exoskeleton, along + * with accessors for relevant variables. */ @@ -55,6 +56,9 @@ class FSGSenseGlovePoseImpl; +/** + * Represents a pose of a Sense Glove exoskeleton. + */ UCLASS(BlueprintType) class SENSEGLOVECORE_API USGSenseGlovePose final : public UObject { @@ -65,31 +69,52 @@ public: UObject* Outer, const FSGSenseGlovePoseImpl& SenseGlovePoseImpl); public: + /** + * The basic constructor. + */ static USGSenseGlovePose* NewSenseGlovePose(UObject* Outer); + /** + * Creates a new instance of a SenseGlovePose. + */ static USGSenseGlovePose* NewSenseGlovePose(UObject* Outer, bool bRightHanded, const TArray>& JointPositions, const TArray>& JointRotations, const TArray>& GloveAngles); + /** + * Creates a new instance of a SenseGlovePose. + */ static USGSenseGlovePose* NewSenseGlovePose(UObject* Outer, bool bRightHanded, const TArray>& JointPositions, const TArray>& JointRotations, const TArray>& GloveAngles); + /** + * Creates a new instance of a SenseGlovePose. + */ static USGSenseGlovePose* NewSenseGlovePose(UObject* Outer, bool bRightHanded, const TArray& JointPositions, const TArray& JointRotations, const TArray& GloveAngles); + /** + * Creates a new instance of a SenseGlovePose. + */ static USGSenseGlovePose* NewSenseGlovePose(UObject* Outer, bool bRightHanded, const TArray& JointPositions, const TArray& JointRotations, const TArray& GloveAngles); public: + /** + * Returns an idle pose for the Sense Glove if no data can be found. + */ static USGSenseGlovePose* IdlePose(UObject* Outer, const USGSenseGloveInfo* GloveInfo); + /** + * Deserialize a GlovePose back into usable values. + */ static USGSenseGlovePose* Deserialize(UObject* Outer, const FString& SerializedString); private: @@ -104,23 +129,38 @@ private: FImplDeleter PimplDeleter; public: + /** + * The basic constructor. + */ USGSenseGlovePose(); + /** + * Creates a new instance of a SenseGlovePose. + */ USGSenseGlovePose(bool bRightHanded, const TArray>& JointPositions, const TArray>& JointRotations, const TArray>& GloveAngles); + /** + * Creates a new instance of a SenseGlovePose. + */ USGSenseGlovePose(bool bRightHanded, const TArray>& JointPositions, const TArray>& JointRotations, const TArray>& GloveAngles); + /** + * Creates a new instance of a SenseGlovePose. + */ USGSenseGlovePose(bool bRightHanded, const TArray& JointPositions, const TArray& JointRotations, const TArray& GloveAngles); + /** + * Creates a new instance of a SenseGlovePose. + */ USGSenseGlovePose(bool bRightHanded, const TArray& JointPositions, const TArray& JointRotations, @@ -151,33 +191,77 @@ public: const FSGSenseGlovePoseImpl& ToSenseGlovePoseImpl() const; public: + /** + * Whether this Glove Pose was created for be a right- or left hand, or not. + */ bool IsRight() const; + /** + * Positions of each glove joint, relative to the Glove's Origin. + */ TArray> GetJointPositions() const; + /** + * Quaternion rotation of each glove joint, relative to the Glove Origin. + */ TArray> GetJointRotationsQ() const; + /** + * Rotation of each glove joint, relative to the Glove Origin. + */ TArray> GetJointRotations() const; + /** + * Glove joint angles in euler notation, relative to the last segment. + * + * @remarks Essentially sensor angles, though placed in their proper xyz notation. + */ TArray> GetGloveAngles() const; public: + /** + * The position of the tip of the 'thimbles', the furthest link on each glove link. + */ TArray GetThimblePositions() const; + /** + * The (quaternion) rotation of the 'thimbles', the furthest link on each link. + */ TArray GetThimbleRotationsQ() const; + /** + * The rotation of the 'thimbles', the furthest link on each link. + */ TArray GetThimbleRotations() const; + /** + * Sum of the Sensor angles in each (xyz) direction. "Total Pronation / Flexion / Abduction". + */ TArray GetTotalGloveAngles() const; + /** + * Calculate fingertip positions based on a user profile. + */ TArray CalculateFingerTips(const USGSenseGloveHandProfile* SenseGloveHandProfile) const; + /** + * Calculate fingertip positions, knowing the offset between thimble and fingertips. + */ TArray CalculateFingerTips(const TArray& FingerOffsets) const; + /** + * Returns true if this glove pose equals another. + */ bool Equals(const USGSenseGlovePose* SenseGlovePose) const; public: + /** + * Returns a user-friendly string representation of this GlovePose for reporting. + */ FString ToString(bool bShortFormat = false) const; + /** + * Serialize this GlovePose into a string representation. + */ FString SGSerialize() const; -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCore/Public/SGCore/SGSenseGloveSensorData.h b/Source/SenseGloveCore/Public/SGCore/SGSenseGloveSensorData.h index 7961029f..fbb9da22 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGSenseGloveSensorData.h +++ b/Source/SenseGloveCore/Public/SGCore/SGSenseGloveSensorData.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * Parsed sensor data coming form a Sense Glove. */ @@ -50,6 +50,9 @@ class FSGSenseGloveSensorDataImpl; +/** + * Sense Glove Sensor Data, parsed from a sensor string. + */ UCLASS(BlueprintType) class SENSEGLOVECORE_API USGSenseGloveSensorData final : public UObject { @@ -60,29 +63,53 @@ public: UObject* Outer, const FSGSenseGloveSensorDataImpl& SenseGloveSensorDataImpl); public: + /** + * The basic constructor. + */ static USGSenseGloveSensorData* NewSenseGloveSensorData(UObject* Outer); + /** + * Create a new instance of a Sense Glove Sensor Data class. + */ static USGSenseGloveSensorData* NewSenseGloveSensorData( UObject* Outer, const TArray>& SensorAngles, const FQuat& ImuRotation, int32 ParsedValues, bool bImuParsed); + /** + * Create a new instance of a Sense Glove Sensor Data class. + */ static USGSenseGloveSensorData* NewSenseGloveSensorData( UObject* Outer, const TArray>& SensorAngles, const FRotator& ImuRotation, int32 ParsedValues, bool bImuParsed); + /** + * Create a new instance of a Sense Glove Sensor Data class. + */ static USGSenseGloveSensorData* NewSenseGloveSensorData( UObject* Outer, const TArray& SensorAngles, const FQuat& ImuRotation, int32 ParsedValues, bool bImuParsed); + /** + * Create a new instance of a Sense Glove Sensor Data class. + */ static USGSenseGloveSensorData* NewSenseGloveSensorData( UObject* Outer, const TArray& SensorAngles, const FRotator& ImuRotation, int32 ParsedValues, bool bImuParsed); public: + /** + * Returns sensor data with no values. + */ static USGSenseGloveSensorData* Empty(UObject* Outer); + /** + * Deserialize Sense Glove sensor data from a raw char[] received through IPC. + */ static USGSenseGloveSensorData* Parse(UObject* Outer, const FString& RawData, const USGSenseGloveInfo* GloveInfo); + /** + * Deserialize a HandProfile back into useable values. + */ static USGSenseGloveSensorData* Deserialize(UObject* Outer, const FString& SerializedString); private: @@ -97,17 +124,32 @@ private: FImplDeleter PimplDeleter; public: + /** + * The basic constructor. + */ USGSenseGloveSensorData(); + /** + * Create a new instance of a Sense Glove Sensor Data class. + */ USGSenseGloveSensorData(const TArray>& SensorAngles, const FQuat& ImuRotation, int32 ParsedValues, bool bImuParsed); + /** + * Create a new instance of a Sense Glove Sensor Data class. + */ USGSenseGloveSensorData(const TArray>& SensorAngles, const FRotator& ImuRotation, int32 ParsedValues, bool bImuParsed); + /** + * Create a new instance of a Sense Glove Sensor Data class. + */ USGSenseGloveSensorData(const TArray& SensorAngles, const FQuat& ImuRotation, int32 ParsedValues, bool bImuParsed); + /** + * Create a new instance of a Sense Glove Sensor Data class. + */ USGSenseGloveSensorData(const TArray& SensorAngles, const FRotator& ImuRotation, int32 ParsedValues, bool bImuParsed); @@ -136,26 +178,56 @@ public: const FSGSenseGloveSensorDataImpl& ToSenseGloveSensorDataImpl() const; public: + /** + * Glove angles in radians, sorted by finger, from proximal to distal. + */ TArray> GetSensorAngles() const; + /** + * + */ FQuat GetImuRotationQ() const; + /** + * + */ FRotator GetImuRotation() const; + /** + * Check how many values have been parsed from the Sensor String. + */ int32 GetParsedValues() const; + /** + * Check if the IMU was properly parsed. + */ bool IsImuParsed() const; public: + /** + * Get the glove angles of a specific finger segment. + */ TArray GetSensorAngles(ESGFinger Finger) const; + /** + * Returns all glove angles in a sequence, without splitting them per finger. + */ TArray GetAngleSequence() const; public: + /** + * Returns true if the values of both data are equal. + */ bool Equals(const USGSenseGloveSensorData* SenseGloveSensorData) const; public: + /** + * Retrieve a simple representation of this sensor data for debugging purposes. + */ FString ToString() const; + /** + * Serialize this HandProfile into a string representation. + */ FString SGSerialize() const; -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCore/Public/SGCore/SGSenseGloveVars.h b/Source/SenseGloveCore/Public/SGCore/SGSenseGloveVars.h index d442d18d..7e394a62 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGSenseGloveVars.h +++ b/Source/SenseGloveCore/Public/SGCore/SGSenseGloveVars.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * Contains enumerators and classes to aid in Sense Glove Deserialization. */ @@ -45,35 +45,76 @@ #include "SGSenseGloveVars.generated.h" +/** + * "Database" class containing Sense Glove internal variables. + */ USTRUCT() struct SENSEGLOVECORE_API FSGSenseGloveVars { GENERATED_BODY() public: + /** + * Retrieve a basic ConstantsString for a Sense Glove of a specific Hardware Version. Used for debugging / unit tests. + * + * @returns Returns an empty string when an invalid glove version is requested. + */ static FString GetStandardConstantsString(const FString& HardwareVersion, float FirmwareVersion, bool bRightHanded); + /** + * Retrieve an example sensor string of a Sense Glove with a particular hardware- and firmware version. + */ static FString GetSensorString(const FString& HardwareVersion, float FirmwareVersion); + /** + * Retrieve the starting positions of a particular Sense Glove. + */ static TArray GetStartPositions(const FString& HardwareVersion, bool bRightHanded); + /** + * Retrieve the starting rotations of a particular Sense Glove. + */ static TArray GetStartRotationsQ(const FString& HardwareVersion, bool bRightHanded); + /** + * Retrieve the starting rotations of a particular Sense Glove. + */ static TArray GetStartRotations(const FString& HardwareVersion, bool bRightHanded); + /** + * Retrieve the glove finger lengths of a particular Sense Glove. + */ static TArray> GetGloveLengths(const FString& HardwareVersion); + /** + * Get the number of sensors of a SenseGlove. + */ static int32 GetSensors(const FString& HardwareVersion); + /** + * Get the default IMUCorrection for the SenseGlove. + */ static FQuat GetImuCorrectionQ(const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion); + /** + * Get the default IMUCorrection for the SenseGlove. + */ static FRotator GetImuCorrection(const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion); + /** + * Check all functionality of a SenseGlove. + */ static TArray GetFunctions(const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion); + /** + * Generate a custom glove info. + */ static USGSenseGloveInfo* GenerateGloveModel(UObject* Outer, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, bool bRightHanded); + /** + * Generate a custom glove info. + */ static USGSenseGloveInfo* GenerateGloveModel(UObject* Outer, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, bool bRightHanded, const FString& CustomId); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCore/Public/SGCore/SGSensorRange.h b/Source/SenseGloveCore/Public/SGCore/SGSensorRange.h index eea8d111..773faac6 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGSensorRange.h +++ b/Source/SenseGloveCore/Public/SGCore/SGSensorRange.h @@ -46,6 +46,9 @@ class FSGSensorRangeImpl; +/** + * + */ UCLASS(BlueprintType) class SENSEGLOVECORE_API USGSensorRange final : public UObject { @@ -56,18 +59,36 @@ public: UObject* Outer, const FSGSensorRangeImpl& SensorRangeImpl); public: + /** + * Create a new instance of a SensorRange with values at 0, 0. + */ static USGSensorRange* NewSensorRange(UObject* Outer); + /** + * Create a new SensorRange with predefined Min/Max values. + */ static USGSensorRange* NewSensorRange(UObject* Outer, const TArray& MinValues, const TArray& MaxValues); public: + /** + * Generates a Sensor Range where minimum values are float.MaxValue and maximum values are float.MinValue. + */ static USGSensorRange* ForCalibration(UObject* Outer); + /** + * Convert a serialized SensorRange back into the appropriate class. + */ static USGSensorRange* Deserialize(UObject* Outer, const FString& SerializedString); + /** + * Evaluate maxValues so that it contains the highest x, y, and z values between currentValues and maxValues. + */ static void CheckMax(const FVector CurrentValues, FVector& OutMaxValues); + /** + * Evaluate minValues so that it contains the lowest x, y, and z values between currentValues and minValues. + */ static void CheckMin(const FVector& CurrentValues, FVector& OutMinValues); private: @@ -82,8 +103,14 @@ private: FImplDeleter PimplDeleter; public: + /** + * Create a new instance of a SensorRange with values at 0, 0. + */ USGSensorRange(); + /** + * Create a new SensorRange with predefined Min/Max values. + */ USGSensorRange(const TArray& MinValues, const TArray& MaxValues); public: @@ -111,25 +138,55 @@ public: const FSGSensorRangeImpl& ToSensorRangeImpl() const; public: + /** + * Access the lowest values values of this range. + */ TArray GetMinValues() const; + /** + * Set the lowest values values of this range. + */ void SetMinValues(const TArray& Values); + /** + * Access the highest values values of this range. + */ TArray GetMaxValues() const; + /** + * Set the highest values values of this range. + */ void SetMaxValues(const TArray& Values); + /** + * Access the difference between min and max values. + */ TArray GetRange() const; public: + /** + * Update the Range based on the current MinValues and MaxValues. + */ void UpdateRange(); + /** + * In otherValues are greater/smaller than this current range, update them. + */ void CheckForExtremes(const TArray& OtherValues); public: + /** + * Report the Range value of this SensorRange, separated by a comma. + */ FString RangeString(bool bYOnly = true) const; + /** + * Convert this SensorRange into a string rotation [min ... max]. + */ FString ToString(bool bYOnly = true) const; + /** + * Serialize this SensorRange into a string representation, that can be deserialized later. + */ FString SGSerialize() const; -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCore/Public/SGCore/SGThumperCommand.h b/Source/SenseGloveCore/Public/SGCore/SGThumperCommand.h index a43c2c6b..19e7c3d9 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGThumperCommand.h +++ b/Source/SenseGloveCore/Public/SGCore/SGThumperCommand.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * Thumper command. */ @@ -44,6 +44,9 @@ class FSGThumperCommandImpl; +/** + * + */ UCLASS(BlueprintType) class SENSEGLOVECORE_API USGThumperCommand : public UObject { @@ -53,11 +56,20 @@ public: static USGThumperCommand* NewThumperCommand(UObject* Outer, const FSGThumperCommandImpl& ThumperCommandImpl); public: + /** + * Empty constructor for inheritance. + */ static USGThumperCommand* NewThumperCommand(UObject* Outer); + /** + * Create a new Thumper Command. + */ static USGThumperCommand* NewThumperCommand(UObject* Outer, int32 Magnitude); public: + /** + * A command that turns off all force feedback on the Sense Glove. + */ static USGThumperCommand* Off(UObject* Outer); private: @@ -72,7 +84,14 @@ private: FImplDeleter PimplDeleter; public: + /** + * Empty constructor for inheritance. + */ USGThumperCommand(); + + /** + * Create a new Thumper Command. + */ explicit USGThumperCommand(int32 Magnitude); public: @@ -100,14 +119,29 @@ public: const FSGThumperCommandImpl& ToThumperCommandImpl() const; public: + /** + * Thumper intensity, a level between 0 and 100. + */ int32 GetMagnitude() const; + /** + * + */ void SetMagnitude(int32 Magnitude); public: + /** + * Duplicate the Thumper command. + */ USGThumperCommand* Copy(UObject* Outer) const; + /** + * Merge two ThumperCommands into one. + */ USGThumperCommand* Merge(UObject* Outer, const USGThumperCommand* ThumperCommand) const; + /** + * + */ bool Equals(const USGThumperCommand* ThumperCommand) const; -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCore/Public/SGCore/SGTimedBuzzCommand.h b/Source/SenseGloveCore/Public/SGCore/SGTimedBuzzCommand.h index 084bb6c4..bd0d3c68 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGTimedBuzzCommand.h +++ b/Source/SenseGloveCore/Public/SGCore/SGTimedBuzzCommand.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * Buzz Motor with timing parameters. */ @@ -46,6 +46,11 @@ class FSGTimedBuzzCommandImpl; +/** + * Buzz motor commands that is meant to stop after a few milliseconds. + * + * @remarks Intended use; this.levels indicates the actual command. + */ UCLASS(BlueprintType) class SENSEGLOVECORE_API USGTimedBuzzCommand : public USGBuzzCommand { @@ -59,12 +64,21 @@ public: UObject* Outer, TSharedRef TimedBuzzCommandImpl); public: + /** + * Empty constructor for inheritance. + */ static USGTimedBuzzCommand* NewTimedBuzzCommand(UObject* Outer); + /** + * Create a new TimeBuzzCommand for a single finger. + */ static USGTimedBuzzCommand* NewTimedBuzzCommand( UObject* Outer, ESGFinger Finger, int32 Magnitude, float DurationSeconds, float StartTimeSeconds = 0.0f); + /** + * Create a new buzz motor command that expires after timing_ms. + */ static USGTimedBuzzCommand* NewTimedBuzzCommand( UObject* Outer, const USGBuzzCommand* BaseCommand, float DurationSeconds, float StartTimeSeconds = 0.0f); @@ -81,8 +95,19 @@ private: FImplDeleter PimplDeleter; public: + /** + * Empty constructor for inheritance. + */ USGTimedBuzzCommand(); + + /** + * Create a new TimeBuzzCommand for a single finger. + */ USGTimedBuzzCommand(ESGFinger Finger, int32 Magnitude, float DurationSeconds, float StartTimeSeconds = 0.0f); + + /** + * Create a new buzz motor command that expires after timing_ms. + */ USGTimedBuzzCommand(const USGBuzzCommand* BaseCommand, float DurationSeconds, float StartTimeSeconds = 0.0f); public: @@ -121,25 +146,61 @@ protected: virtual void SyncUProperties() override; public: + /** + * Copy this Buzz Command's values into a new object. + */ USGBuzzCommand* Copy(UObject* Outer) const; + /** + * Merges this base command with another command. + */ USGBuzzCommand* Merge(UObject* Outer, const USGBuzzCommand* BuzzCommand) const; public: + /** + * Access the base command, which indicates the buzz levels to keep untill time elapses. + */ USGBuzzCommand* GetBaseCommand(UObject* Outer) const; + /** + * + */ int32 GetMagnitude() const; + /** + * The total time [milliseconds] each buzz motor should be vibrating for. + */ float GetDuration() const; + /** + * The time elapsed since the command was sent [milliseconds]. + */ float GetElapsedTime() const; + /** + * Check if this timed command's timing has elapsed. + */ bool HasTimeElapsed() const; + /** + * Represents how far this effect is in its playtime; [0...1], where 0 means at the start, and 1 means at the end. + * + * @param bClamp01 Optional parameter; ensures this value is always between 0 and 1. + */ float NormalizedTime(bool bClamp01 = true) const; + /** + * Reset the timings of this BuzzCommand, allowing us to re-use it. + */ void ResetTiming(); + + /** + * Update the elapsed time to check if the buzz motors should stop. + */ void UpdateTiming(float DeltaSeconds); + /** + * + */ FString ToString() const; -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCore/Public/SGCore/SGTimedThumpCommand.h b/Source/SenseGloveCore/Public/SGCore/SGTimedThumpCommand.h index ca9732af..c3c6b4ee 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGTimedThumpCommand.h +++ b/Source/SenseGloveCore/Public/SGCore/SGTimedThumpCommand.h @@ -46,6 +46,9 @@ class FSGTimedThumpCommandImpl; +/** + * + */ UCLASS(BlueprintType) class SENSEGLOVECORE_API USGTimedThumpCommand final : public UObject { @@ -56,11 +59,20 @@ public: UObject* Outer, const FSGTimedThumpCommandImpl& TimedThumpCommandImpl); public: + /** + * Internal, empty, for extended classes. + */ static USGTimedThumpCommand* NewTimedThumpCommand(UObject* Outer); + /** + * Create a new Timed Thumper Command. + */ static USGTimedThumpCommand* NewTimedThumpCommand( UObject* Outer, int32 Magnitude, float DurationSeconds, float StartTimeSeconds = 0.0f); + /** + * Create a new Timed Thumper Command. + */ static USGTimedThumpCommand* NewTimedThumpCommand( UObject* Outer, const USGThumperCommand* BaseCommand, float DurationSeconds, float StartTimeSeconds = 0.0f); @@ -76,8 +88,19 @@ private: FImplDeleter PimplDeleter; public: + /** + * Internal, empty, for extended classes. + */ USGTimedThumpCommand(); + + /** + * Create a new Timed Thumper Command. + */ USGTimedThumpCommand(int32 Magnitude, float DurationSeconds, float StartTimeSeconds = 0.0f); + + /** + * Create a new Timed Thumper Command. + */ USGTimedThumpCommand(const USGThumperCommand* BaseCommand, float DurationSeconds, float StartTimeSeconds = 0.0f); public: @@ -105,28 +128,61 @@ public: const FSGTimedThumpCommandImpl& ToTimedThumpCommandImpl() const; public: + /** + * Magnitude in %. + */ int32 GetMagnitude() const; + /** + * + */ void SetMagnitude(int32 Magnitude); + /** + * Duration in seconds. + */ float GetDuration() const; + /** + * + */ void SetDuration(float Duration); + /** + * The elapsed time so far. + */ float GetElapsedTime() const; + /** + * + */ void SetElapsedTime(float ElapsedTime); public: + /** + * Returns true if the timed command has elapsed. + */ bool HasTimeElapsed() const; public: + /** + * Copy the parameters of this ThumperCommand into another instance. + */ USGTimedThumpCommand* Copy(UObject* Outer, bool bCopyElapsed = true) const; + /** + * Update the timing on this Thumper Command. + */ void Update(float DeltaSeconds); + /** + * + */ bool Equals(const USGTimedThumpCommand* TimedThumpCommand) const; public: + /** + * + */ FString ToString() const; -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCore/Public/SGCore/SGTracking.h b/Source/SenseGloveCore/Public/SGCore/SGTracking.h index a57fbc24..707ddda3 100644 --- a/Source/SenseGloveCore/Public/SGCore/SGTracking.h +++ b/Source/SenseGloveCore/Public/SGCore/SGTracking.h @@ -44,107 +44,241 @@ #include "SGTracking.generated.h" +/** + * + */ USTRUCT() struct SENSEGLOVECORE_API FSGTracking { GENERATED_BODY() public: + /** + * Knowing a position & rotation in 3D space, calculate a relative location based on offsets. + */ static void CalculateLocation( const FVector& TrackedPosition, const FQuat& TrackedRotation, const FVector& PositionOffset, const FQuat& RotationOffset, FVector& OutNewPosition, FQuat& OutNewRotation); + /** + * Knowing a position & rotation in 3D space, calculate a relative location based on offsets. + */ static void CalculateLocation( const FVector& TrackedPosition, const FRotator& TrackedRotation, const FVector& PositionOffset, const FRotator& RotationOffset, FVector& OutNewPosition, FRotator& OutNewRotation); + /** + * Positional offset from each finger to the glove origin. + */ static TArray GetSenseGloveFingerToGlovePositionOrigin(); + /** + * + */ static TArray GetSenseGloveFingerToGloveRotationOriginQ(); + /** + * + */ static TArray GetSenseGloveFingerToGloveRotationOrigin(); + /** + * Default position offset from glove origin to wrist location, in cm. + */ static FVector GetSenseGloveWristPositionOffset(); + /** + * Default rotation offset from glove origin to wrist location. + */ static FQuat GetSenseGloveWristRotationOffsetQ(); + /** + * Default rotation offset from glove origin to wrist location. + */ static FRotator GetSenseGloveWristRotationOffset(); + /** + * Get the position and rotation offsets to go from the glove origin to the mounted position. + * @remarks Based on CAD. needs to be inverted when going from tracker to glove origin. + */ static void GetSenseGloveMountOffset(bool bRightHanded, ESGFinger ToFinger, FVector& OutIPosition, FQuat& OutIRotation); + /** + * Get the position and rotation offsets to go from the glove origin to the mounted position. + * @remarks Based on CAD. needs to be inverted when going from tracker to glove origin. + */ static void GetSenseGloveMountOffset(bool bRightHanded, ESGFinger ToFinger, FVector& OutIPosition, FRotator& OutIRotation); + /** + * Get the offset to get from the TrackedHardware to a SenseGlove mounting location. Combined with Glove-Mount offset to get the glove location. + */ static void GetSenseGloveTrackerMountOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset); + /** + * Get the offset to get from the TrackedHardware to a SenseGlove mounting location. Combined with Glove-Mount offset to get the glove location. + */ static void GetSenseGloveTrackerMountOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded, FVector& OutPositionOffset, FRotator& OutRotationOffset); + /** + * Vive Tracker origin to Finger rotational offset. + */ static FVector GetSenseGloveViveToAttachPosition(); + /** + * Vive Tracker origin to Finger rotational offset. + */ static FQuat GetSenseGloveViveToAttachRotationQ(); + /** + * Vive Tracker origin to Finger rotational offset. + */ static FRotator GetSenseGloveViveToAttachRotation(); + /** + * Oculus Touch origin to Finger rotational offset. + */ static FVector GetSenseGloveOculusTouchToAttachPosition(); + /** + * Oculus Touch origin to Finger rotational offset. + */ static FQuat GetSenseGloveOculusTouchToAttachRotationQ(); + /** + * Oculus Touch origin to Finger rotational offset. + */ static FRotator GetSenseGloveOculusTouchToAttachRotation(); + /** + * Positional offset between Nova Glove Origin and Wrist. + */ static FVector GetNovaToWristPositionOffset(); + /** + * Rotational offset between Nova Glove Origin and Wrist. + */ static FQuat GetNovaToWristRotationOffsetQ(); + /** + * Rotational offset between Nova Glove Origin and Wrist. + */ static FRotator GetNovaToWristRotationOffset(); + /** + * Returns the Offsets that will bring us from the Nova origin to the wrist position. + */ static void GetNovaGloveWristOffset(bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset); + /** + * Returns the Offsets that will bring us from the Nova origin to the wrist position. + */ static void GetNovaGloveWristOffset(bool bRightHanded, FVector& OutPositionOffset, FRotator& OutRotationOffset); + /** + * + */ static FVector GetRightNovaViveToAttachPosition(); + /** + * + */ static FQuat GetRightNovaViveToAttachRotationQ(); + /** + * + */ static FRotator GetRightNovaViveToAttachRotation(); + /** + * + */ static FVector GetLeftNovaViveToAttachPosition(); + /** + * + */ static FQuat GetLeftNovaViveToAttachRotationQ(); + /** + * + */ static FRotator GetLeftNovaViveToAttachRotation(); + /** + * + */ static FVector GetRightNovaQuest2ToAttachPosition(); + /** + * + */ static FQuat GetRightNovaQuest2ToAttachRotationQ(); + /** + * + */ static FRotator GetRightNovaQuest2ToAttachRotation(); + /** + * + */ static FVector GetLeftNovaQuest2ToAttachPosition(); + /** + * + */ static FQuat GetLeftNovaQuest2ToAttachRotationQ(); + /** + * + */ static FRotator GetLeftNovaQuest2ToAttachRotation(); + /** + * @remarks Left is a mirror, so we only need R pos. + */ static FVector GetRightNovaPico2ToAttachPosition(); + /** + * + */ static FQuat GetRightNovaPico2ToAttachRotationQ(); + /** + * + */ static FRotator GetRightNovaPico2ToAttachRotation(); + /** + * + */ static FQuat GetLeftNovaPico2ToAttachRotationQ(); + /** + * + */ static FRotator GetLeftNovaPico2ToAttachRotation(); + /** + * Retrieves Offsets for a particular device. + */ static void GetNovaGloveTrackerOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset); + /** + * Retrieves Offsets for a particular device. + */ static void GetNovaGloveTrackerOffset(ESGPositionalTrackingHardware Hardware, bool bRightHanded, FVector& OutPositionOffset, FRotator& OutRotationOffset); + /** + * + */ static FString ToString(ESGPositionalTrackingHardware Hardware); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHapticGloveHandProfilesKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHapticGloveHandProfilesKismetLibrary.h index f8c77fe7..6327fbe7 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHapticGloveHandProfilesKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHapticGloveHandProfilesKismetLibrary.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * An interface to get calibration to / from disk. */ @@ -43,57 +43,103 @@ class USGHandProfile; class USGHapticGlove; class USGSensorRange; +/** + * A glove developed by SenseGlove, that has hand tracking and/or haptic feedback functionality. + */ UCLASS(meta=(ScriptName = "SesneGloveHapticGloveHandProfilesKismetLibrary")) class SENSEGLOVECOREKISMET_API USGHapticGloveHandProfilesKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * Returns the directory where our HandProfiles are stored. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptic Glove Hand Profiles") static FString GetProfileDirectory(); + /** + * Set the directory where our HandProfiles are stored. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptic Glove Hand Profiles") static void SetProfileDirectory(const FString& Directory); + /** + * Access the latest Left Hand Profile from disk. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptic Glove Hand Profiles", meta=(WorldContext="WorldContextObject")) static void GetLeftHandProfile(UObject* WorldContextObject, USGHandProfile*& OutHandProfile); + /** + * Sets the newest Left Hand Profile - also stores it on disk. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptic Glove Hand Profiles") static void SetLeftHandProfile(const USGHandProfile* HandProfile); + /** + * Access the latest Right Hand Profile from disk. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptic Glove Hand Profiles", meta=(WorldContext="WorldContextObject")) static void GetRightHandProfile(UObject* WorldContextObject, USGHandProfile*& OutHandProfile); + /** + * Sets the newest Right Hand Profile - also stores it on disk. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptic Glove Hand Profiles") static void SetRightHandProfile(const USGHandProfile* HandProfile); + /** + * Retrieve a left- or right handed profile. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptic Glove Hand Profiles", meta=(WorldContext="WorldContextObject")) static void GetProfile(UObject* WorldContextObject, bool bRightHanded, USGHandProfile*& OutHandProfile); + /** + * Store a profile in the global variables and on disk. The profile determines if this is a left or right hand. + */ UFUNCTION(BlueprintCallable, DisplayName="Set Profile", Category="SenseGlove | Core | Haptic Glove Hand Profiles") static void SetProfile_HP(const USGHandProfile* HandProfile); + /** + * Store a profile in the global variables and on disk. You determine if this is a left or right hand. + */ UFUNCTION(BlueprintCallable, DisplayName="Set Profile", Category="SenseGlove | Core | Haptic Glove Hand Profiles") static void SetProfile_HP_bRH(const USGHandProfile* HandProfile, bool bRightHanded); + /** + * Restore both profiles back to their default values. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptic Glove Hand Profiles") static void RestoreDefaults(); + /** + * Restore the left- or right hand profiles back to their default values. + */ UFUNCTION(BlueprintCallable, DisplayName="Restore Defaults", Category="SenseGlove | Core | Haptic Glove Hand Profiles") static void RestoreDefaults_bRH(bool bRightHanded); + /** + * Load the latest profiles from disk. Automatically called when you first try to access a profile. + * Exposed so you can force-reload profiles. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptic Glove Hand Profiles") static void TryLoadingFromDisk(); + /** + * Stores the last sensor range of a glove. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptic Glove Hand Profiles") static bool SaveLastRange(const USGSensorRange* CurrentRange, const USGHapticGlove* ForGlove); + /** + * Loads the last sensor range of a glove. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptic Glove Hand Profiles", meta=(WorldContext="WorldContextObject")) static bool LoadLastRange(UObject* WorldContextObject, const USGHapticGlove* ForGlove, USGSensorRange*& OutLastRange); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHapticGloveQuickCalibrationKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHapticGloveQuickCalibrationKismetLibrary.h index 8f1b6d10..8d21d06e 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHapticGloveQuickCalibrationKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHapticGloveQuickCalibrationKismetLibrary.h @@ -41,16 +41,25 @@ #include "SGHapticGloveQuickCalibrationKismetLibrary.generated.h" +/** + * + */ UCLASS(meta=(ScriptName = "SesneGloveHapticGloveQuickCalibrationKismetLibrary")) class SENSEGLOVECOREKISMET_API USGHapticGloveQuickCalibrationKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Haptic Glove Quick Calibration", meta=(WorldContext="WorldContextObject")) static USGHapticGloveQuickCalibration* MakeHapticGloveQuickCalibration(UObject* WorldContextObject); + /** + * Create a new instance of a QuickCalibration for Haptic Gloves. + */ UFUNCTION(BlueprintCallable, DisplayName="Make Haptic Glove Quick Calibration", Category="SenseGlove | Core | Calibration | Haptic Glove Quick Calibration", meta=(WorldContext="WorldContextObject")) @@ -59,57 +68,99 @@ public: const USGHapticGlove* GloveToCalibrate, float AutoEndTimeout); + /** + * Default time in seconds, to end this sequence. 15 seconds is very quick for some people. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Haptic Glove Quick Calibration") static float GetDefaultAutoEndTimeout(); + /** + * Time, in seconds, after which this sequence stops gathering data. Based on the deltaSeconds variable passed in the Update() function. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Quick Calibration") static float GetAutoEndTimeout(const USGHapticGloveQuickCalibration* HapticGloveQuickCalibration); + /** + * When compiling the final profile, we use a Weighted Moving Average filter with this period to filer out some outliers. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Quick Calibration") static int32 GetSmoothingSamples(const USGHapticGloveQuickCalibration* HapticGloveQuickCalibration); + /** + * The min/max values recorded during this calibration sequence. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Quick Calibration", meta=(WorldContext="WorldContextObject")) static USGSensorRange* GetSensorRange(UObject* WorldContextObject, const USGHapticGloveQuickCalibration* HapticGloveQuickCalibration); + /** + * A temporary profile to apply the sensorRange to. Used to generate a 'preview' HandPose. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Quick Calibration", meta=(WorldContext="WorldContextObject")) static USGHandProfile* GetTemporaryProfile(UObject* WorldContextObject, const USGHapticGloveQuickCalibration* HapticGloveQuickCalibration); + /** + * Determines if the user has moved enough so that we can animate. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Quick Calibration") static bool CanAnimate(const USGHapticGloveQuickCalibration* HapticGloveQuickCalibration); + /** + * This sequence autocompletes after its autoEndTime has elapsed. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Quick Calibration") static bool AutoCompleted(const USGHapticGloveQuickCalibration* HapticGloveQuickCalibration); + /** + * Resets data points, min/max ranges and profile. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Haptic Glove Quick Calibration") static void Reset(USGHapticGloveQuickCalibration* HapticGloveQuickCalibration); + /** + * Update this calibration sequence with new data. We use deltaSeconds to check for things like stability. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Haptic Glove Quick Calibration") static void Update(USGHapticGloveQuickCalibration* HapticGloveQuickCalibration, float DeltaSeconds); + /** + * Add a new datapoint to this sequence's collection. Updates the range and profile used to generate a preview. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Haptic Glove Quick Calibration") static void AddDataPoint(USGHapticGloveQuickCalibration* HapticGloveQuickCalibration, const TArray& CalibrationData); + /** + * After we confirm the current step, we're basically done. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Haptic Glove Quick Calibration") static void ConfirmCurrentStep(USGHapticGloveQuickCalibration* HapticGloveQuickCalibration); + /** + * Compile a sensor range from the data points collected while the sequence was running. Smoothed by a Moving Average Filter. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Quick Calibration", meta=(WorldContext="WorldContextObject")) static bool CompileRange(UObject* WorldContextObject, const USGHapticGloveQuickCalibration* HapticGloveQuickCalibration, USGSensorRange*& OutSensorRange); + /** + * Returns a 'preview' of what a HandPose with this sequence's current settings would look like. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Quick Calibration", meta=(WorldContext="WorldContextObject")) static bool GetHandPose(UObject* WorldContextObject, const USGHapticGloveQuickCalibration* HapticGloveQuickCalibration, bool bRightHanded, USGHandPose*& OutCurrentHandPose); + /** + * Retrieve instructions on what to do during the current step. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Quick Calibration") static FString GetCurrentInstruction(const USGHapticGloveQuickCalibration* HapticGloveQuickCalibration, const FString& NextStepKey = ""); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGInterpolationSetKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGInterpolationSetKismetLibrary.h index 32643962..13e83c7c 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGInterpolationSetKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGInterpolationSetKismetLibrary.h @@ -29,7 +29,8 @@ * * @section DESCRIPTION * - * + * Data class containing all variables to map an input value from one range to + * another. */ @@ -41,79 +42,145 @@ class USGInterpolationSet; +/** + * Set of variables to map a value from one range to the next. + */ UCLASS(meta=(ScriptName = "SesneGloveInterpolationSetKismetLibrary")) class SENSEGLOVECOREKISMET_API USGInterpolationSetKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * Creates a basic interpolation set, without limits. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Interpolation Set", meta=(WorldContext="WorldContextObject")) static USGInterpolationSet* MakeInterpolationSet(UObject* WorldContextObject); + /** + * Create a new interpolation set without limits. + */ UFUNCTION(BlueprintCallable, DisplayName="Make Interpolation Set", Category="SenseGlove | Core | Kinematics | Interpolation Set", meta=(WorldContext="WorldContextObject")) static USGInterpolationSet* MakeInterpolationSet_F1_F2_T1_T2( UObject* WorldContextObject, float From1, float From2, float To1, float To2); + /** + * Create a new interpolation set with limits. + */ UFUNCTION(BlueprintCallable, DisplayName="Make Interpolation Set", Category="SenseGlove | Core | Kinematics | Interpolation Set", meta=(WorldContext="WorldContextObject")) static USGInterpolationSet* MakeInterpolationSet_F1_F2_T1_T2_M_M( UObject* WorldContextObject, float From1, float From2, float To1, float To2, float Min, float Max); + /** + * Convert a string notation of an InterpolationSet into a new class instance. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Interpolation Set", meta=(WorldContext="WorldContextObject")) static USGInterpolationSet* Deserialize(UObject* WorldContextObject, const FString& SerializedString); + /** + * First value of input range. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Interpolation Set") static float GetX0(const USGInterpolationSet* InterpolationSet); + /** + * + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Interpolation Set") static void SetX0(UPARAM(ref) USGInterpolationSet* InterpolationSet, float X0); + /** + * Second value of input range. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Interpolation Set") float GetX1(const USGInterpolationSet* InterpolationSet); + /** + * + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Interpolation Set") static void SetX1(UPARAM(ref) USGInterpolationSet* InterpolationSet, float X1); + /** + * First value of output range. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Interpolation Set") static float GetY0(const USGInterpolationSet* InterpolationSet); + /** + * + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Interpolation Set") static void SetY0(UPARAM(ref) USGInterpolationSet* InterpolationSet, float Y0); + /** + * Second value of output range. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Interpolation Set") static float GetY1(const USGInterpolationSet* InterpolationSet); + /** + * + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Interpolation Set") static void SetY1(UPARAM(ref) USGInterpolationSet* InterpolationSet, float Y1); + /** + * Minimum range of the output value. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Interpolation Set") static float GetMin(const USGInterpolationSet* InterpolationSet); + /** + * + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Interpolation Set") static void SetMin(UPARAM(ref) USGInterpolationSet* InterpolationSet, float Min); + /** + * Maximum range of the output value. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Interpolation Set") static float GetMax(const USGInterpolationSet* InterpolationSet); + /** + * + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Interpolation Set") static void SetMax(UPARAM(ref) USGInterpolationSet* InterpolationSet, float Max); + /** + * Calculate an output value in range [x0...x1] to [y0..y1] + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Interpolation Set") static int32 Get(const USGInterpolationSet* InterpolationSet, float Value, bool bLimit, bool bNormalizeAngle = false); + /** + * Returns true if this InterpolationSet has the same values as another set. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Interpolation Set") static bool Equals(const USGInterpolationSet* A, const USGInterpolationSet* B); + /** + * + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Interpolation Set") static FString ToString(const USGInterpolationSet* InterpolationSet); + /** + * + */ UFUNCTION(BlueprintPure, DisplayName="To String", Category="SenseGlove | Core | Kinematics | Interpolation Set") static FString ToString_bL(const USGInterpolationSet* InterpolationSet, bool bLimits); + /** + * Convert this InterpolationSet into a string notation so it can be stored on disk. + */ UFUNCTION(BlueprintPure, DisplayName="Serialize", Category="SenseGlove | Core | Kinematics | Interpolation Set") static FString SGSerialize(const USGInterpolationSet* InterpolationSet); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGJointKinematicsKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGJointKinematicsKismetLibrary.h index 42b8e978..0f875829 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGJointKinematicsKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGJointKinematicsKismetLibrary.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * Contains kinematic formulae and wrappers for Sense Glove mathematics. */ @@ -45,12 +45,19 @@ #include "SGJointKinematicsKismetLibrary.generated.h" +/** + * + */ UCLASS(meta=(ScriptName = "SesneGloveJointKinematicsKismetLibrary")) class SENSEGLOVECOREKISMET_API USGJointKinematicsKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * Perform forward Kinematics on a set of joints, defined by a start position- and rotation, + * joint angles and the lengths in between. Outputs the calculated positions and rotations. + */ UFUNCTION(BlueprintCallable, DisplayName="Forward Kinematics", Category="SenseGlove | Core | Kinematics | Joint Kinematics") static bool ForwardKinematics_SP_FQuat_SR_JL_JA_OutNP_TArrayFQuat_OutNR( @@ -58,6 +65,10 @@ public: const TArray& JointLengths, const TArray& JointAngles, TArray& OutNewPositions, TArray& OutNewRotations); + /** + * Perform forward Kinematics on a set of joints, defined by a start position- and rotation, + * joint angles and the lengths in between. Outputs the calculated positions and rotations. + */ UFUNCTION(BlueprintCallable, DisplayName="Forward Kinematics", Category="SenseGlove | Core | Kinematics | Joint Kinematics") static bool @@ -66,15 +77,21 @@ public: const TArray& JointLengths, const TArray& JointAngles, TArray& OutNewPositions, TArray& OutNewRotations); + /** + * Calculate positions and rotations of a finger based on input angles and profile. + */ UFUNCTION(BlueprintCallable, DisplayName="Forward Kinematics", Category="SenseGlove | Core | Kinematics | Joint Kinematics") static bool ForwardKinematics_P_F_JA_OutNP_TArrayFQuat_OutNR( const USGBasicHandModel* Profile, ESGFinger Finger, const TArray& JointAngles, TArray& OutNewPositions, TArray& OutNewRotations); + /** + * Calculate positions and rotations of a finger based on input angles and profile. + */ UFUNCTION(BlueprintCallable, DisplayName="Forward Kinematics", Category="SenseGlove | Core | Kinematics | Joint Kinematics") static bool ForwardKinematics_P_F_JA_OutNP_TArrayFRotator_OutNR( const USGBasicHandModel* Profile, ESGFinger Finger, const TArray& JointAngles, TArray& OutNewPositions, TArray& OutNewRotations); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGLibraryKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGLibraryKismetLibrary.h index 0962d202..249f6745 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGLibraryKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGLibraryKismetLibrary.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * Information about the SGCore C++ Library. */ @@ -42,6 +42,9 @@ #include "SGLibraryKismetLibrary.generated.h" +/** + * Provides information about this C++ Library. + */ UCLASS(meta=(ScriptName = "SesneGloveLibraryKismetLibrary")) class SENSEGLOVECOREKISMET_API USGLibraryKismetLibrary final : public USGBlueprintFunctionLibrary { @@ -71,4 +74,4 @@ public: */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Library") static FString GetSGConnectVersion(); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveCalibrationKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveCalibrationKismetLibrary.h index fe464aef..43ad1fe9 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveCalibrationKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveCalibrationKismetLibrary.h @@ -45,18 +45,27 @@ class USGNovaGloveHandProfile; +/** + * + */ UCLASS(meta=(ScriptName = "SesneGloveNovaGloveCalibrationKismetLibrary")) class SENSEGLOVECOREKISMET_API USGNovaGloveCalibrationKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * Apply a glove's default interpolation values to a profile, using the 'default' hand angles from calibration. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Nova Glove Calibration") static void ApplyDefaultCalibrationInterpolationValues( const TArray& RetractedValues, const TArray& ExtendedValues, const USGNovaGloveHandProfile* Profile); + /** + * Apply a set of sensor-to-joint-angle interpolations to a nova profile. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Nova Glove Calibration") static void ApplyInterpolationValues( const TArray& RetractedValues, @@ -64,4 +73,4 @@ public: const TArray& RetractedAngles, const TArray& ExtendedAngles, const USGNovaGloveHandProfile* Profile); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveKismetLibrary.h index 0a6a0a0b..49f98c34 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveKismetLibrary.h @@ -29,7 +29,8 @@ * * @section DESCRIPTION * - * + * An interface for the "Nova" - a soft glove. + * Contains methods for Kinematics, Haptics and Serialization. */ @@ -51,18 +52,30 @@ class USGNovaGloveHandProfile; class USGNovaGloveSensorData; class USGThumperCommand; +/** + * A soft glove with Force- and Vibrotactile Feedback and limited tracking. + */ UCLASS(meta=(ScriptName = "SesneGloveNovaGloveKismetLibrary")) class SENSEGLOVECOREKISMET_API USGNovaGloveKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * Byte indicating a new Nova haptic command. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove") static FString GetHapticsByte(); + /** + * Minimum calibration value distance until we apply the range. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove") static FVector GetMinCalibrationRange(); + /** + * Calculate a Hand Pose based on a HandMode; sensor data from a Nova, and a UserProfile. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove", meta=(WorldContext="WorldContextObject")) static USGHandPose* CalculateHandPose(UObject* WorldContextObject, @@ -70,32 +83,53 @@ public: const USGNovaGloveSensorData* NovaData, const USGNovaGloveHandProfile* Profile); + /** + * Deserializes a Nova from its ConstantsString. Returns a nullptr if unsuccessful. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove", meta=(WorldContext="WorldContextObject")) static USGDevice* Parse(UObject* WorldContextObject, const FString& ConstantsString); + /** + * Retrieve all Nova's. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove", meta=(WorldContext="WorldContextObject")) static TArray GetNovaGloves(UObject* WorldContextObject); + /** + * Retrieve the first connected Nova there is. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Nova Glove", Category="SenseGlove | Core | Nova | Nova Glove", meta=(WorldContext="WorldContextObject")) static bool GetNovaGlove_OutG(UObject* WorldContextObject, USGNovaGlove*& OutGlove); + /** + * Retrieve the first (connected) right or left handed Nova. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Nova Glove", Category="SenseGlove | Core | Nova | Nova Glove", meta=(WorldContext="WorldContextObject")) static bool GetNovaGlove_bRH_OutG(UObject* WorldContextObject, bool bRightHanded, USGNovaGlove*& OutGlove); + /** + * Convert a SenseGlove GlovePose into calibrationValues. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Calibration Values", Category="SenseGlove | Core | Nova | Nova Glove") static TArray GetCalibrationValues_SD(const USGNovaGloveSensorData* SensorData); + /** + * + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove", meta=(WorldContext="WorldContextObject")) static void CalibrateInterpolation(UObject* WorldContextObject, const TArray& MinValues, const TArray& MaxValues, USGNovaGloveHandProfile*& OutProfile); + /** + * Retrieve the location of the glove origin, based on a reference location without requiring an object reference. + */ UFUNCTION(BlueprintCallable, DisplayName="Calculate Glove Location", Category="SenseGlove | Core | Nova | Nova Glove") static void CalculateGloveLocation_RP_FQuat_RR_TH_bRH_OutGP_OutGR( @@ -103,6 +137,9 @@ public: ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, FVector& OutGlovePosition, FQuat& OutGloveRotation); + /** + * Retrieve the location of the glove origin, based on a reference location without requiring an object reference. + */ UFUNCTION(BlueprintCallable, DisplayName="Calculate Glove Location", Category="SenseGlove | Core | Nova | Nova Glove") static void CalculateGloveLocation_RP_FRotator_RR_TH_bRH_OutGP_OutGR( @@ -110,6 +147,9 @@ public: ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, FVector& OutGlovePosition, FRotator& OutGloveRotation); + /** + * Retrieve the location of the wrist, based on a reference location and default glove-hand offsets, without needing an object reference. + */ UFUNCTION(BlueprintCallable, DisplayName="Calculate Wrist Location", Category="SenseGlove | Core | Nova | Nova Glove") static void CalculateWristLocation_RP_FQuat_RR_TH_bRH_OutWP_OutWR( @@ -117,6 +157,9 @@ public: ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, FVector& OutWristPosition, FQuat& OutWristRotation); + /** + * Retrieve the location of the wrist, based on a reference location and default glove-hand offsets, without needing an object reference. + */ UFUNCTION(BlueprintCallable, DisplayName="Calculate Wrist Location", Category="SenseGlove | Core | Nova | Nova Glove") static void CalculateWristLocation_RP_FRotator_RR_TH_bRH_OutWP_OutWR( @@ -124,50 +167,95 @@ public: ESGPositionalTrackingHardware TrackingHardware, bool bRightHanded, FVector& OutWristPosition, FRotator& OutWristRotation); + /** + * Converts a thumper command into bytes that the Nova can understand. + */ UFUNCTION(BlueprintCallable, DisplayName="To Bytes", Category="SenseGlove | Core | Nova | Nova Glove") static FString ToBytes_TC(const USGThumperCommand* ThumperCommand); + /** + * Converts a force-feedback command into bytes that the Nova can understand. + */ UFUNCTION(BlueprintCallable, DisplayName="To Bytes", Category="SenseGlove | Core | Nova | Nova Glove") static FString ToBytes_FFC(const USGForceFeedbackCommand* ForceFeedbackCommand); + /** + * Converts a buzz-motor command into bytes that the Nova can understand. + */ UFUNCTION(BlueprintCallable, DisplayName="To Bytes", Category="SenseGlove | Core | Nova | Nova Glove") static FString ToBytes_BC(const USGBuzzCommand* BuzzCommand); + /** + * Return the DeviceType of this Nova. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove") static ESGDeviceType GetDeviceType(const USGNovaGlove* NovaGlove); + /** + * Returns this device's unique identifier. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove") static FString GetDeviceId(const USGNovaGlove* NovaGlove); + /** + * Access this device's hardware designation. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove") static FString GetHardwareVersion(const USGNovaGlove* NovaGlove); + /** + * Access this device's main firmware version. (ex: v3.2 -> 3). + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove") static int32 GetFirmwareVersion(const USGNovaGlove* NovaGlove); + /** + * Access this device's sub-firmware version. (ex: v3.2 -> 2). + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove") static int32 GetSubFirmwareVersion(const USGNovaGlove* NovaGlove); + /** + * Returns true if this device operates on a battery. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove") static bool HasBattery(const USGNovaGlove* NovaGlove); + /** + * Returns true if this device is currently charging. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove") static bool IsCharging(UPARAM(ref) USGNovaGlove* NovaGlove); + /** + * Returns the device's battery level, as a value between 0 (empty) and 1 (full). + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove") static bool GetBatteryLevel(UPARAM(ref) USGNovaGlove* NovaGlove, float& OutBatteryLevel); + /** + * Get the latest Sensor Data from this Sense Glove. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove", meta=(WorldContext="WorldContextObject")) static bool GetSensorData(UObject* WorldContextObject, UPARAM(ref) USGNovaGlove* NovaGlove, USGNovaGloveSensorData*& OutSensorData); + /** + * Retrieve Nova rotation. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Imu Rotation", Category="SenseGlove | Core | Nova | Nova Glove") static bool GetImuRotation_FQuat_OutI(UPARAM(ref) USGNovaGlove* NovaGlove, FQuat& OutImu); + /** + * Retrieve Nova rotation. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Imu Rotation", Category="SenseGlove | Core | Nova | Nova Glove") static bool GetImuRotation_FRotator_OutI(UPARAM(ref) USGNovaGlove* NovaGlove, FRotator& OutImu); + /** + * Retrieve a new hand pose using this glove, based on (calibrated) user data. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Hand Pose", Category="SenseGlove | Core | Nova | Nova Glove", meta=(WorldContext="WorldContextObject")) static bool GetHandPose_HM_P_OutHP(UObject* WorldContextObject, @@ -176,6 +264,9 @@ public: const USGNovaGloveHandProfile* Profile, USGHandPose*& OutHandPose); + /** + * Retrieve a new hand pose using this glove, based on (calibrated) user data. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Hand Pose", Category="SenseGlove | Core | Nova | Nova Glove", meta=(WorldContext="WorldContextObject")) static bool GetHandPose_HG_HP_OutHP(UObject* WorldContextObject, @@ -184,6 +275,9 @@ public: const USGHandProfile* HandProfile, USGHandPose*& OutHandPose); + /** + * Calculate the HandPose of this Device, taking into account user values, but not hand geometry. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Hand Pose", Category="SenseGlove | Core | Nova | Nova Glove", meta=(WorldContext="WorldContextObject")) static bool GetHandPose_HP_OutHP(UObject* WorldContextObject, @@ -191,16 +285,28 @@ public: const USGHandProfile* HandProfile, USGHandPose*& OutHandPose); + /** + * Send all available haptics to a Nova. + */ UFUNCTION(BlueprintCallable, DisplayName="Send Haptics", Category="SenseGlove | Core | Nova | Nova Glove") static void SendHaptics_FFC(UPARAM(ref) USGNovaGlove* NovaGlove, const USGForceFeedbackCommand* ForceFeedbackCommand); + /** + * Send Haptic Commands to this Glove. + */ UFUNCTION(BlueprintCallable, DisplayName="Send Haptics", Category="SenseGlove | Core | Nova | Nova Glove") static void SendHaptics_BC(UPARAM(ref) USGNovaGlove* NovaGlove, const USGBuzzCommand* BuzzCommand); + /** + * Send Haptic Commands to this Glove. + */ UFUNCTION(BlueprintCallable, DisplayName="Send Haptics", Category="SenseGlove | Core | Nova | Nova Glove") static void SendHaptics_TC(UPARAM(ref) USGNovaGlove* NovaGlove, const USGThumperCommand* ThumperCommand); + /** + * Send Haptic Commands to this Glove. + */ UFUNCTION(BlueprintCallable, DisplayName="Send Haptics", Category="SenseGlove | Core | Nova | Nova Glove") static void SendHaptics_FFC_BC_TC( UPARAM(ref) USGNovaGlove* NovaGlove, @@ -208,21 +314,33 @@ public: const USGBuzzCommand* BuzzCommand, const USGThumperCommand* ThumperCommand); + /** + * Retrieve calibration values of this glove, as an array of size 5, containing x (roll), y (flexion), z (abduction) values. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Calibration Values", Category="SenseGlove | Core | Nova | Nova Glove") static bool GetCalibrationValues_OutV(UPARAM(ref) USGNovaGlove* NovaGlove, TArray& OutValues); + /** + * Applies the calibration range of this Nova a HandProfile. + */ UFUNCTION(BlueprintPure, DisplayName="Apply Calibration", Category="SenseGlove | Core | Nova | Nova Glove", meta=(WorldContext="WorldContextObject")) static void ApplyCalibration_USGHandProfile_OutP(UObject* WorldContextObject, const USGNovaGlove* NovaGlove, USGHandProfile*& OutProfile); + /** + * Applies the calibration range of this SenseGlove to a NovaGloveHandProfile. + */ UFUNCTION(BlueprintPure, DisplayName="Apply Calibration", Category="SenseGlove | Core | Nova | Nova Glove", meta=(WorldContext="WorldContextObject")) static void ApplyCalibration_USGNovaGloveHandProfile_OutP(UObject* WorldContextObject, const USGNovaGlove* NovaGlove, USGNovaGloveHandProfile*& OutProfile); + /** + * Retrieve the location of the glove origin, based on a reference location. + */ UFUNCTION(BlueprintPure, DisplayName="Get Glove Location", Category="SenseGlove | Core | Nova | Nova Glove") static void GetGloveLocation_RP_FQuat_RR_TH_OutGP_FQuat_OutGR( const USGNovaGlove* NovaGlove, @@ -230,6 +348,9 @@ public: ESGPositionalTrackingHardware TrackingHardware, FVector& OutGlovePosition, FQuat& OutGloveRotation); + /** + * Retrieve the location of the glove origin, based on a reference location. + */ UFUNCTION(BlueprintPure, DisplayName="Get Glove Location", Category="SenseGlove | Core | Nova | Nova Glove") static void GetGloveLocation_RP_FRotator_RR_TH_OutGP_FRotator_OutGR( const USGNovaGlove* NovaGlove, @@ -237,6 +358,9 @@ public: ESGPositionalTrackingHardware TrackingHardware, FVector& OutGlovePosition, FRotator& OutGloveRotation); + /** + * Retrieve the location of the wrist, based on a reference location and default glove-hand offsets. + */ UFUNCTION(BlueprintPure, DisplayName="Get Wrist Location", Category="SenseGlove | Core | Nova | Nova Glove") static void GetWristLocation_RP_FQuat_RR_TH_OutWP_FQuat_OutWR( const USGNovaGlove* NovaGlove, @@ -244,6 +368,9 @@ public: ESGPositionalTrackingHardware TrackingHardware, FVector& OutWristPosition, FQuat& OutWristRotation); + /** + * Retrieve the location of the wrist, based on a reference location and default glove-hand offsets. + */ UFUNCTION(BlueprintPure, DisplayName="Get Wrist Location", Category="SenseGlove | Core | Nova | Nova Glove") static void GetWristLocation_RP_FRotator_RR_TH_OutWP_FRotator_OutWR( const USGNovaGlove* NovaGlove, @@ -251,6 +378,9 @@ public: ESGPositionalTrackingHardware TrackingHardware, FVector& OutWristPosition, FRotator& OutWristRotation); + /** + * Create a string representation of this device for reporting purposes. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove") static FString ToString(const USGNovaGlove* NovaGlove); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveSensorDataKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveSensorDataKismetLibrary.h index 68534041..a69a9c1c 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveSensorDataKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGNovaGloveSensorDataKismetLibrary.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * Nova SensorData, parsed from rae string representations. */ @@ -42,70 +42,121 @@ class USGNovaGloveInfo; class USGNovaGloveSensorData; +/** + * Sensor Data coming from a Nova, converted into useful values. + */ UCLASS(meta=(ScriptName = "SesneGloveNovaGloveSensorDataKismetLibrary")) class SENSEGLOVECOREKISMET_API USGNovaGloveSensorDataKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * Default constructor for NovaGloveSensorData. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove Sensor Data", meta=(WorldContext="WorldContextObject")) static USGNovaGloveSensorData* MakeNovaGloveSensorData(UObject* WorldContextObject); + /** + * Create a new instance of a NovaGloveSensorData. + */ UFUNCTION(BlueprintCallable, DisplayName="Make Nova Glove Sensor Data", Category="SenseGlove | Core | Nova | Nova Glove Sensor Data", meta=(WorldContext="WorldContextObject")) static USGNovaGloveSensorData* MakeNovaGloveSensorData_V_PV_FQuat_IR_bIP_BL_bC( UObject* WorldContextObject, const TArray& Values, int32 ParsedValues, const FQuat& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging); + /** + * Create a new instance of a NovaGloveSensorData. + */ UFUNCTION(BlueprintCallable, DisplayName="Make Nova Glove Sensor Data", Category="SenseGlove | Core | Nova | Nova Glove Sensor Data", meta=(WorldContext="WorldContextObject")) static USGNovaGloveSensorData* MakeNovaGloveSensorData_V_PV_FRotator_IR_bIP_BL_b( UObject* WorldContextObject, const TArray& Values, int32 ParsedValues, const FRotator& ImuRotation, bool bImuParsed, float BatteryLevel, bool bCharging); + /** + * Returns a NovaGloveSensorData without any values. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove Sensor Data", meta=(WorldContext="WorldContextObject")) static USGNovaGloveSensorData* Empty(UObject* WorldContextObject); + /** + * Parse the bytes as they come in from the device into useable values. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove Sensor Data", meta=(WorldContext="WorldContextObject")) static USGNovaGloveSensorData* Parse(UObject* WorldContextObject, const FString& RawData, const USGNovaGloveInfo* GloveInfo); + /** + * Convert this sensor data into ta string representation. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove Sensor Data", meta=(WorldContext="WorldContextObject")) static USGNovaGloveSensorData* Deserialize(UObject* WorldContextObject, const FString& SerializedString); + /** + * Pronation/Supination, Flexion/Extension and Abduction/Adduction values for each finger. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Sensor Data") static TArray GetSensorValues(const USGNovaGloveSensorData* NovaGloveSensorData); + /** + * Quaternion rotation relative to magnetic north. + */ UFUNCTION(BlueprintPure, DisplayName="Get Imu Rotation", Category="SenseGlove | Core | Nova | Nova Glove Sensor Data") static FQuat GetImuRotation_FQuat(const USGNovaGloveSensorData* NovaGloveSensorData); + /** + * Rotation relative to magnetic north. + */ UFUNCTION(BlueprintPure, DisplayName="Get Imu Rotation", Category="SenseGlove | Core | Nova | Nova Glove Sensor Data") static FRotator GetImuRotation_FRotator(const USGNovaGloveSensorData* NovaGloveSensorData); + /** + * The number of values that were parsed from the sensor string. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Sensor Data") static int32 GetParsedValues(const USGNovaGloveSensorData* NovaGloveSensorData); + /** + * Whether the IMU values were all successfully parsed, or not. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Sensor Data") static bool IsImuParsed(const USGNovaGloveSensorData* NovaGloveSensorData); + /** + * A value between 0..1 that represents the battery level of this Nova Glove (0 .. 100%). Returns -1 if the value wasn't received. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Sensor Data") static float GetBatteryLevel(const USGNovaGloveSensorData* NovaGloveSensorData); + /** + * Returns true if this NovaGlove is connected to a power source + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Sensor Data") static bool IsCharging(const USGNovaGloveSensorData* NovaGloveSensorData); + /** + * Returns true if this sensor data contains the same values as another. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Sensor Data") static bool Equals(const USGNovaGloveSensorData* A, const USGNovaGloveSensorData* B); + /** + * Create a readable string representation of this Sensor Data + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Sensor Data") static FString ToString(const USGNovaGloveSensorData* NovaGloveSensorData); + /** + * Convert this sensor data into a string so it can be stored on disk. + */ UFUNCTION(BlueprintPure, DisplayName="Serialize", Category="SenseGlove | Core | Nova | Nova Glove Sensor Data") static FString SGSerialize(const USGNovaGloveSensorData* NovaGloveSensorData); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseComKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseComKismetLibrary.h index bae59052..4b086d3d 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseComKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseComKismetLibrary.h @@ -43,27 +43,48 @@ #include "SGSenseComKismetLibrary.generated.h" +/** + * + */ UCLASS(meta=(ScriptName = "SesneGloveSenseComKismetLibrary")) class SENSEGLOVECOREKISMET_API USGSenseComKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * Registers current process as the latest SenseCom build. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SenseCom") static bool RegisterExe(); + /** + * Register a particular path as the SenseGlove executable location. + */ UFUNCTION(BlueprintCallable, DisplayName="Register Exe", Category="SenseGlove | Core | SenseCom") static bool RegisterExe_EP(const FString& ExePath); + /** + * Retrieve the location of SenseGlove executable. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SenseCom") static bool GetExePath(FString& OutExePath); + /** + * Returns true if SenseCom scanning is active. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SenseCom") static bool ScanningActive(); + /** + * Returns the directory of the current process. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SenseCom") static bool GetCurrentExeDirectory(FString& OutDirectory); + /** + * Force-starts the SenseCom application if it is active on the system. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SenseCom") static bool StartupSenseCom(); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveHandProfileKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveHandProfileKismetLibrary.h index d9b6e4cc..de63e2d0 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveHandProfileKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveHandProfileKismetLibrary.h @@ -29,7 +29,8 @@ * * @section DESCRIPTION * - * + * Input for Sense Glove kinematics to calculate a HandPose. + * Output of calibration algorithms. */ @@ -43,56 +44,98 @@ class USGHandInterpolator; class USGSenseGloveHandProfile; +/** + * Contains everything a Sense Glove needs to calculate a HandPose. + */ UCLASS(meta=(ScriptName = "SesneGloveSenseGloveHandProfileKismetLibrary")) class SENSEGLOVECOREKISMET_API USGSenseGloveHandProfileKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * The basic constructor. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Hand Profile", meta=(WorldContext="WorldContextObject")) static USGSenseGloveHandProfile* MakeSenseGloveHandProfile(UObject* WorldContextObject); + /** + * Create a new Hand Profile for the Sense Glove. + */ UFUNCTION(BlueprintCallable, DisplayName="Make Sense Glove Hand Profile", Category="SenseGlove | Core | SG | Sense Glove Hand Profile", meta=(WorldContext="WorldContextObject")) static USGSenseGloveHandProfile* MakeSenseGloveHandProfile_bRH_I_TS_FS_FTO( UObject* WorldContextObject, bool bRightHanded, const USGHandInterpolator* Interpolator, ESGThumbSolver ThumbSolver, ESGFingerSolver FingerSolver, const TArray& FingerThimbleOffset); + /** + * Retrieve a 'new' profile, for either a left or right hand. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Hand Profile", meta=(WorldContext="WorldContextObject")) static USGSenseGloveHandProfile* Default(UObject* WorldContextObject, bool bRightHanded); + /** + * Deserialize a HandProfile back into usable values. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Hand Profile", meta=(WorldContext="WorldContextObject")) static USGSenseGloveHandProfile* Deserialize(UObject* WorldContextObject, const FString& SerializedString); + /** + * Default offset from thimble to fingertip. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Hand Profile") static FVector GetDefaultThimbleOffset(); + /** + * Check whether this profile has been created for a right hand (true) or left hand (false). + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Hand Profile") static bool IsRight(const USGSenseGloveHandProfile* SenseGloveHandProfile); + /** + * Interpolation set to estimate joint angles. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Hand Profile", meta=(WorldContext="WorldContextObject")) static USGHandInterpolator* GetInterpolationSet(UObject* WorldContextObject, const USGSenseGloveHandProfile* SenseGloveHandProfile); + /** + * Solver property that determines _how_ HandPoses are calculated. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Hand Profile") static ESGThumbSolver GetThumbSolver(const USGSenseGloveHandProfile* SenseGloveHandProfile); + /** + * Solver property that determines _how_ finger poses are calculated. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Hand Profile") static ESGFingerSolver GetFingerSolver(const USGSenseGloveHandProfile* SenseGloveHandProfile); + /** + * Offset from thimble to fingertip, used for Inverse Kinematics. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Hand Profile") static TArray GetFingerThimbleOffset(const USGSenseGloveHandProfile* SenseGloveHandProfile); + /** + * + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Hand Profile") static bool Equals(const USGSenseGloveHandProfile* A, const USGSenseGloveHandProfile* B); + /** + * Reset calibration on this profile. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Hand Profile") static void Reset(UPARAM(ref) USGSenseGloveHandProfile* SenseGloveHandProfile); + /** + * Serialize this HandProfile into a string representation. + */ UFUNCTION(BlueprintPure, DisplayName="Serialize", Category="SenseGlove | Core | SG | Sense Glove Hand Profile") static FString SGSerialize(const USGSenseGloveHandProfile* SenseGloveHandProfile); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveInfoKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveInfoKismetLibrary.h index 50459e2e..14a5dae5 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveInfoKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveInfoKismetLibrary.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * Glove information taken from the Sense Glove. */ @@ -44,16 +44,25 @@ class USGSenseGloveInfo; +/** + * Glove Information taken from a SenseGlove. Contains everything from unique ID, firmware version, etc. + */ UCLASS(meta=(ScriptName = "SesneGloveSenseGloveInfoKismetLibrary")) class SENSEGLOVECOREKISMET_API USGSenseGloveInfoKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * The default constructor. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Info", meta=(WorldContext="WorldContextObject")) static USGSenseGloveInfo* MakeSenseGloveInfo(UObject* WorldContextObject); + /** + * Create a new Sense Glove device model. + */ UFUNCTION(BlueprintCallable, DisplayName="Make Sense Glove Info", Category="SenseGlove | Core | SG | Sense Glove Info", meta=(WorldContext="WorldContextObject")) static USGSenseGloveInfo* MakeSenseGloveInfo_DI_HV_FV_SFV_bRH_NOS_FQuat_IC_SP_TArrayFQuat_SR_GL_F( @@ -63,6 +72,9 @@ public: const TArray& StartPositions, const TArray& StartRotations, const TArray& GloveLengths, const TArray& Functions); + /** + * Create a new Sense Glove device model. + */ UFUNCTION(BlueprintCallable, DisplayName="Make Sense Glove Info", Category="SenseGlove | Core | SG | Sense Glove Info", meta=(WorldContext="WorldContextObject")) static USGSenseGloveInfo* MakeSenseGloveInfo_DI_HV_FV_SFV_bRH_NOS_FRotator_IC_SP_TArrayFRotator_SR_GL_F( @@ -72,80 +84,152 @@ public: const TArray& StartPositions, const TArray& StartRotations, const TArray& GloveLengths, const TArray& Functions); + /** + * Create an instance of the SGModel from its string representation. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Info", meta=(WorldContext="WorldContextObject")) static bool Parse(UObject* WorldContextObject, const FString& ConstantsString, USGSenseGloveInfo*& OutGloveInfo, bool bUpdateOldModels = true); + /** + * Deserialize a HandProfile back into usable values. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Info", meta=(WorldContext="WorldContextObject")) static USGSenseGloveInfo* Deserialize(UObject* WorldContextObject, const FString& SerializedString); + /** + * Unique identifier of this device. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") static FString GetDeviceId(const USGSenseGloveInfo* SenseGloveInfo); + /** + * Hardware (sub) version of this Sense Glove Device. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") static FString GetHardwareVersion(const USGSenseGloveInfo* SenseGloveInfo); + /** + * Firmware version running on the device's MicroController. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") static int32 GetFirmwareVersion(const USGSenseGloveInfo* SenseGloveInfo); + /** + * Sub-Firmware version running on the device's MicroController. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") static int32 GetSubFirmwareVersion(const USGSenseGloveInfo* SenseGloveInfo); + /** + * Check if this Sense Glove belongs to a left or right hand. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") static bool IsRight(const USGSenseGloveInfo* SenseGloveInfo); + /** + * The number of Sensors in this SenseGlove. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") static int32 GetNumberOfSensors(const USGSenseGloveInfo* SenseGloveInfo); + /** + * The IMU correction of this Sense Glove. + */ UFUNCTION(BlueprintPure, DisplayName="Get Imu Correction", Category="SenseGlove | Core | SG | Sense Glove Info") static FQuat GetImuCorrection_FQuat(const USGSenseGloveInfo* SenseGloveInfo); + /** + * The IMU correction of this Sense Glove. + */ UFUNCTION(BlueprintPure, DisplayName="Get Imu Correction", Category="SenseGlove | Core | SG | Sense Glove Info") static FRotator GetImuCorrection_FRotator(const USGSenseGloveInfo* SenseGloveInfo); + /** + * The starting positions of each Sense Glove finger, relative to the glove origin. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") static TArray GetStartPositions(const USGSenseGloveInfo* SenseGloveInfo); + /** + * The starting rotations of each Sense Glove finger, relative to the glove origin. + */ UFUNCTION(BlueprintPure, DisplayName="Get Start Rotations", Category="SenseGlove | Core | SG | Sense Glove Info") static TArray GetStartRotations_TArrayFQuat(const USGSenseGloveInfo* SenseGloveInfo); + /** + * The starting rotations of each Sense Glove finger, relative to the glove origin. + */ UFUNCTION(BlueprintPure, DisplayName="Get Start Rotations", Category="SenseGlove | Core | SG | Sense Glove Info") static TArray GetStartRotations_TArrayFRotator(const USGSenseGloveInfo* SenseGloveInfo); + /** + * The lengths of each Sense Glove finger section, in cm. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") static TArray GetGloveLengths(const USGSenseGloveInfo* SenseGloveInfo); + /** + * Whether this device has a specific function (T/F). + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") static TArray GetFunctions(const USGSenseGloveInfo* SenseGloveInfo); + /** + * The starting position of one Sense Glove finger, relative to the glove origin. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") static FVector GetStartPosition(const USGSenseGloveInfo* SenseGloveInfo, ESGFinger Finger); + /** + * The starting rotation of one Sense Glove finger, relative to the glove origin. + */ UFUNCTION(BlueprintPure, DisplayName="Get Start Rotation", Category="SenseGlove | Core | SG | Sense Glove Info") static FQuat GetStartRotation_FQuat(const USGSenseGloveInfo* SenseGloveInfo, ESGFinger Finger); + /** + * The starting rotation of one Sense Glove finger, relative to the glove origin. + */ UFUNCTION(BlueprintPure, DisplayName="Get Start Rotation", Category="SenseGlove | Core | SG | Sense Glove Info") static FRotator GetStartRotation_FRotator(const USGSenseGloveInfo* SenseGloveInfo, ESGFinger Finger); + /** + * The lengths of one Sense Glove finger's sections, in cm. + */ UFUNCTION(BlueprintPure, DisplayName="Get Glove Lengths", Category="SenseGlove | Core | SG | Sense Glove Info") static TArray GetGloveLengths_F(const USGSenseGloveInfo* SenseGloveInfo, ESGFinger Finger); + /** + * Place incoming sensor data into the right format, according to this glove's model. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") static TArray ToGloveAngles(const USGSenseGloveInfo* SenseGloveInfo, const TArray& SensorAngles); + /** + * Returns true if this SG_Model has the same values as another. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") static bool Equals(const USGSenseGloveInfo* A, const USGSenseGloveInfo* B); + /** + * Create a string representation for logging. If shortNotation is false, all values are reported. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Info") static FString ToString(const USGSenseGloveInfo* SenseGloveInfo); + /** + * Create a string representation for fast logging. + */ UFUNCTION(BlueprintPure, DisplayName="To String", Category="SenseGlove | Core | SG | Sense Glove Info") static FString ToString_bSN(const USGSenseGloveInfo* SenseGloveInfo, bool bShortNotation); + /** + * Serialize this HandProfile into a string representation. + */ UFUNCTION(BlueprintPure, DisplayName="Serialize", Category="SenseGlove | Core | SG | Sense Glove Info") static FString SGSerialize(const USGSenseGloveInfo* SenseGloveInfo); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGlovePoseKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGlovePoseKismetLibrary.h index e3b433fe..9266a8bf 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGlovePoseKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGlovePoseKismetLibrary.h @@ -29,7 +29,8 @@ * * @section DESCRIPTION * - * + * Contains position and rotation data of a SenseGlove's exoskeleton, along + * with accessors for relevant variables. */ @@ -46,16 +47,25 @@ class USGSenseGloveHandProfile; class USGSenseGloveInfo; class USGSenseGlovePose; +/** + * Represents a pose of a Sense Glove exoskeleton. + */ UCLASS(meta=(ScriptName = "SesneGloveSenseGlovePoseKismetLibrary")) class SENSEGLOVECOREKISMET_API USGSenseGlovePoseKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * The basic constructor. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Pose", meta=(WorldContext="WorldContextObject")) static USGSenseGlovePose* MakeSenseGlovePose(UObject* WorldContextObject); + /** + * Creates a new instance of a SenseGlovePose. + */ UFUNCTION(BlueprintCallable, DisplayName="Make Sense Glove Pose", Category="SenseGlove | Core | SG | Sense Glove Pose", meta=(WorldContext="WorldContextObject")) static USGSenseGlovePose* MakeSenseGlovePose_bRH_JP_TArrayFSGQuatArray_JR_GA( @@ -64,6 +74,9 @@ public: const TArray& JointRotations, const TArray& GloveAngles); + /** + * Creates a new instance of a SenseGlovePose. + */ UFUNCTION(BlueprintCallable, DisplayName="Make Sense Glove Pose", Category="SenseGlove | Core | SG | Sense Glove Pose", meta=(WorldContext="WorldContextObject")) static USGSenseGlovePose* MakeSenseGlovePose_bRH_JP_TArrayFSGRotatorArray_JR_GA( @@ -72,56 +85,106 @@ public: const TArray& JointRotations, const TArray& GloveAngles); + /** + * Returns an idle pose for the Sense Glove if no data can be found. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Pose", meta=(WorldContext="WorldContextObject")) static USGSenseGlovePose* IdlePose(UObject* WorldContextObject, const USGSenseGloveInfo* GloveInfo); + /** + * Deserialize a GlovePose back into usable values. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Pose", meta=(WorldContext="WorldContextObject")) static USGSenseGlovePose* Deserialize(UObject* WorldContextObject, const FString& SerializedString); + /** + * Whether this Glove Pose was created for be a right- or left hand, or not. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Pose") static bool IsRight(const USGSenseGlovePose* SenseGlovePose); + /** + * Positions of each glove joint, relative to the Glove's Origin. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Pose") static TArray GetJointPositions(const USGSenseGlovePose* SenseGlovePose); + /** + * Quaternion rotation of each glove joint, relative to the Glove Origin. + */ UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotations", Category="SenseGlove | Core | SG | Sense Glove Pose") static TArray GetJointRotations_TArrayFSGQuatArray(const USGSenseGlovePose* SenseGlovePose); + /** + * Rotation of each glove joint, relative to the Glove Origin. + */ UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotations", Category="SenseGlove | Core | SG | Sense Glove Pose") static TArray GetJointRotations_TArrayFSGRotatorArray(const USGSenseGlovePose* SenseGlovePose); + /** + * Glove joint angles in euler notation, relative to the last segment. + * + * @remarks Essentially sensor angles, though placed in their proper xyz notation. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Pose") static TArray GetGloveAngles(const USGSenseGlovePose* SenseGlovePose); + /** + * The position of the tip of the 'thimbles', the furthest link on each glove link. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Pose") static TArray GetThimblePositions(const USGSenseGlovePose* SenseGlovePose); + /** + * The (quaternion) rotation of the 'thimbles', the furthest link on each link. + */ UFUNCTION(BlueprintPure, DisplayName="Get Thimble Rotations", Category="SenseGlove | Core | SG | Sense Glove Pose") static TArray GetThimbleRotations_FQuat(const USGSenseGlovePose* SenseGlovePose); + /** + * The rotation of the 'thimbles', the furthest link on each link. + */ UFUNCTION(BlueprintPure, DisplayName="Get Thimble Rotations", Category="SenseGlove | Core | SG | Sense Glove Pose") static TArray GetThimbleRotations_FRotator(const USGSenseGlovePose* SenseGlovePose); + /** + * Sum of the Sensor angles in each (xyz) direction. "Total Pronation / Flexion / Abduction". + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Pose") static TArray GetTotalGloveAngles(const USGSenseGlovePose* SenseGlovePose); + /** + * Calculate fingertip positions based on a user profile. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Pose") static TArray CalculateFingerTips_SenseGloveHandProfileImpl( const USGSenseGlovePose* SenseGlovePose, const USGSenseGloveHandProfile* SenseGloveHandProfile); + /** + * Calculate fingertip positions, knowing the offset between thimble and fingertips. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Pose") static TArray CalculateFingerTips_FingerOffsets(const USGSenseGlovePose* SenseGlovePose, const TArray& FingerOffsets); + /** + * Returns true if this glove pose equals another. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Pose") static bool Equals(const USGSenseGlovePose* A, const USGSenseGlovePose* B); + /** + * Returns a user-friendly string representation of this GlovePose for reporting. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Pose") static FString ToString(const USGSenseGlovePose* SenseGlovePose, bool bShortFormat = false); + /** + * Serialize this GlovePose into a string representation. + */ UFUNCTION(BlueprintPure, DisplayName="Serialize", Category="SenseGlove | Core | SG | Sense Glove Pose") static FString SGSerialize(const USGSenseGlovePose* SenseGlovePose); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveSensorDataKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveSensorDataKismetLibrary.h index f5058462..821a45a4 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveSensorDataKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveSensorDataKismetLibrary.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * Parsed sensor data coming form a Sense Glove. */ @@ -44,71 +44,122 @@ class USGSenseGloveInfo; class USGSenseGloveSensorData; +/** + * Sense Glove Sensor Data, parsed from a sensor string. + */ UCLASS(meta=(ScriptName = "SesneGloveSenseGloveSensorDataKismetLibrary")) class SENSEGLOVECOREKISMET_API USGSenseGloveSensorDataKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * The basic constructor. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Sensor Data", meta=(WorldContext="WorldContextObject")) static USGSenseGloveSensorData* MakeSenseGloveSensorData(UObject* WorldContextObject); + /** + * Create a new instance of a Sense Glove Sensor Data class. + */ UFUNCTION(BlueprintCallable, DisplayName="Make Sense Glove Sensor Data", Category="SenseGlove | Core | SG | Sense Glove Sensor Data", meta=(WorldContext="WorldContextObject")) static USGSenseGloveSensorData* MakeSenseGloveSensorData_SA_FQuatImuRotation_PV_bIP( UObject* WorldContextObject, const TArray& SensorAngles, const FQuat& ImuRotation, int32 ParsedValues, bool bImuParsed); + /** + * Create a new instance of a Sense Glove Sensor Data class. + */ UFUNCTION(BlueprintCallable, DisplayName="Make Sense Glove Sensor Data", Category="SenseGlove | Core | SG | Sense Glove Sensor Data", meta=(WorldContext="WorldContextObject")) static USGSenseGloveSensorData* MakeSenseGloveSensorData_SA_FRotatorImuRotation_PV_bIP( UObject* WorldContextObject, const TArray& SensorAngles, const FRotator& ImuRotation, int32 ParsedValues, bool bImuParsed); + /** + * Returns sensor data with no values. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Sensor Data", meta=(WorldContext="WorldContextObject")) static USGSenseGloveSensorData* Empty(UObject* WorldContextObject); + /** + * Deserialize Sense Glove sensor data from a raw char[] received through IPC. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Sensor Data", meta=(WorldContext="WorldContextObject")) static USGSenseGloveSensorData* Parse(UObject* WorldContextObject, const FString& RawData, const USGSenseGloveInfo* GloveInfo); + /** + * Deserialize a HandProfile back into useable values. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Sensor Data", meta=(WorldContext="WorldContextObject")) static USGSenseGloveSensorData* Deserialize(UObject* WorldContextObject, const FString& SerializedString); + /** + * Glove angles in radians, sorted by finger, from proximal to distal. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Sensor Data") static TArray GetSensorAngles(const USGSenseGloveSensorData* SenseGloveSensorData); + /** + * + */ UFUNCTION(BlueprintPure, DisplayName="Get Imu Rotation", Category="SenseGlove | Core | SG | Sense Glove Sensor Data") static FQuat GetImuRotation_FQuat(const USGSenseGloveSensorData* SenseGloveSensorData); + /** + * + */ UFUNCTION(BlueprintPure, DisplayName="Get Imu Rotation", Category="SenseGlove | Core | SG | Sense Glove Sensor Data") static FRotator GetImuRotation_FRotator(const USGSenseGloveSensorData* SenseGloveSensorData); + /** + * Check how many values have been parsed from the Sensor String. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Sensor Data") static int32 GetParsedValues(const USGSenseGloveSensorData* SenseGloveSensorData); + /** + * Check if the IMU was properly parsed. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Sensor Data") static bool IsImuParsed(const USGSenseGloveSensorData* SenseGloveSensorData); + /** + * Get the glove angles of a specific finger segment. + */ UFUNCTION(BlueprintPure, DisplayName="Get Sensor Angles", Category="SenseGlove | Core | SG | Sense Glove Sensor Data") static TArray GetSensorAngles_F(const USGSenseGloveSensorData* SenseGloveSensorData, ESGFinger Finger); + /** + * Returns all glove angles in a sequence, without splitting them per finger. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Sensor Data") static TArray GetAngleSequence(const USGSenseGloveSensorData* SenseGloveSensorData); + /** + * Returns true if the values of both data are equal. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Sensor Data") static bool Equals(const USGSenseGloveSensorData* A, const USGSenseGloveSensorData* B); + /** + * Retrieve a simple representation of this sensor data for debugging purposes. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SG | Sense Glove Sensor Data") static FString ToString(const USGSenseGloveSensorData* SenseGloveSensorData); + /** + * Serialize this HandProfile into a string representation. + */ UFUNCTION(BlueprintPure, DisplayName="Serialize", Category="SenseGlove | Core | SG | Sense Glove Sensor Data") static FString SGSerialize(const USGSenseGloveSensorData* SenseGloveSensorData); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveVarsKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveVarsKismetLibrary.h index ebf0ecf2..b2dd8b49 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveVarsKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSenseGloveVarsKismetLibrary.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * Contains enumerators and classes to aid in Sense Glove Deserialization. */ @@ -48,56 +48,97 @@ class USGSenseGloveInfo; +/** + * "Database" class containing Sense Glove internal variables. + */ UCLASS(meta=(ScriptName = "SesneGloveVarsKismetLibrary")) class SENSEGLOVECOREKISMET_API USGSenseGloveVarsKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * Retrieve a basic ConstantsString for a Sense Glove of a specific Hardware Version. Used for debugging / unit tests. + * + * @returns Returns an empty string when an invalid glove version is requested. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Vars") static FString GetStandardConstantsString(const FString& HardwareVersion, float FirmwareVersion, bool bRightHanded); + /** + * Retrieve an example sensor string of a Sense Glove with a particular hardware- and firmware version. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Vars") static FString GetSensorString(const FString& HardwareVersion, float FirmwareVersion); + /** + * Retrieve the starting positions of a particular Sense Glove. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Vars") static TArray GetStartPositions(const FString& HardwareVersion, bool bRightHanded); + /** + * Retrieve the starting rotations of a particular Sense Glove. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Start Rotations", Category="SenseGlove | Core | SG | Sense Glove Vars") static TArray GetStartRotations_TArrayFQuat(const FString& HardwareVersion, bool bRightHanded); + /** + * Retrieve the starting rotations of a particular Sense Glove. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Start Rotations", Category="SenseGlove | Core | SG | Sense Glove Vars") static TArray GetStartRotations_TArrayFRotator(const FString& HardwareVersion, bool bRightHanded); + /** + * Retrieve the glove finger lengths of a particular Sense Glove. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Vars") static TArray GetGloveLengths(const FString& HardwareVersion); + /** + * Get the number of sensors of a SenseGlove. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Vars") static int32 GetSensors(const FString& HardwareVersion); + /** + * Get the default IMUCorrection for the SenseGlove. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Imu Correction", Category="SenseGlove | Core | SG | Sense Glove Vars") static FQuat GetImuCorrection_FQuat(const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion); + /** + * Get the default IMUCorrection for the SenseGlove. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Imu Correction", Category="SenseGlove | Core | SG | Sense Glove Vars") static FRotator GetImuCorrection_FRotator(const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion); + /** + * Check all functionality of a SenseGlove. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SG | Sense Glove Vars") static TArray GetFunctions(const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion); + /** + * Generate a custom glove info. + */ UFUNCTION(BlueprintCallable, DisplayName="GenerateGloveModel", Category="SenseGlove | Core | SG | Sense Glove Vars", meta=(WorldContext="WorldContextObject")) static USGSenseGloveInfo* GenerateGloveModel_HV_FV_SFV_bRH( UObject* WorldContextObject, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, bool bRightHanded); + /** + * Generate a custom glove info. + */ UFUNCTION(BlueprintCallable, DisplayName="GenerateGloveModel", Category="SenseGlove | Core | SG | Sense Glove Vars", meta=(WorldContext="WorldContextObject")) static USGSenseGloveInfo* GenerateGloveModel_HV_FV_SFV_bRH_CI( UObject* WorldContextObject, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, bool bRightHanded, const FString& CustomId); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSensorRangeKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSensorRangeKismetLibrary.h index a0288614..2d2e4b29 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSensorRangeKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGSensorRangeKismetLibrary.h @@ -41,62 +41,113 @@ class USGSensorRange; +/** + * + */ UCLASS(meta=(ScriptName = "SesneGloveSensorRangeKismetLibrary")) class SENSEGLOVECOREKISMET_API USGSensorRangeKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * Create a new instance of a SensorRange with values at 0, 0. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Sensor Range", meta=(WorldContext="WorldContextObject")) static USGSensorRange* MakeSensorRange(UObject* WorldContextObject); + /** + * Create a new SensorRange with predefined Min/Max values. + */ UFUNCTION(BlueprintCallable, DisplayName="Make Sensor Range", Category="SenseGlove | Core | Calibration | Sensor Range", meta=(WorldContext="WorldContextObject")) static USGSensorRange* MakeSensorRange_MV_MV( UObject* WorldContextObject, const TArray& MinValues, const TArray& MaxValues); + /** + * Generates a Sensor Range where minimum values are float.MaxValue and maximum values are float.MinValue. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Sensor Range", meta=(WorldContext="WorldContextObject")) static USGSensorRange* ForCalibration(UObject* WorldContextObject); + /** + * Convert a serialized SensorRange back into the appropriate class. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Sensor Range", meta=(WorldContext="WorldContextObject")) static USGSensorRange* Deserialize(UObject* WorldContextObject, const FString& SerializedString); + /** + * Evaluate maxValues so that it contains the highest x, y, and z values between currentValues and maxValues. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Sensor Range") static void CheckMax(const FVector CurrentValues, FVector& OutMaxValues); + /** + * Evaluate minValues so that it contains the lowest x, y, and z values between currentValues and minValues. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Sensor Range") static void CheckMin(const FVector& CurrentValues, FVector& OutMinValues); + /** + * Access the lowest values values of this range. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Sensor Range") static TArray GetMinValues(const USGSensorRange* SensorRange); + /** + * Set the lowest values values of this range. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Sensor Range") static void SetMinValues(UPARAM(ref) USGSensorRange* SensorRange, const TArray& Values); + /** + * Access the highest values values of this range. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Sensor Range") static TArray GetMaxValues(const USGSensorRange* SensorRange); + /** + * Set the highest values values of this range. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Sensor Range") static void SetMaxValues(UPARAM(ref) USGSensorRange* SensorRange, const TArray& Values); + /** + * Access the difference between min and max values. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Sensor Range") static TArray GetRange(const USGSensorRange* SensorRange); + /** + * Update the Range based on the current MinValues and MaxValues. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Sensor Range") static void UpdateRange(UPARAM(ref) USGSensorRange* SensorRange); + /** + * In otherValues are greater/smaller than this current range, update them. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Sensor Range") static void CheckForExtremes(UPARAM(ref) USGSensorRange* SensorRange, const TArray& OtherValues); + /** + * Report the Range value of this SensorRange, separated by a comma. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Sensor Range") static FString RangeString(const USGSensorRange* SensorRange, bool bYOnly = true); + /** + * Convert this SensorRange into a string rotation [min ... max]. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Sensor Range") static FString ToString(const USGSensorRange* SensorRange, bool bYOnly = true); + /** + * Serialize this SensorRange into a string representation, that can be deserialized later. + */ UFUNCTION(BlueprintPure, DisplayName="Serialize", Category="SenseGlove | Core | Calibration | Sensor Range") static FString SGSerialize(const USGSensorRange* SensorRange); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGThumperCommandKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGThumperCommandKismetLibrary.h index 39277b0a..942f7bd2 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGThumperCommandKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGThumperCommandKismetLibrary.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * Thumper command. */ @@ -41,39 +41,66 @@ class USGThumperCommand; +/** + * + */ UCLASS(meta=(ScriptName = "SesneGloveThumperCommandKismetLibrary")) class SENSEGLOVECOREKISMET_API USGThumperCommandKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * Empty constructor for inheritance. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Thumper Command", meta=(WorldContext="WorldContextObject")) static USGThumperCommand* MakeThumperCommand(UObject* WorldContextObject); + /** + * Create a new Thumper Command. + */ UFUNCTION(BlueprintCallable, DisplayName="Make Thumper Command", Category="SenseGlove | Core | Haptics | Thumper Command", meta=(WorldContext="WorldContextObject")) static USGThumperCommand* MakeThumperCommand_M(UObject* WorldContextObject, int32 Magnitude); + /** + * A command that turns off all force feedback on the Sense Glove. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Thumper Command", meta=(WorldContext="WorldContextObject")) static USGThumperCommand* Off(UObject* WorldContextObject); + /** + * Thumper intensity, a level between 0 and 100. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Thumper Command") static int32 GetMagnitude(const USGThumperCommand* ThumperCommand); + /** + * + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Thumper Command") static void SetMagnitude(USGThumperCommand* ThumperCommand, int32 Magnitude); + /** + * Duplicate the Thumper command. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Thumper Command", meta=(WorldContext="WorldContextObject")) static USGThumperCommand* Copy(UObject* WorldContextObject, const USGThumperCommand* ThumperCommand); + /** + * Merge two ThumperCommands into one. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Thumper Command", meta=(WorldContext="WorldContextObject")) static USGThumperCommand* Merge(UObject* WorldContextObject, const USGThumperCommand* A, const USGThumperCommand* B); + /** + * + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Thumper Command") static bool Equals(const USGThumperCommand* A, const USGThumperCommand* B); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGTimedBuzzCommandKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGTimedBuzzCommandKismetLibrary.h index e8dd861f..37f6f0cd 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGTimedBuzzCommandKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGTimedBuzzCommandKismetLibrary.h @@ -29,7 +29,7 @@ * * @section DESCRIPTION * - * + * Buzz Motor with timing parameters. */ @@ -43,62 +43,111 @@ class USGBuzzCommand; class USGTimedBuzzCommand; +/** + * Buzz motor commands that is meant to stop after a few milliseconds. + * + * @remarks Intended use; this.levels indicates the actual command. + */ UCLASS(meta=(ScriptName = "SesneGloveTimedBuzzCommandKismetLibrary")) class SENSEGLOVECOREKISMET_API USGTimedBuzzCommandKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * Empty constructor for inheritance. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Timed Buzz Command", meta=(WorldContext="WorldContextObject")) static USGTimedBuzzCommand* MakeTimedBuzzCommand(UObject* WorldContextObject); + /** + * Create a new TimeBuzzCommand for a single finger. + */ UFUNCTION(BlueprintPure, DisplayName="Make Timed Buzz Command", Category="SenseGlove | Core | Haptics | Timed Buzz Command", meta=(WorldContext="WorldContextObject")) static USGTimedBuzzCommand* MakeTimedBuzzCommand_F_M_DS_STS( UObject* WorldContextObject, ESGFinger Finger, int32 Magnitude, float DurationSeconds, float StartTimeSeconds = 0.0f); + /** + * Create a new buzz motor command that expires after timing_ms. + */ UFUNCTION(BlueprintPure, DisplayName="Make Timed Buzz Command", Category="SenseGlove | Core | Haptics | Timed Buzz Command", meta=(WorldContext="WorldContextObject")) static USGTimedBuzzCommand* MakeTimedBuzzCommand_BC_DS_STS( UObject* WorldContextObject, const USGBuzzCommand* BaseCommand, float DurationSeconds, float StartTimeSeconds = 0.0f); + /** + * Copy this Buzz Command's values into a new object. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Timed Buzz Command", meta=(WorldContext="WorldContextObject")) static USGBuzzCommand* Copy(UObject* WorldContextObject, const USGTimedBuzzCommand* TimedBuzzCommand); + /** + * Merges this base command with another command. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Timed Buzz Command", meta=(WorldContext="WorldContextObject")) static USGBuzzCommand* Merge(UObject* WorldContextObject, const USGTimedBuzzCommand* A, const USGBuzzCommand* B); + /** + * Access the base command, which indicates the buzz levels to keep untill time elapses. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Timed Buzz Command", meta=(WorldContext="WorldContextObject")) static USGBuzzCommand* GetBaseCommand(UObject* WorldContextObject, const USGTimedBuzzCommand* TimedBuzzCommand); + /** + * + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Timed Buzz Command") static int32 GetMagnitude(const USGTimedBuzzCommand* TimedBuzzCommand); + /** + * The total time [milliseconds] each buzz motor should be vibrating for. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Timed Buzz Command") static float GetDuration(const USGTimedBuzzCommand* TimedBuzzCommand); + /** + * The time elapsed since the command was sent [milliseconds]. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Timed Buzz Command") static float GetElapsedTime(const USGTimedBuzzCommand* TimedBuzzCommand); + /** + * Check if this timed command's timing has elapsed. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Timed Buzz Command") static bool HasTimeElapsed(const USGTimedBuzzCommand* TimedBuzzCommand); + /** + * Represents how far this effect is in its playtime; [0...1], where 0 means at the start, and 1 means at the end. + * + * @param bClamp01 Optional parameter; ensures this value is always between 0 and 1. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Timed Buzz Command") static float NormalizedTime(const USGTimedBuzzCommand* TimedBuzzCommand, bool bClamp01 = true); + /** + * Reset the timings of this BuzzCommand, allowing us to re-use it. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Timed Buzz Command") static void ResetTiming(UPARAM(ref) USGTimedBuzzCommand* TimedBuzzCommand); + /** + * Update the elapsed time to check if the buzz motors should stop. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Timed Buzz Command") static void UpdateTiming(UPARAM(ref) USGTimedBuzzCommand* TimedBuzzCommand, float DeltaSeconds); + /** + * + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Timed Buzz Command") static FString ToString(const USGTimedBuzzCommand* TimedBuzzCommand); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGTimedThumpCommandKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGTimedThumpCommandKismetLibrary.h index 7f2230ea..6b671d51 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGTimedThumpCommandKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGTimedThumpCommandKismetLibrary.h @@ -42,59 +42,104 @@ class USGThumperCommand; class USGTimedThumpCommand; +/** + * + */ UCLASS(meta=(ScriptName = "SesneGloveTimedThumpCommandKismetLibrary")) class SENSEGLOVECOREKISMET_API USGTimedThumpCommandKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * Internal, empty, for extended classes. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Timed Thump Command", meta=(WorldContext="WorldContextObject")) static USGTimedThumpCommand* MakeTimedThumpCommand(UObject* WorldContextObject); + /** + * Create a new Timed Thumper Command. + */ UFUNCTION(BlueprintCallable, DisplayName="Make Timed Thump Command", Category="SenseGlove | Core | Haptics | Timed Thump Command", meta=(WorldContext="WorldContextObject")) static USGTimedThumpCommand* MakeTimedThumpCommand_M_DS_STS( UObject* WorldContextObject, int32 Magnitude, float DurationSeconds, float StartTimeSeconds = 0.0f); + /** + * Create a new Timed Thumper Command. + */ UFUNCTION(BlueprintCallable, DisplayName="Make Timed Thump Command", Category="SenseGlove | Core | Haptics | Timed Thump Command", meta=(WorldContext="WorldContextObject")) static USGTimedThumpCommand* MakeTimedThumpCommand_BC_DS_STS( UObject* WorldContextObject, const USGThumperCommand* BaseCommand, float DurationSeconds, float StartTimeSeconds = 0.0f); + /** + * Magnitude in %. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Timed Thump Command") static int32 GetMagnitude(const USGTimedThumpCommand* TimedThumpCommand); + /** + * + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Timed Thump Command") static void SetMagnitude(UPARAM(ref) USGTimedThumpCommand* TimedThumpCommand, int32 Magnitude); + /** + * Duration in seconds. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Timed Thump Command") static float GetDuration(const USGTimedThumpCommand* TimedThumpCommand); + /** + * + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Timed Thump Command") static void SetDuration(UPARAM(ref) USGTimedThumpCommand* TimedThumpCommand, float Duration); + /** + * The elapsed time so far. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Timed Thump Command") static float GetElapsedTime(const USGTimedThumpCommand* TimedThumpCommand); + /** + * + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Timed Thump Command") static void SetElapsedTime(UPARAM(ref) USGTimedThumpCommand* TimedThumpCommand, float ElapsedTime); + /** + * Returns true if the timed command has elapsed. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Timed Thump Command") static bool HasTimeElapsed(const USGTimedThumpCommand* TimedThumpCommand); + /** + * Copy the parameters of this ThumperCommand into another instance. + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Timed Thump Command", meta=(WorldContext="WorldContextObject")) static USGTimedThumpCommand* Copy( UObject* WorldContextObject, const USGTimedThumpCommand* TimedThumpCommand, bool bCopyElapsed = false); + /** + * Update the timing on this Thumper Command. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Timed Thump Command") static void Update(UPARAM(ref) USGTimedThumpCommand* TimedThumpCommand, float DeltaSeconds); + /** + * + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Timed Thump Command") static bool Equals(const USGTimedThumpCommand* A, const USGTimedThumpCommand* B); + /** + * + */ UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Timed Thump Command") static FString ToString(const USGTimedThumpCommand* TimedThumpCommand); -}; \ No newline at end of file +}; diff --git a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGTrackingKismetLibrary.h b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGTrackingKismetLibrary.h index ab93d1eb..2c849e81 100644 --- a/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGTrackingKismetLibrary.h +++ b/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGTrackingKismetLibrary.h @@ -45,180 +45,314 @@ #include "SGTrackingKismetLibrary.generated.h" +/** + * + */ UCLASS(meta=(ScriptName = "SesneGloveTrackingKismetLibrary")) class SENSEGLOVECOREKISMET_API USGTrackingKismetLibrary final : public USGBlueprintFunctionLibrary { GENERATED_BODY() public: + /** + * Knowing a position & rotation in 3D space, calculate a relative location based on offsets. + */ UFUNCTION(BlueprintCallable, DisplayName="Calculate Location", Category="SenseGlove | Core | Tracking") static void CalculateLocation_TP_FQuat_TR_PO_FQuat_RO_OutNP_FQuat_OutNR( const FVector& TrackedPosition, const FQuat& TrackedRotation, const FVector& PositionOffset, const FQuat& RotationOffset, FVector& OutNewPosition, FQuat& OutNewRotation); + /** + * Knowing a position & rotation in 3D space, calculate a relative location based on offsets. + */ UFUNCTION(BlueprintCallable, DisplayName="Calculate Location", Category="SenseGlove | Core | Tracking") static void CalculateLocation_TP_FRotator_TR_PO_FRotator_RO_OutNP_FRotator_OutNR( const FVector& TrackedPosition, const FRotator& TrackedRotation, const FVector& PositionOffset, const FRotator& RotationOffset, FVector& OutNewPosition, FRotator& OutNewRotation); + /** + * Positional offset from each finger to the glove origin. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static TArray GetSenseGloveFingerToGlovePositionOrigin(); + /** + * + */ UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Finger To Glove Rotation Origin", Category="SenseGlove | Core | Tracking") static TArray GetSenseGloveFingerToGloveRotationOrigin_TArrayFQuat(); + /** + * + */ UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Finger To Glove Rotation Origin", Category="SenseGlove | Core | Tracking") static TArray GetSenseGloveFingerToGloveRotationOrigin_TArrayFRotator(); + /** + * Default position offset from glove origin to wrist location, in cm. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetSenseGloveWristPositionOffset(); + /** + * Default rotation offset from glove origin to wrist location. + */ UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Wrist Rotation Offset", Category="SenseGlove | Core | Tracking") static FQuat GetSenseGloveWristRotationOffset_FQuat(); + /** + * Default rotation offset from glove origin to wrist location. + */ UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Wrist Rotation Offset", Category="SenseGlove | Core | Tracking") static FRotator GetSenseGloveWristRotationOffset_FRotator(); + /** + * Get the position and rotation offsets to go from the glove origin to the mounted position. + * @remarks Based on CAD. needs to be inverted when going from tracker to glove origin. + */ UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Mount Offset", Category="SenseGlove | Core | Tracking") static void GetSenseGloveMountOffset_bRH_TF_OutIP_FQuat_OutIR( bool bRightHanded, ESGFinger ToFinger, FVector& OutIPosition, FQuat& OutIRotation); + /** + * Get the position and rotation offsets to go from the glove origin to the mounted position. + * @remarks Based on CAD. needs to be inverted when going from tracker to glove origin. + */ UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Mount Offset", Category="SenseGlove | Core | Tracking") static void GetSenseGloveMountOffset_bRH_TF_OutIP_FRotator_OutIR( bool bRightHanded, ESGFinger ToFinger, FVector& OutIPosition, FRotator& OutIRotation); + /** + * Get the offset to get from the TrackedHardware to a SenseGlove mounting location. Combined with Glove-Mount offset to get the glove location. + */ UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Tracker Mouunt Offset", Category="SenseGlove | Core | Tracking") static void GetSenseGloveTrackerMountOffset_H_bRH_OutPO_FQuat_OutRO( ESGPositionalTrackingHardware Hardware, bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset); + /** + * Get the offset to get from the TrackedHardware to a SenseGlove mounting location. Combined with Glove-Mount offset to get the glove location. + */ UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Tracker Mouunt Offset", Category="SenseGlove | Core | Tracking") static void GetSenseGloveTrackerMountOffset_H_bRH_OutPO_FRotator_OutRO( ESGPositionalTrackingHardware Hardware, bool bRightHanded, FVector& OutPositionOffset, FRotator& OutRotationOffset); + /** + * Vive Tracker origin to Finger rotational offset. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetSenseGloveViveToAttachPosition(); + /** + * Vive Tracker origin to Finger rotational offset. + */ UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Vive To Attach Rotation", Category="SenseGlove | Core | Tracking") static FQuat GetSenseGloveViveToAttachRotation_FQuat(); + /** + * Vive Tracker origin to Finger rotational offset. + */ UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Vive To Attach Rotation", Category="SenseGlove | Core | Tracking") static FRotator GetSenseGloveViveToAttachRotation_FRotator(); + /** + * Oculus Touch origin to Finger rotational offset. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetSenseGloveOculusTouchToAttachPosition(); + /** + * Oculus Touch origin to Finger rotational offset. + */ UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Oculus Touch To Attach Rotation", Category="SenseGlove | Core | Tracking") static FQuat GetSenseGloveOculusTouchToAttachRotation_FQuat(); + /** + * Oculus Touch origin to Finger rotational offset. + */ UFUNCTION(BlueprintCallable, DisplayName="Get SenseGlove Oculus Touch To Attach Rotation", Category="SenseGlove | Core | Tracking") static FRotator GetSenseGloveOculusTouchToAttachRotation_FRotator(); + /** + * Positional offset between Nova Glove Origin and Wrist. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetNovaToWristPositionOffset(); + /** + * Rotational offset between Nova Glove Origin and Wrist. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Nove To Wrist Rotation Offset", Category="SenseGlove | Core | Tracking") static FQuat GetNovaToWristRotationOffset_FQuat(); + /** + * Rotational offset between Nova Glove Origin and Wrist. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Nove To Wrist Rotation Offset", Category="SenseGlove | Core | Tracking") static FRotator GetNovaToWristRotationOffset_FRotator(); + /** + * Returns the Offsets that will bring us from the Nova origin to the wrist position. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Nova Glove Wrist Offset", Category="SenseGlove | Core | Tracking") static void GetNovaGloveWristOffset_bRH_OutPO_FQuat_OutRO( bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset); + /** + * Returns the Offsets that will bring us from the Nova origin to the wrist position. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Nova Glove Wrist Offset", Category="SenseGlove | Core | Tracking") static void GetNovaGloveWristOffset_bRH_OutPO_FRotator_OutRO( bool bRightHanded, FVector& OutPositionOffset, FRotator& OutRotationOffset); + /** + * + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetRightNovaViveToAttachPosition(); + /** + * + */ UFUNCTION(BlueprintCallable, DisplayName="Get Right Nova Vive To Attach Rotation", Category="SenseGlove | Core | Tracking") static FQuat GetRightNovaViveToAttachRotation_FQuat(); + /** + * + */ UFUNCTION(BlueprintCallable, DisplayName="Get Right Nova Vive To Attach Rotation", Category="SenseGlove | Core | Tracking") static FRotator GetRightNovaViveToAttachRotation_FRotator(); + /** + * + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetLeftNovaViveToAttachPosition(); + /** + * + */ UFUNCTION(BlueprintCallable, DisplayName="Get Left Nova Vive To Attach Rotation", Category="SenseGlove | Core | Tracking") static FQuat GetLeftNovaViveToAttachRotation_FQuat(); + /** + * + */ UFUNCTION(BlueprintCallable, DisplayName="Get Left Nova Vive To Attach Rotation", Category="SenseGlove | Core | Tracking") static FRotator GetLeftNovaViveToAttachRotation_FRotator(); + /** + * + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetRightNovaQuest2ToAttachPosition(); + /** + * + */ UFUNCTION(BlueprintCallable, DisplayName="Get Right Nova Quest 2 To Attach Rotation", Category="SenseGlove | Core | Tracking") static FQuat GetRightNovaQuest2ToAttachRotation_FQuat(); + /** + * + */ UFUNCTION(BlueprintCallable, DisplayName="Get Right Nova Quest 2 To Attach Rotation", Category="SenseGlove | Core | Tracking") static FRotator GetRightNovaQuest2ToAttachRotation_FRotator(); + /** + * + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetLeftNovaQuest2ToAttachPosition(); + /** + * + */ UFUNCTION(BlueprintCallable, DisplayName="Get Left Nova Quest 2 To Attach Rotation", Category="SenseGlove | Core | Tracking") static FQuat GetLeftNovaQuest2ToAttachRotation_FQuat(); + /** + * + */ UFUNCTION(BlueprintCallable, DisplayName="Get Left Nova Quest 2 To Attach Rotation", Category="SenseGlove | Core | Tracking") static FRotator GetLeftNovaQuest2ToAttachRotation_FRotator(); + /** + * @remarks Left is a mirror, so we only need R pos. + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FVector GetRightNovaPico2ToAttachPosition(); + /** + * + */ UFUNCTION(BlueprintCallable, DisplayName="Get Right Nova Pico 2 To Attach Rotation", Category="SenseGlove | Core | Tracking") static FQuat GetRightNovaPico2ToAttachRotation_FQuat(); + /** + * + */ UFUNCTION(BlueprintCallable, DisplayName="Get Right Nova Pico 2 To Attach Rotation", Category="SenseGlove | Core | Tracking") static FRotator GetRightNovaPico2ToAttachRotation_FRotator(); + /** + * + */ UFUNCTION(BlueprintCallable, DisplayName="Get Left Nova Pico 2 To Attach Rotation", Category="SenseGlove | Core | Tracking") static FQuat GetLeftNovaPico2ToAttachRotation_FQuat(); + /** + * + */ UFUNCTION(BlueprintCallable, DisplayName="Get Left Nova Pico 2 To Attach Rotation", Category="SenseGlove | Core | Tracking") static FRotator GetLeftNovaPico2ToAttachRotation_FRotator(); + /** + * Retrieves Offsets for a particular device. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Nova Glove Tracker Offset", Category="SenseGlove | Core | Tracking") static void GetNovaGloveTrackerOffset_H_bRH_OutPO_FQuat_OutRO( ESGPositionalTrackingHardware Hardware, bool bRightHanded, FVector& OutPositionOffset, FQuat& OutRotationOffset); + /** + * Retrieves Offsets for a particular device. + */ UFUNCTION(BlueprintCallable, DisplayName="Get Nova Glove Tracker Offset", Category="SenseGlove | Core | Tracking") static void GetNovaGloveTrackerOffset_H_bRH_OutPO_FRotator_OutRO( ESGPositionalTrackingHardware Hardware, bool bRightHanded, FVector& OutPositionOffset, FRotator& OutRotationOffset); + /** + * + */ UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Tracking") static FString ToString(ESGPositionalTrackingHardware Hardware); -}; \ No newline at end of file +};