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 15:03:19 +01:00
parent 7d8d31499e
commit 23bbdf14d5
4 changed files with 129 additions and 9 deletions
@@ -240,7 +240,7 @@ bool USGNovaGloveInfo::IsRight() const
return SGCoreImpl_FSGNovaGloveInfoImpl_IsRight(&InstanceContainer);
}
FQuat USGNovaGloveInfo::GetImuCorrection() const
FQuat USGNovaGloveInfo::GetImuCorrectionQ() const
{
FSGIC_FSGNovaGloveInfoImpl InstanceContainer{ToNovaGloveInfoImpl()};
FSGIC_FQuat OutCorrectionContainer;
@@ -248,6 +248,14 @@ FQuat USGNovaGloveInfo::GetImuCorrection() const
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
{
FSGIC_FSGNovaGloveInfoImpl InstanceContainer{ToNovaGloveInfoImpl()};
@@ -29,7 +29,7 @@
*
* @section DESCRIPTION
*
*
* Contains information on Nova's hardware, extracted from the device.
*/
@@ -49,6 +49,9 @@
class FSGNovaGloveInfoImpl;
/**
* Device information extracted from a Nova Glove.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGNovaGloveInfo final : public UObject
{
@@ -59,16 +62,28 @@ public:
UObject* Outer, const FSGNovaGloveInfoImpl& NovaGloveInfoImpl);
public:
/**
* The default constructor.
*/
static USGNovaGloveInfo* NewNovaGloveInfo(UObject* Outer);
/**
* Create a new instance of a NovaGloveInfo.
*/
static USGNovaGloveInfo* NewNovaGloveInfo(
UObject* Outer,
const FString& DeviceId, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion,
bool bRightHanded, const FQuat& ImuCorrection, int32 NumberOfSensors);
public:
/**
* Parse an constants string into a NovaGloveInfo class.
*/
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);
private:
@@ -83,8 +98,14 @@ private:
FImplDeleter PimplDeleter;
public:
/**
* The default constructor.
*/
USGNovaGloveInfo();
/**
* Create a new instance of a NovaGloveInfo.
*/
USGNovaGloveInfo(const FString& DeviceId,
const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion,
bool bRightHanded, const FQuat& ImuCorrection, int32 NumberOfSensors);
@@ -120,25 +141,60 @@ protected:
FSGNovaGloveInfoImpl& ToNovaGloveInfoImpl();
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. (as v4.12, this is the 4).
*/
int32 GetFirmwareVersion() const;
/**
* Sub firmware version running on the device's microcontroller (as v4.12, this is the .12).
*/
int32 GetSubFirmwareVersion() const;
/**
* Determines if this is a right-handed Nova.
*/
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;
public:
/**
* Returns true if this GloveInfo contains the same information as another.
*/
bool Equals(const USGNovaGloveInfo* NovaGloveInfo) const;
public:
/**
* Create a string representation of this Glove Info.
*/
FString ToString() const;
/**
* Convert this class into a string representation so it can be unpacked later.
*/
FString SGSerialize() const;
};
};
@@ -90,7 +90,12 @@ bool USGNovaGloveInfoKismetLibrary::IsRight(const USGNovaGloveInfo* NovaGloveInf
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();
}
@@ -29,7 +29,7 @@
*
* @section DESCRIPTION
*
*
* Contains information on Nova's hardware, extracted from the device.
*/
@@ -41,16 +41,25 @@
class USGNovaGloveInfo;
/**
* Device information extracted from a Nova Glove.
*/
UCLASS(meta=(ScriptName = "SesneGloveNovaGloveInfoKismetLibrary"))
class SENSEGLOVECOREKISMET_API USGNovaGloveInfoKismetLibrary final : public USGBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
/**
* The default constructor.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove Info",
meta=(WorldContext="WorldContextObject"))
static USGNovaGloveInfo* MakeNovaGloveInfo(UObject* WorldContextObject);
/**
* Create a new instance of a NovaGloveInfo.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Nova Glove Info",
Category="SenseGlove | Core | Nova | Nova Glove Info", meta=(WorldContext="WorldContextObject"))
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,
bool bRightHanded, const FQuat& ImuCorrection, int32 NumberOfSensors);
/**
* Parse an constants string into a NovaGloveInfo class.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Nova | Nova Glove Info",
meta=(WorldContext="WorldContextObject"))
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",
meta=(WorldContext="WorldContextObject"))
static USGNovaGloveInfo* Deserialize(UObject* WorldContextObject, const FString& SerializedString);
/**
* Unique identifier of this device.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info")
static FString GetDeviceId(const USGNovaGloveInfo* NovaGloveInfo);
/**
* Hardware (sub) version of this Sense Glove Device.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info")
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")
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")
static int32 GetSubFirmwareVersion(const USGNovaGloveInfo* NovaGloveInfo);
/**
* Determines if this is a right-handed Nova.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Nova | Nova Glove Info")
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")
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")
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")
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")
static FString SGSerialize(const USGNovaGloveInfo* NovaGloveInfo);
};
};