1#ifndef _SDK_CLIENT_HPP_
2#define _SDK_CLIENT_HPP_
16#include "spdlog/sinks/stdout_color_sinks.h"
17#include "spdlog/spdlog.h"
76 std::vector<SkeletonNode>
nodes;
153 static NodeSetup CreateNodeSetup(uint32_t p_Id, uint32_t p_ParentId,
float p_PosX,
float p_PosY,
float p_PosZ, std::string p_Name);
SessionType
Used to tell what client is using the wrapper. This makes the session easier to identify in the lands...
ChainType
Describes the possible chain types used when setting up the skeleton.
SystemMessageType
Describes the possible types for system messages received from core.
#define NUM_FINGERS_ON_HAND
Used to descriptively refer to the number of fingers on a hand. Used with arrays and loops to make th...
Stores the received ergonomics data.
Stores the information sent by the ergonomics stream.
Stores the landscape data.
Contains information for connecting to a host running Manus Core. Note that if one of these values is...
A 3D vector, used for translations.
Stores the node setup information. Each node represents a segment of the skeleton that can be animate...
Stores the information regarding the skeletons that have been added to Manus Core.
Stores the information sent by the skeleton stream.
Stores the data associated to System messages received from Core.
std::string m_SystemMessage
void PrintSystemMessage()
Prints the last received system messages received from Core.
virtual ClientReturnCode NoHostsFound()
When no available hosts are found the user can either retry or exit.
bool m_RumblingWrist[NUMBER_OF_HANDS_SUPPORTED]
void ClearAllTemporarySkeletons()
This support function is used to clear all temporary skeletons associated to the current SDK session,...
ClientReturnCode ShutDown()
When you are done with the SDK, don't forget to nicely shut it down this will close all connections t...
virtual ClientReturnCode DisplayingDataTracker()
ClientReturnCode Run()
The main SDKClient loop. This is a simple state machine which switches between different substates.
virtual ClientReturnCode DisplayingLandscapeTimeData()
ManusTimestampInfo m_ErgoTimestampInfo
void PrintSkeletonInfo()
Prints the type of the first chain generated by the AllocateChain function, this is used for testing.
virtual ClientReturnCode ReconnectingToCore(int32_t p_ReconnectionTime=0, int32_t p_ReconnectionAttempts=0)
It is called when the sdk is disconnected from Core and the user select one of the options to reconne...
void AdvanceConsolePosition(short int p_Y)
Set the position that the next log message will appear at. Using this allows us to have somewhat of a...
void PrintHandErgoData(ErgonomicsData &p_ErgoData, bool p_Left)
Prints the ergonomics data of a hand.
ClientSkeletonCollection * m_NextSkeleton
ErgonomicsData m_RightGloveErgoData
bool m_TrackerDataDisplayPerUser
void ClearTemporarySkeleton()
This support function is used to clear a temporary skeleton from the temporary skeleton list,...
uint32_t m_FirstRightGloveID
std::chrono::time_point< std::chrono::high_resolution_clock > m_TimeSinceLastDisconnect
const short int m_ConsoleWidth
ClientReturnCode Initialize()
Initialize the sample console and the SDK. This function attempts to resize the console window and th...
uint32_t m_SecondsToFindHosts
bool m_ShouldConnectLocally
virtual ClientReturnCode UpdateBeforeDisplayingData()
Some things happen before every display update, no matter what state. They happen here,...
virtual ClientReturnCode LookingForHosts()
Simple example of the SDK looking for manus core hosts on the network and display them on screen.
virtual ClientReturnCode InitializeSDK()
Initialize the sdk, register the callbacks and set the coordinate system. This needs to be done befor...
bool SetupHandChains(uint32_t p_SklIndex)
This function sets up some basic hand chains. Chains are required for a Skeleton to be able to be ani...
static void OnSystemCallback(const SystemMessage *const p_SystemMessage)
This gets called when receiving a system message from Core.
virtual ClientReturnCode RegisterAllCallbacks()
Used to register the callbacks between sdk and core. Callbacks that are registered functions that get...
uint32_t m_ConsoleClearTickCount
static SDKClient * s_Instance
void PrintTrackerData()
Prints the tracker data Since our console cannot render this data visually in 3d (its not in the scop...
void PrintDongleData()
Print the ergonomics data received from Core.
virtual ClientReturnCode PickingConnectionType()
Overridable switch states of how the client flow is done. This is the first option screen in the clie...
void PrintSkeletonData()
Prints the finalized skeleton data received from Core. Since our console cannot render this data visu...
std::chrono::time_point< std::chrono::high_resolution_clock > m_LastTemporarySkeletonUpdate
virtual ClientReturnCode ConnectingToCore()
After a connection option was selected, the client will now try to connect to manus core via the SDK.
void LoadTestSkeleton()
This function sets up a very minimalistic hand skeleton. In order to have any 3d positional/rotationa...
virtual ClientReturnCode DisplayingDataTemporarySkeleton()
std::unique_ptr< ManusHost[]> m_AvailableHosts
void PrintTrackerDataGlobal()
Prints the tracker data without taking users into account. This shows how one can get the tracker dat...
virtual ClientReturnCode PickingHost()
Print the found hosts and give the user the option to select one.
float RoundFloatValue(float p_Value, int p_NumDecimalsToKeep)
Round the given float value so that it has no more than the given number of decimals.
virtual ClientReturnCode DisplayingData()
Once the connections are made we loop this function it calls all the input handlers for different asp...
static void OnErgonomicsCallback(const ErgonomicsStream *const p_Ergo)
This gets called when receiving ergonomics data from Manus Core In our sample we only save the first ...
uint32_t m_SleepBetweenReconnectingAttemptsInMs
void HandleSkeletonCommands()
Handles the console commands for the skeletons.
SystemMessageType m_SystemMessageCode
uint32_t m_ModifiedSkeletonIndex
static void OnConnectedCallback(const ManusHost *const p_Host)
Gets called when the client is connects to manus core Using this callback is optional....
uint32_t m_HostToConnectTo
void RemoveIndexFromTemporarySkeletonList(uint32_t p_Idx)
std::mutex m_LandscapeMutex
std::mutex m_SkeletonMutex
static ManusVec3 CreateManusVec3(float p_X, float p_Y, float p_Z)
int m_ConsoleCurrentOffset
std::vector< uint32_t > m_LoadedSkeletons
void HandleHapticCommands()
This showcases haptics support on gloves. Send haptics commands to connected gloves if specific keys ...
bool SetupHandNodes(uint32_t p_SklIndex)
This support function sets up the nodes for the skeleton hand In order to have any 3d positional/rota...
std::function< ClientReturnCode()> m_CurrentInteraction
virtual ClientReturnCode DisplayingDataSkeleton()
std::vector< uint32_t > m_TemporarySkeletons
void GetTemporarySkeletonFromFile()
void AllocateChains()
This support function sets up an incomplete hand skeleton and then uses manus core to allocate chains...
std::vector< SkeletonNode > nodes
void HandleTrackerCommands()
This support function is used to set a test tracker and add it to the landscape.
void SaveTemporarySkeletonToFile()
virtual ClientReturnCode RestartSDK()
Used to restart and initialize the SDK to make sure a new connection can be set up....
const short int m_ConsoleScrollback
void PrintLandscapeTimeData()
virtual ClientReturnCode DisplayingDataGlove()
display the ergonomics data of the gloves, and handles haptic commands.
virtual ClientReturnCode DisconnectedFromCore()
When the SDK loses the connection with Core the user can either close the sdk or try to reconnect to ...
static void OnDisconnectedCallback(const ManusHost *const p_Host)
Gets called when the client disconnects from manus core. This callback is optional and in the sample ...
void UnloadTestSkeleton()
This support function is used to unload a skeleton from Core.
int32_t m_SecondsToAttemptReconnecting
std::unique_ptr< ManusHost > m_Host
void PrintTrackerDataPerUser()
Prints the tracker data per user, this shows how to access this data for each user.
void HandleTemporarySkeletonCommands()
Handles the console commands for the temporary skeletons.
static void OnSkeletonStreamCallback(const SkeletonStreamInfo *const p_Skeleton)
This gets called when the client is connected to manus core.
std::mutex m_SystemMessageMutex
void GetTemporarySkeletonIfModified()
This support function checks if a temporary skeleton related to the current session has been modified...
void BuildTemporarySkeleton()
This support function is used for the manual allocation of the skeleton chains with means of a tempor...
void PrintErgonomicsData()
Print the ergonomics data received from Core.
bool shouldHapticFinger[NUM_FINGERS_ON_HAND]
uint32_t m_NumberOfHostsFound
static void OnLandscapeCallback(const Landscape *const p_Landscape)
This gets called when receiving landscape information from core.
static NodeSetup CreateNodeSetup(uint32_t p_Id, uint32_t p_ParentId, float p_PosX, float p_PosY, float p_PosZ, std::string p_Name)
Skeletons are pretty extensive in their data setup so we have several support functions so we can cor...
void PrintTemporarySkeletonInfo()
This support function gets the temporary skeletons for all sessions connected to Core and it prints t...
Landscape * m_NewLandscape
void HandleSkeletonHapticCommands()
This showcases haptics support on the skeletons. Send haptics commands to the gloves connected to a s...
ErgonomicsData m_LeftGloveErgoData
ClientState m_PreviousState
std::vector< ClientSkeleton > skeletons
const short int m_ConsoleHeight
int32_t m_MaxReconnectionAttempts
uint32_t m_FirstLeftGloveID
ClientSkeletonCollection * m_Skeleton
Used to store the information about the final animated skeletons.
Used to store all the final animated skeletons received from Core.
constexpr unsigned long long int MINIMUM_MILLISECONDS_BETWEEN_HAPTICS_COMMANDS
Constant expression used to define the time between two possible haptics commands sent.
constexpr unsigned long long int MILLISECONDS_BETWEEN_TEMPORARY_SKELETONS_UPDATE
Constant expression used to define the time between two updates of the temporary skeleton count print...
ClientState
The current state of the client.
constexpr unsigned int NUMBER_OF_HANDS_SUPPORTED
Constant expression: number of hands supported by demo.
ClientReturnCode
Values that can be returned by this application.
@ ClientState_NoHostsFound
@ ClientState_ConnectingToCore
@ ClientState_LookingForHosts
@ ClientState_MAX_CLIENT_STATE_SIZE
@ ClientState_PickingConnectionType
@ ClientState_DisplayingData
@ ClientState_PickingHost
@ ClientState_Disconnected
@ ClientReturnCode_MAX_CLIENT_RETURN_CODE_SIZE
@ ClientReturnCode_Success
@ ClientReturnCode_FailedWrongTimeToGetData
@ ClientReturnCode_FailedPlatformSpecificInitialization
@ ClientReturnCode_FailedToConnect
@ ClientReturnCode_FailedToFindHosts
@ ClientReturnCode_FailedToRestart
@ ClientReturnCode_FailedToShutDownSDK
@ ClientReturnCode_UnrecognizedStateEncountered
@ ClientReturnCode_FailedToInitialize
@ ClientReturnCode_FailedToResizeWindow
@ ClientReturnCode_FailedPlatformSpecificShutdown
Haptic settings for a single glove.