/** * @file * * @author Max Lammers * @author Mamadou Babaei * * @section LICENSE * * Copyright (c) 2020 - 2025 SenseGlove * * @section DESCRIPTION * * A way to access all sorts of Hand Tracking and -Haptics without needing to * cache any device instances. * Use this layer if you don't care where a HandPose is coming from, and are * fine with calling generic haptic functions. */ #pragma once #include #include #include "CustomWaveform.hpp" #include "DeviceTypes.hpp" #include "HapticGlove.hpp" #include "Platform.hpp" #include "Tracking.hpp" namespace SGCore { namespace Kinematics { class Vect3D; class Quat; }// namespace Kinematics /// A single vibration pulse for Nova Gloves class SGCORE_API CustomWaveform; /// A glove developed by SenseGlove, that has hand tracking and/or haptic feedback functionality. /// class SGCORE_API HapticGlove; /// A way to access all sorts of Hand Tracking and -Haptics without needing to cache any device instances. /// class SGCORE_API HandPose; /// A way to access all sorts of Hand Tracking and -Haptics without needing to cache any device instances. /// class SGCORE_API HandLayer; }// namespace SGCore /// A way to access all sorts of Hand Tracking and -Haptics without needing to cache any device instances. /// class SGCORE_API SGCore::HandLayer { //-------------------------------------------------------------------------------------- // Generic Interface for ease-of-use: public: /// Returns true if there is a HapticGlove Device connected that corresponds to the chosen hand. /// /// /// static bool DeviceConnected(bool bRightHanded); /// Returns the Device Type of the right / left hand. /// /// static EDeviceType GetDeviceType(bool bRightHanded); /// Returns the handedness of the first device you can find; true for right, false for left. Use this for /// testing a single glove. /// static bool GetFirstGloveHandedness(); /// Returns the number of Haptic Gloves connected to the system. /// static int32_t GlovesConnected(); /// Retrieve a Glove Instance for the right- or left hand to do more complicated, device-specific stuff. /// /// /// /// static bool GetGloveInstance(bool bRightHanded, std::shared_ptr& out_glove); //-------------------------------------------------------------------------------------- // Calibration /// Returns the calibration state of the chosen hand. /// /// static EHapticGloveCalibrationState GetCalibrationState(bool bRightHanded); /// Returns the Calibration Instructions for the chosen hand. /// /// static std::string GetCalibrationInstructions(bool bRightHanded); /// Reset the calibration of the left/right hand. /// static void ResetCalibration(bool bRightHanded); /// Reset the calibration of the left/right hand. /// static void EndCalibration(bool bRightHanded); /// Windows-only. If calibration is available (via SenseCom, for instance) we can use this to (re)load it. This step happens autmagically at the start of your runtime. static void LoadCalibrationFromDisk(); /// Clears profiles on disk if any exist. static void ClearProfilesOnDisk(); //-------------------------------------------------------------------------------------- // Tracking /// Attempt to get the HandPose through any of our gloves. You don't care which one is on the other side, /// as long as you get one. /// /// /// static bool GetHandPose(bool bRightHanded, HandPose& out_handPose); /// Calculate the Wrist Location of the chosen hand, based on a reference location and tracking hardware. /// /// /// /// /// /// /// static void GetWristLocation( bool bRightHanded, const SGCore::Kinematics::Vect3D& referencePosition, const Kinematics::Quat& referenceRotation, EPositionalTrackingHardware trackingHardware, Kinematics::Vect3D& out_wristPosition, Kinematics::Quat& out_wristRotation); //-------------------------------------------------------------------------------------- // Haptics /// Stop all haptics on the chosen hand. /// /// static void StopAllHaptics(bool bRightHanded); /// Sends all haptics in the queue for the Left / Right hand. /// static bool SendHaptics(bool bRightHanded); /// Returns true if the glove for this hand supports a custom waveform vibration on said location. /// /// /// /// static bool SupportsCustomWaveform(bool bRightHanded, EHapticLocation atLocation); /// Send a Custom Waveform to a glove at a specific location. /// /// /// /// static bool SendCustomWaveform(bool bRightHanded, CustomWaveform& out_waveform, EHapticLocation location); /// Tell a specific hand to hold the force-feedback at a certain level. /// /// /// /// static bool QueueCommand_ForceFeedbackLevel(bool bRightHanded, int32_t finger, float level01, bool bSendImmediate); /// Queue Force Feedback for multiple fingers. Up to 5. Make sure the value is not NULL. /// /// /// /// static bool QueueCommand_ForceFeedbackLevels(bool bRightHanded, const std::vector& levels01, bool bSendImmediate); /// Queue a command to set the vibration level(s) of a Haptic Glove's finger. Note: This is only for /// Nova 1.0 and DK1.0. /// /// /// /// static bool QueueCommand_VibroLevels(bool bRightHanded, const std::vector& levels01, bool bSendImmediate); /// Queue a command to set the vibration level(s) of a Haptic Glove's finger. Note: This is only for /// Nova 1.0 and DK1.0. /// /// /// /// /// static bool QueueCommand_VibroLevel(bool bRightHanded, int32_t finger, float level01, bool bSendImmediate); /// Queue a vibration level command for a specific HapticLocation. If the gloves has this vibration motor /// installed. Cross-compatible with Nova 2.0. /// /// /// /// /// static bool QueueCommand_VibroLevel( bool bRightHanded, EHapticLocation atLocation, float level01, bool bSendImmediate); /// Returns true if the chosen glove supports active contact feedback on the Wrist. /// /// static bool SupportsWristSqueeze(bool bRightHanded); /// Queue a command to set a squeeze level on the wrist, and optionally send it right away. /// /// /// /// static bool QueueCommand_WristSqueeze(bool bRightHanded, float squeezeLevel01, bool bSendImmediate); /// Returns true is the chosen hand supports flexion locking; automatic locking of FFB when flexed beyond /// a specific point. /// /// static bool SupportsFlexionLocks(bool bRightHanded); /// If the flexion exceeds a particular value, turn on the Force-Feedback. /// static bool QueueCommand_FlexionLock(bool bRightHanded, int32_t finger, float flexion01, bool bSendImmediate); /// Stop any Flexion Threshold active on the chosen finger. /// static bool QueueCommand_ClearFlexionLock(bool bRightHanded, int32_t finger, bool bSendImmediate); public: HandLayer() = delete; virtual ~HandLayer() = delete; };