14 std::cout <<
"Starting minimal client!\n";
17 std::cout <<
"minimal client is initialized.\n";
23 std::cout <<
"minimal client is done, shutting down.\n";
43 return ClientReturnCode::ClientReturnCode_FailedPlatformSpecificInitialization;
47 if (t_IntializeResult != ClientReturnCode::ClientReturnCode_Success)
49 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
52 return ClientReturnCode::ClientReturnCode_Success;
62 if (t_InitializeResult != SDKReturnCode::SDKReturnCode_Success)
64 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
68 if (t_CallBackResults != ::ClientReturnCode::ClientReturnCode_Success)
70 return t_CallBackResults;
80 t_VUH.
up = AxisPolarity::AxisPolarity_PositiveY;
81 t_VUH.
view = AxisView::AxisView_ZFromViewer;
86 if (t_CoordinateResult != SDKReturnCode::SDKReturnCode_Success)
88 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
91 return ClientReturnCode::ClientReturnCode_Success;
100 if (t_Result != SDKReturnCode::SDKReturnCode_Success)
102 return ClientReturnCode::ClientReturnCode_FailedToShutDownSDK;
107 return ClientReturnCode::ClientReturnCode_FailedPlatformSpecificShutdown;
110 return ClientReturnCode::ClientReturnCode_Success;
122 if (t_RegisterSkeletonCallbackResult != SDKReturnCode::SDKReturnCode_Success)
124 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
126 return ClientReturnCode::ClientReturnCode_Success;
133 std::cout <<
"minimal client is connecting to local host. (make sure it is running)\n";
134 while (
ConnectLocally() != ClientReturnCode::ClientReturnCode_Success)
137 std::cout <<
"minimal client could not connect.trying again in a second.\n";
138 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
140 std::cout <<
"minimal client is connected, setting up skeletons.\n";
160 std::cout <<
"skeleton data obtained for frame: " << std::to_string(
m_FrameCounter) <<
".\n";
164 std::this_thread::sleep_for(std::chrono::milliseconds(33));
178 if (t_StartResult != SDKReturnCode::SDKReturnCode_Success)
180 return ClientReturnCode::ClientReturnCode_FailedToFindHosts;
183 uint32_t t_NumberOfHostsFound = 0;
185 if (t_NumberResult != SDKReturnCode::SDKReturnCode_Success)
187 return ClientReturnCode::ClientReturnCode_FailedToFindHosts;
190 if (t_NumberOfHostsFound == 0)
192 return ClientReturnCode::ClientReturnCode_FailedToFindHosts;
195 std::unique_ptr<ManusHost[]> t_AvailableHosts;
196 t_AvailableHosts.reset(
new ManusHost[t_NumberOfHostsFound]);
199 if (t_HostsResult != SDKReturnCode::SDKReturnCode_Success)
201 return ClientReturnCode::ClientReturnCode_FailedToFindHosts;
206 if (t_ConnectResult == SDKReturnCode::SDKReturnCode_NotConnected)
208 return ClientReturnCode::ClientReturnCode_FailedToConnect;
211 return ClientReturnCode::ClientReturnCode_Success;
223 uint32_t t_SklIndex = 0;
227 t_SKL.
type = SkeletonType::SkeletonType_Hand;
237 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
249 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
274 t_Node.
type = NodeType::NodeType_Joint;
303 const uint32_t t_NumFingers = 5;
304 const uint32_t t_NumJoints = 4;
308 ManusVec3 t_Fingers[t_NumFingers * t_NumJoints] = {
345 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
352 for (uint32_t i = 0; i < t_NumFingers; i++)
354 uint32_t t_ParentID = 0;
356 for (uint32_t j = 0; j < t_NumJoints; j++)
359 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
361 printf(
"Failed to Add Node To Skeleton Setup. The error given %d.", t_Res);
364 t_ParentID = 1 + t_FingerId + j;
366 t_FingerId += t_NumJoints;
382 t_ChainSettings.
usedSettings = ChainType::ChainType_Hand;
394 t_Chain.
type = ChainType::ChainType_Hand;
395 t_Chain.
dataType = ChainType::ChainType_Hand;
396 t_Chain.
side = Side::Side_Left;
403 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
410 const ChainType t_FingerTypes[5] = { ChainType::ChainType_FingerThumb,
411 ChainType::ChainType_FingerIndex,
412 ChainType::ChainType_FingerMiddle,
413 ChainType::ChainType_FingerRing,
414 ChainType::ChainType_FingerPinky };
415 for (
int i = 0; i < 5; i++)
428 t_Chain.
type = t_FingerTypes[i];
429 t_Chain.
dataType = t_FingerTypes[i];
430 t_Chain.
side = Side::Side_Left;
443 t_Chain.
nodeIds[0] = (i * 4) + 1;
444 t_Chain.
nodeIds[1] = (i * 4) + 2;
445 t_Chain.
nodeIds[2] = (i * 4) + 3;
446 t_Chain.
nodeIds[3] = (i * 4) + 4;
451 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
468 for (uint32_t i = 0; i < p_SkeletonStreamInfo->
skeletonsCount; i++)
CORESDK_API SDKReturnCode CoreSdk_GetAvailableHostsFound(ManusHost *p_AvailableHostsFound, const uint32_t p_NumberOfHostsThatFitInArray)
Fill the given array with information on the hosts that were found. This is the third and final funct...
CORESDK_API SDKReturnCode CoreSdk_Initialize(SessionType p_TypeOfSession)
Initialize the wrapper. Call this before using the wrapper.
CORESDK_API SDKReturnCode CoreSdk_ShutDown()
Shut down the wrapper. This needs to be called last.
CORESDK_API SDKReturnCode CoreSdk_LoadSkeleton(uint32_t p_SkeletonSetupIndex, uint32_t *p_SkeletonId)
Sends a skeleton setup to core to become a skeleton upon which data is applied. Returns the skeleton ...
CORESDK_API SDKReturnCode CoreSdk_GetSkeletonInfo(uint32_t p_SkeletonIndex, SkeletonInfo *p_Info)
Get information about the final animated skeleton with given index.
CORESDK_API SDKReturnCode CoreSdk_CreateSkeletonSetup(SkeletonSetupInfo p_Skeleton, uint32_t *p_SkeletonSetupIndex)
Create a new SkeletonSetup with the given information and returns the index on which it is saved.
CORESDK_API SDKReturnCode CoreSdk_RegisterCallbackForSkeletonStream(SkeletonStreamCallback_t p_SkeletonStreamCallback)
Register the callback function that is called when skeleton data comes in.
CORESDK_API SDKReturnCode CoreSdk_AddNodeToSkeletonSetup(uint32_t p_SkeletonSetupIndex, NodeSetup p_Node)
Add a node to a SkeletonSetup at a given index.
CORESDK_API SDKReturnCode CoreSdk_InitializeCoordinateSystemWithVUH(CoordinateSystemVUH p_CoordinateSystem, bool p_UseWorldCoordinates)
Initialize a coordinate system of type CoordinateSystemVUH. (View Up Handedness) This has to be calle...
CORESDK_API SDKReturnCode CoreSdk_GetNumberOfAvailableHostsFound(uint32_t *p_NumberOfAvailableHostsFound)
Get the number of hosts running Manus Core that were found. This is the second function to call when ...
CORESDK_API SDKReturnCode CoreSdk_ConnectToHost(ManusHost p_Host)
Connect to a host using the given host information.
CORESDK_API SDKReturnCode CoreSdk_AddChainToSkeletonSetup(uint32_t p_SkeletonSetupIndex, ChainSetup p_Chain)
Add a chain to a SkeletonSetup at a given index.
CORESDK_API SDKReturnCode CoreSdk_GetSkeletonData(uint32_t p_SkeletonIndex, SkeletonNode *p_Nodes, uint32_t p_NodeCount)
Get data for the final animated skeleton with given index. The size of the given array must match the...
CORESDK_API SDKReturnCode CoreSdk_LookForHosts(uint32_t p_WaitSeconds=1, bool p_LoopbackOnly=false)
Start a background task that looks for hosts running Manus Core. Call this first when looking for hos...
CORESDK_API void CoordinateSystemVUH_Init(CoordinateSystemVUH *p_Val)
Initializer for a CoordinateSystemVUH struct.
CORESDK_API void SkeletonSetupInfo_Init(SkeletonSetupInfo *p_Val)
Initializer for a SkeletonSetupInfo struct.
CORESDK_API void ChainSettings_Init(ChainSettings *p_Val)
Initializer for a ChainSettings struct.
CORESDK_API void NodeSetup_Init(NodeSetup *p_Val)
Initializer for a NodeSetup struct.
CORESDK_API void ChainSetup_Init(ChainSetup *p_Val)
Initializer for a ChainSetup struct.
int32_t fingerChainIdsUsed
SkeletonTargetType targetType
SkeletonSettings settings
ChainSettingsFinger finger
uint32_t nodeIds[MAX_CHAIN_LENGTH]
SkeletonTargetUserIndexData skeletonTargetUserIndexData
int32_t fingerChainIds[MAX_NUM_FINGER_IDS]
char name[MAX_NUM_CHARS_IN_SKELETON_NAME]
char name[MAX_NUM_CHARS_IN_NODE_NAME]
NodeSettingsFlag usedSettings
SDKReturnCode
The return values that can be given by SDK wrapper functions.
ChainType
Describes the possible chain types used when setting up the skeleton.
Stores all chain settings.
Stores the chain setup information.
Stores the information regarding the coordinate system used by the client, defined as VUH (view,...
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 each skeleton node. The transform is defined as a local or global tr...
Stores the skeleton setup information.
Stores the information sent by the skeleton stream.
bool PlatformSpecificInitialization(void)
Initialise things only needed for this platform.
bool GetKeyDown(const int p_Key)
Returns true first time it is called when key is pressed.
static bool CopyString(char *const p_Target, const size_t p_MaxLengthThatWillFitInTarget, const std::string &p_Source)
Copy the given string into the given target.
bool PlatformSpecificShutdown(void)
Shut down things only needed for this platform.
std::vector< ClientSkeleton > skeletons
Used to store all the final animated skeletons received from Core.
static SDKMinimalClient * s_Instance
ClientReturnCode ShutDown()
When you are done with the SDK, don't forget to nicely shut it down this will close all connections t...
ClientSkeletonCollection * m_NextSkeleton
ClientReturnCode Initialize()
Initialize the sample console and the SDK. This function attempts to resize the console window and th...
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...
ClientReturnCode RegisterAllCallbacks()
Used to register the callbacks between sdk and core. Callbacks that are registered functions that get...
void LoadTestSkeleton()
This function sets up a very minimalistic hand skeleton. In order to have any 3d positional/rotationa...
ClientReturnCode ConnectLocally()
the client will now try to connect to manus core via the SDK.
std::mutex m_SkeletonMutex
static ManusVec3 CreateManusVec3(float p_X, float p_Y, float p_Z)
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...
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...
static void OnSkeletonStreamCallback(const SkeletonStreamInfo *const p_SkeletonStreamInfo)
This gets called when the client is connected to manus core.
ClientSkeletonCollection * m_Skeleton
ClientReturnCode
Values that can be returned by this application.