add missing nova glove info rotator conversions to layer 3/4 of the api and also more documentation

This commit is contained in:
Mamadou Babaei
2022-11-18 12:11:48 +01:00
parent 9b0e662793
commit c68d8dc3e9
4 changed files with 129 additions and 9 deletions
@@ -240,7 +240,7 @@ bool USGNovaGloveInfo::IsRight() const
return SGCoreImpl_FSGNovaGloveInfoImpl_IsRight(&InstanceContainer); return SGCoreImpl_FSGNovaGloveInfoImpl_IsRight(&InstanceContainer);
} }
FQuat USGNovaGloveInfo::GetImuCorrection() const FQuat USGNovaGloveInfo::GetImuCorrectionQ() const
{ {
FSGIC_FSGNovaGloveInfoImpl InstanceContainer{ToNovaGloveInfoImpl()}; FSGIC_FSGNovaGloveInfoImpl InstanceContainer{ToNovaGloveInfoImpl()};
FSGIC_FQuat OutCorrectionContainer; FSGIC_FQuat OutCorrectionContainer;
@@ -248,6 +248,14 @@ FQuat USGNovaGloveInfo::GetImuCorrection() const
return MoveTemp(OutCorrectionContainer.Quat); return MoveTemp(OutCorrectionContainer.Quat);
} }
FRotator USGNovaGloveInfo::GetImuCorrection() const
{
FSGIC_FSGNovaGloveInfoImpl InstanceContainer{ToNovaGloveInfoImpl()};
FSGIC_FQuat OutCorrectionContainer;
SGCoreImpl_FSGNovaGloveInfoImpl_GetImuCorrection(&InstanceContainer, &OutCorrectionContainer);
return OutCorrectionContainer.Quat.Rotator();
}
int32 USGNovaGloveInfo::GetNumberOfSensors() const int32 USGNovaGloveInfo::GetNumberOfSensors() const
{ {
FSGIC_FSGNovaGloveInfoImpl InstanceContainer{ToNovaGloveInfoImpl()}; FSGIC_FSGNovaGloveInfoImpl InstanceContainer{ToNovaGloveInfoImpl()};
@@ -29,7 +29,7 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * Contains information on Nova's hardware, extracted from the device.
*/ */
@@ -49,6 +49,9 @@
class FSGNovaGloveInfoImpl; class FSGNovaGloveInfoImpl;
/**
* Device information extracted from a Nova Glove.
*/
UCLASS(BlueprintType) UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGNovaGloveInfo final : public UObject class SENSEGLOVECORE_API USGNovaGloveInfo final : public UObject
{ {
@@ -59,16 +62,28 @@ public:
UObject* Outer, const FSGNovaGloveInfoImpl& NovaGloveInfoImpl); UObject* Outer, const FSGNovaGloveInfoImpl& NovaGloveInfoImpl);
public: public:
/**
* The default constructor.
*/
static USGNovaGloveInfo* NewNovaGloveInfo(UObject* Outer); static USGNovaGloveInfo* NewNovaGloveInfo(UObject* Outer);
/**
* Create a new instance of a NovaGloveInfo.
*/
static USGNovaGloveInfo* NewNovaGloveInfo( static USGNovaGloveInfo* NewNovaGloveInfo(
UObject* Outer, UObject* Outer,
const FString& DeviceId, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, const FString& DeviceId, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion,
bool bRightHanded, const FQuat& ImuCorrection, int32 NumberOfSensors); bool bRightHanded, const FQuat& ImuCorrection, int32 NumberOfSensors);
public: public:
/**
* Parse an constants string into a NovaGloveInfo class.
*/
static bool Parse(UObject* Outer, const FString& ConstantsString, USGNovaGloveInfo*& OutGloveInfo); static bool Parse(UObject* Outer, const FString& ConstantsString, USGNovaGloveInfo*& OutGloveInfo);
/**
* Convert a string representation back into a NovaGloveInfo class.
*/
static USGNovaGloveInfo* Deserialize(UObject* Outer, const FString& SerializedString); static USGNovaGloveInfo* Deserialize(UObject* Outer, const FString& SerializedString);
private: private:
@@ -83,8 +98,14 @@ private:
FImplDeleter PimplDeleter; FImplDeleter PimplDeleter;
public: public:
/**
* The default constructor.
*/
USGNovaGloveInfo(); USGNovaGloveInfo();
/**
* Create a new instance of a NovaGloveInfo.
*/
USGNovaGloveInfo(const FString& DeviceId, USGNovaGloveInfo(const FString& DeviceId,
const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion,
bool bRightHanded, const FQuat& ImuCorrection, int32 NumberOfSensors); bool bRightHanded, const FQuat& ImuCorrection, int32 NumberOfSensors);
@@ -120,25 +141,60 @@ protected:
FSGNovaGloveInfoImpl& ToNovaGloveInfoImpl(); FSGNovaGloveInfoImpl& ToNovaGloveInfoImpl();
public: public:
/**
* Unique identifier of this device.
*/
FString GetDeviceId() const; FString GetDeviceId() const;
/**
* Hardware (sub) version of this Sense Glove Device.
*/
FString GetHardwareVersion() const; FString GetHardwareVersion() const;
/**
* Firmware version running on the device's MicroController. (as v4.12, this is the 4).
*/
int32 GetFirmwareVersion() const; int32 GetFirmwareVersion() const;
/**
* Sub firmware version running on the device's microcontroller (as v4.12, this is the .12).
*/
int32 GetSubFirmwareVersion() const; int32 GetSubFirmwareVersion() const;
/**
* Determines if this is a right-handed Nova.
*/
bool IsRight() const; bool IsRight() const;
FQuat GetImuCorrection() const; /**
* The IMU correction of this Nova.
*/
FQuat GetImuCorrectionQ() const;
/**
* The IMU correction of this Nova.
*/
FRotator GetImuCorrection() const;
/**
* The number of sensors in this device.
*/
int32 GetNumberOfSensors() const; int32 GetNumberOfSensors() const;
public: public:
/**
* Returns true if this GloveInfo contains the same information as another.
*/
bool Equals(const USGNovaGloveInfo* NovaGloveInfo) const; bool Equals(const USGNovaGloveInfo* NovaGloveInfo) const;
public: public:
/**
* Create a string representation of this Glove Info.
*/
FString ToString() const; FString ToString() const;
/**
* Convert this class into a string representation so it can be unpacked later.
*/
FString SGSerialize() const; FString SGSerialize() const;
}; };
@@ -90,7 +90,12 @@ bool USGNovaGloveInfoKismetLibrary::IsRight(const USGNovaGloveInfo* NovaGloveInf
return NovaGloveInfo->IsRight(); return NovaGloveInfo->IsRight();
} }
FQuat USGNovaGloveInfoKismetLibrary::GetImuCorrection(const USGNovaGloveInfo* NovaGloveInfo) FQuat USGNovaGloveInfoKismetLibrary::GetImuCorrection_FQuat(const USGNovaGloveInfo* NovaGloveInfo)
{
return NovaGloveInfo->GetImuCorrectionQ();
}
FRotator USGNovaGloveInfoKismetLibrary::GetImuCorrection_FRotator(const USGNovaGloveInfo* NovaGloveInfo)
{ {
return NovaGloveInfo->GetImuCorrection(); return NovaGloveInfo->GetImuCorrection();
} }
@@ -29,7 +29,7 @@
* *
* @section DESCRIPTION * @section DESCRIPTION
* *
* * Contains information on Nova's hardware, extracted from the device.
*/ */
@@ -41,16 +41,25 @@
class USGNovaGloveInfo; class USGNovaGloveInfo;
/**
* Device information extracted from a Nova Glove.
*/
UCLASS(meta=(ScriptName = "SesneGloveNovaGloveInfoKismetLibrary")) UCLASS(meta=(ScriptName = "SesneGloveNovaGloveInfoKismetLibrary"))
class SENSEGLOVECOREKISMET_API USGNovaGloveInfoKismetLibrary final : public USGBlueprintFunctionLibrary class SENSEGLOVECOREKISMET_API USGNovaGloveInfoKismetLibrary final : public USGBlueprintFunctionLibrary
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
/**
* The default constructor.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove Info", UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove Info",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGNovaGloveInfo* MakeNovaGloveInfo(UObject* WorldContextObject); static USGNovaGloveInfo* MakeNovaGloveInfo(UObject* WorldContextObject);
/**
* Create a new instance of a NovaGloveInfo.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Nova Glove Info", UFUNCTION(BlueprintCallable, DisplayName="Make Nova Glove Info",
Category="SenseGlove | Core | Nova | Nova Glove Info", meta=(WorldContext="WorldContextObject")) Category="SenseGlove | Core | Nova | Nova Glove Info", meta=(WorldContext="WorldContextObject"))
static USGNovaGloveInfo* MakeNovaGloveInfo_DI_HV_FV_SFV_bRH_IC_NOS( static USGNovaGloveInfo* MakeNovaGloveInfo_DI_HV_FV_SFV_bRH_IC_NOS(
@@ -58,41 +67,83 @@ public:
const FString& DeviceId, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion, const FString& DeviceId, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion,
bool bRightHanded, const FQuat& ImuCorrection, int32 NumberOfSensors); bool bRightHanded, const FQuat& ImuCorrection, int32 NumberOfSensors);
/**
* Parse an constants string into a NovaGloveInfo class.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove Info", UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove Info",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static bool Parse(UObject* WorldContextObject, const FString& ConstantsString, USGNovaGloveInfo* OutGloveInfo); static bool Parse(UObject* WorldContextObject, const FString& ConstantsString, USGNovaGloveInfo* OutGloveInfo);
/**
* Convert a string representation back into a NovaGloveInfo class.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove Info", UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove Info",
meta=(WorldContext="WorldContextObject")) meta=(WorldContext="WorldContextObject"))
static USGNovaGloveInfo* Deserialize(UObject* WorldContextObject, const FString& SerializedString); static USGNovaGloveInfo* Deserialize(UObject* WorldContextObject, const FString& SerializedString);
/**
* Unique identifier of this device.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info")
static FString GetDeviceId(const USGNovaGloveInfo* NovaGloveInfo); static FString GetDeviceId(const USGNovaGloveInfo* NovaGloveInfo);
/**
* Hardware (sub) version of this Sense Glove Device.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info")
static FString GetHardwareVersion(const USGNovaGloveInfo* NovaGloveInfo); static FString GetHardwareVersion(const USGNovaGloveInfo* NovaGloveInfo);
/**
* Firmware version running on the device's MicroController. (as v4.12, this is the 4).
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info")
static int32 GetFirmwareVersion(const USGNovaGloveInfo* NovaGloveInfo); static int32 GetFirmwareVersion(const USGNovaGloveInfo* NovaGloveInfo);
/**
* Sub firmware version running on the device's microcontroller (as v4.12, this is the .12).
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info")
static int32 GetSubFirmwareVersion(const USGNovaGloveInfo* NovaGloveInfo); static int32 GetSubFirmwareVersion(const USGNovaGloveInfo* NovaGloveInfo);
/**
* Determines if this is a right-handed Nova.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info")
static bool IsRight(const USGNovaGloveInfo* NovaGloveInfo); static bool IsRight(const USGNovaGloveInfo* NovaGloveInfo);
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info") /**
static FQuat GetImuCorrection(const USGNovaGloveInfo* NovaGloveInfo); * The IMU correction of this Nova.
*/
UFUNCTION(BlueprintPure, DisplayName="Get Imu Correction", Category="SenseGlove | Core | Nova | Nova Glove Info")
static FQuat GetImuCorrection_FQuat(const USGNovaGloveInfo* NovaGloveInfo);
/**
* The IMU correction of this Nova.
*/
UFUNCTION(BlueprintPure, DisplayName="Get Imu Correction", Category="SenseGlove | Core | Nova | Nova Glove Info")
static FRotator GetImuCorrection_FRotator(const USGNovaGloveInfo* NovaGloveInfo);
/**
* The number of sensors in this device.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info")
static int32 GetNumberOfSensors(const USGNovaGloveInfo* NovaGloveInfo); static int32 GetNumberOfSensors(const USGNovaGloveInfo* NovaGloveInfo);
/**
* Returns true if this GloveInfo contains the same information as another.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info")
static bool Equals(const USGNovaGloveInfo* A, const USGNovaGloveInfo* B); static bool Equals(const USGNovaGloveInfo* A, const USGNovaGloveInfo* B);
/**
* Create a string representation of this Glove Info.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info") UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info")
static FString ToString(const USGNovaGloveInfo* NovaGloveInfo); static FString ToString(const USGNovaGloveInfo* NovaGloveInfo);
/**
* Convert this class into a string representation so it can be unpacked later.
*/
UFUNCTION(BlueprintPure, DisplayName="Serialize", Category="SenseGlove | Core | Nova | Nova Glove Info") UFUNCTION(BlueprintPure, DisplayName="Serialize", Category="SenseGlove | Core | Nova | Nova Glove Info")
static FString SGSerialize(const USGNovaGloveInfo* NovaGloveInfo); static FString SGSerialize(const USGNovaGloveInfo* NovaGloveInfo);
}; };