Files
Plugin/Source/SenseGloveCoreKismet/Public/SGCoreKismet/SGHapticGloveCalibrationSequenceKismetLibrary.h
T

221 lines
10 KiB
C++

/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2022 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#pragma once
#include "SGKismet/SGBlueprintFunctionLibrary.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGHapticGloveCalibrationSequenceKismetLibrary.generated.h"
class USGCalibrationDataPoint;
class USGHandPose;
class USGHandProfile;
class USGHapticGlove;
class USGHapticGloveCalibrationSequence;
class USGSensorRange;
/**
* A sequence which collects data points until specific criteria have been met. It must be 'fed' an Update command from your program in order to work.
*/
UCLASS(meta=(ScriptName = "SesneGloveHapticGloveCalibrationSequenceKismetLibrary"))
class SENSEGLOVECOREKISMET_API USGHapticGloveCalibrationSequenceKismetLibrary final : public USGBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
/**
* Create a new instance of a base HapitcGlove Calibration Sequence.
*/
UFUNCTION(BlueprintCallable, DisplayName="Make Haptic Glove Calibration Sequence",
Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence",
meta=(WorldContext="WorldContextObject"))
static USGHapticGloveCalibrationSequence* MakeHapticGloveCalibrationSequence_GTC(
UObject* WorldContextObject,
const USGHapticGlove* GloveToCalibrate);
/**
* The maximum buffer size for calibration points. Once calibrationPoints exceeds this value, the
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence")
static int32 GetMaxDataPoints();
/**
* Converts a calibration range taken from a Calibration sequence, and converts it into a profile. Use this if you're not actually using the sequence.
*/
UFUNCTION(BlueprintCallable, DisplayName="CompileProfile",
Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence",
meta=(WorldContext="WorldContextObject"))
static bool CompileProfile_SR_FD_bRH_OutP(
UObject* WorldContextObject,
const USGSensorRange* SensorRange, ESGDeviceType ForDevice, bool bRightHanded, USGHandProfile*& OutProfile);
/**
* Glove linked to this calibration sequence. Will attempt to grab data from this glove evey time Update() is called.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence",
meta=(WorldContext="WorldContextObject"))
static USGHapticGlove* GetLinkedGlove(UObject* WorldContextObject,
const USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence);
/**
*
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence")
static void SetLinkedGlove(USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence,
const USGHapticGlove* LinkedGlove);
/**
* Calibration points collected during this calibration process. One is added every time the "Update()" function is called.
* Used to create a profile after the calibration finishes.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence",
meta=(WorldContext="WorldContextObject"))
static TArray<USGCalibrationDataPoint*> GetCalibrationPoints(
UObject* WorldContextObject,
const USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence);
/**
*
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence")
static float GetElapsedTime(const USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence);
/**
* Used to determine if the user has manually ended the sequence, to prevent us from adding any more calibration points.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence")
static bool IsManuallyCompleted(const USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence);
/**
* If a sequence consists of multiple stages, this integer will show you which one is currently active.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence")
static int32 GetCurrentStage(const USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence);
/**
* Returns the amount of calibration points collected so far.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence")
static int64 GetCalibrationPointsCount(const USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence);
/**
* Whether or not this sequence was completed as per its own rules.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence")
static bool AutoCompleted(const USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence);
/**
* Returns true if this sequence is marked as 'complete' and can begin compiling a profile.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence")
static bool Completed(const USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence);
/**
* Resets this calibration sequence's data, but not it's LinkedGlove.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence")
static void Reset(USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence);
/**
*
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence")
static void AddDataPoint(USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence,
const TArray<FVector>& CalibrationData);
/**
* Update this calibration sequence with new data. We use deltaSeconds to check for things like stability.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence")
static void Update(USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence,
float DeltaSeconds);
/**
* Manual confirmation of whatever step we're supposed to making at the moment.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence")
static void ConfirmCurrentStep(USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence);
/**
* Compile a min/max range from the data points collected by this sequence. Returns true if it's actually possible.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence",
meta=(WorldContext="WorldContextObject"))
static bool CompileRange(UObject* WorldContextObject,
const USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence,
USGSensorRange*& OutSensorRange);
/**
* Compile a profile from the data points collected by this sequence. Returns true if it's actually possible.
*/
UFUNCTION(BlueprintPure, DisplayName="CompileProfile",
Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence",
meta=(WorldContext="WorldContextObject"))
static bool CompileProfile_FD_bRH_OutP(
UObject* WorldContextObject,
const USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence,
ESGDeviceType ForDevice, bool bRightHanded, USGHandProfile*& OutProfile);
/**
* Returns the current HandPose; either the one we should be making, or what it would look like at the moment.
*/
UFUNCTION(BlueprintPure, DisplayName="Get Hand Pose",
Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence",
meta=(WorldContext="WorldContextObject"))
static bool GetHandPose_OutCHP(UObject* WorldContextObject,
const USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence,
USGHandPose*& OutCurrentHandPose);
/**
* Returns the current HandPose; either the one we should be making, or what it would look like at the moment.
*/
UFUNCTION(BlueprintPure, DisplayName="Get Hand Pose",
Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence",
meta=(WorldContext="WorldContextObject"))
static bool GetHandPose_bRH_OutCHP(
UObject* WorldContextObject,
const USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence,
bool bRightHanded,
USGHandPose*& OutCurrentHandPose);
/**
* Retrieve instructions on what to do during the current step.
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Calibration | Haptic Glove Calibration Sequence")
static FString GetCurrentInstruction(const USGHapticGloveCalibrationSequence* HapticGloveCalibrationSequence,
const FString& NextStepKey = "");
};