C++ SDK for MANUS Core 2.0
Loading...
Searching...
No Matches
SDKMinimalClient.cpp
Go to the documentation of this file.
1// SDKMinimalClient.cpp : This file contains the 'main' function. Program execution begins and ends there.
2//
3
5#include "ManusSDKTypes.h"
6#include <fstream>
7#include <iostream>
8#include <thread>
9
11
12int main()
13{
14 std::cout << "Starting minimal client!\n";
15 SDKMinimalClient t_Client;
16 t_Client.Initialize();
17 std::cout << "minimal client is initialized.\n";
18
19 // SDK is setup. so now go to main loop of the program.
20 t_Client.Run();
21
22 // loop is over. disconnect it all
23 std::cout << "minimal client is done, shutting down.\n";
24 t_Client.ShutDown();
25}
26
28{
29 s_Instance = this;
30}
31
33{
34 s_Instance = nullptr;
35}
36
40{
42 {
43 return ClientReturnCode::ClientReturnCode_FailedPlatformSpecificInitialization;
44 }
45
46 const ClientReturnCode t_IntializeResult = InitializeSDK();
47 if (t_IntializeResult != ClientReturnCode::ClientReturnCode_Success)
48 {
49 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
50 }
51
52 return ClientReturnCode::ClientReturnCode_Success;
53}
54
58{
59 // before we can use the SDK, some internal SDK bits need to be initialized.
60 // however after initializing, the SDK is not yet connected to a host or doing anything network related just yet.
61 const SDKReturnCode t_InitializeResult = CoreSdk_Initialize(SessionType::SessionType_CoreSDK);
62 if (t_InitializeResult != SDKReturnCode::SDKReturnCode_Success)
63 {
64 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
65 }
66
67 const ClientReturnCode t_CallBackResults = RegisterAllCallbacks();
68 if (t_CallBackResults != ::ClientReturnCode::ClientReturnCode_Success)
69 {
70 return t_CallBackResults;
71 }
72
73 // after everything is registered and initialized as seen above
74 // we must also set the coordinate system being used for the data in this client.
75 // (each client can have their own settings. unreal and unity for instance use different coordinate systems)
76 // if this is not set, the SDK will not connect to any Manus core host.
79 t_VUH.handedness = Side::Side_Left; // this is currently set to unreal mode.
80 t_VUH.up = AxisPolarity::AxisPolarity_PositiveY;
81 t_VUH.view = AxisView::AxisView_ZFromViewer;
82 t_VUH.unitScale = 1.0f; //1.0 is meters, 0.01 is cm, 0.001 is mm.
83
84 const SDKReturnCode t_CoordinateResult = CoreSdk_InitializeCoordinateSystemWithVUH(t_VUH, false);
85
86 if (t_CoordinateResult != SDKReturnCode::SDKReturnCode_Success)
87 {
88 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
89 }
90
91 return ClientReturnCode::ClientReturnCode_Success;
92}
93
98{
99 const SDKReturnCode t_Result = CoreSdk_ShutDown();
100 if (t_Result != SDKReturnCode::SDKReturnCode_Success)
101 {
102 return ClientReturnCode::ClientReturnCode_FailedToShutDownSDK;
103 }
104
106 {
107 return ClientReturnCode::ClientReturnCode_FailedPlatformSpecificShutdown;
108 }
109
110 return ClientReturnCode::ClientReturnCode_Success;
111}
112
117{
118 // Register the callback for when manus core is sending Skeleton data
119 // it is optional, but without it you can not see any resulting skeleton data.
120 // see OnSkeletonStreamCallback for more details.
122 if (t_RegisterSkeletonCallbackResult != SDKReturnCode::SDKReturnCode_Success)
123 {
124 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
125 }
126 return ClientReturnCode::ClientReturnCode_Success;
127}
128
131{
132 // first loop until we get a connection locally
133 std::cout << "minimal client is connecting to local host. (make sure it is running)\n";
134 while (ConnectLocally() != ClientReturnCode::ClientReturnCode_Success)
135 {
136 // not yet connected. wait
137 std::cout << "minimal client could not connect.trying again in a second.\n";
138 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
139 }
140 std::cout << "minimal client is connected, setting up skeletons.\n";
141 // then upload a simple skeleton with a chain. this will just be a left hand for the first userindex.
143
144 // then loop and get its data while waiting for escape key to end it
145 while (m_Running)
146 {
147 // check if there is new data. otherwise we just wait.
148 m_SkeletonMutex.lock();
149 if (m_NextSkeleton != nullptr)
150 {
151 if (m_Skeleton != nullptr)delete m_Skeleton;
153 m_NextSkeleton = nullptr;
154 }
155 m_SkeletonMutex.unlock();
156
157 if (m_Skeleton != nullptr && m_Skeleton->skeletons.size() != 0)
158 {
159 // print update
160 std::cout << "skeleton data obtained for frame: " << std::to_string(m_FrameCounter) << ".\n";
162 }
163
164 std::this_thread::sleep_for(std::chrono::milliseconds(33)); // or roughly 30fps, but good enough to show the results.
165
166 if (GetKeyDown(' ')) // press space to exit
167 {
168 m_Running = false;
169 }
170 }
171 // then exit.
172}
173
176{
177 SDKReturnCode t_StartResult = CoreSdk_LookForHosts(1, true);
178 if (t_StartResult != SDKReturnCode::SDKReturnCode_Success)
179 {
180 return ClientReturnCode::ClientReturnCode_FailedToFindHosts;
181 }
182
183 uint32_t t_NumberOfHostsFound = 0;
184 SDKReturnCode t_NumberResult = CoreSdk_GetNumberOfAvailableHostsFound(&t_NumberOfHostsFound);
185 if (t_NumberResult != SDKReturnCode::SDKReturnCode_Success)
186 {
187 return ClientReturnCode::ClientReturnCode_FailedToFindHosts;
188 }
189
190 if (t_NumberOfHostsFound == 0)
191 {
192 return ClientReturnCode::ClientReturnCode_FailedToFindHosts;
193 }
194
195 std::unique_ptr<ManusHost[]> t_AvailableHosts;
196 t_AvailableHosts.reset(new ManusHost[t_NumberOfHostsFound]);
197
198 SDKReturnCode t_HostsResult = CoreSdk_GetAvailableHostsFound(t_AvailableHosts.get(), t_NumberOfHostsFound);
199 if (t_HostsResult != SDKReturnCode::SDKReturnCode_Success)
200 {
201 return ClientReturnCode::ClientReturnCode_FailedToFindHosts;
202 }
203
204 SDKReturnCode t_ConnectResult = CoreSdk_ConnectToHost(t_AvailableHosts[0]);
205
206 if (t_ConnectResult == SDKReturnCode::SDKReturnCode_NotConnected)
207 {
208 return ClientReturnCode::ClientReturnCode_FailedToConnect;
209 }
210
211 return ClientReturnCode::ClientReturnCode_Success;
212}
213
214
222{
223 uint32_t t_SklIndex = 0;
224
225 SkeletonSetupInfo t_SKL;
227 t_SKL.type = SkeletonType::SkeletonType_Hand;
228 t_SKL.settings.scaleToTarget = true;
229 t_SKL.settings.targetType = SkeletonTargetType::SkeletonTarget_UserIndexData;
230 //If the glove does not exist then the added skeleton will not be animated.
231 //Same goes for any other skeleton made for invalid users/gloves.
232 t_SKL.settings.skeletonTargetUserIndexData.userIndex = 0; // just take the first index. make sure this matches in the landscape.
233
234 CopyString(t_SKL.name, sizeof(t_SKL.name), std::string("LeftHand"));
235
236 SDKReturnCode t_Res = CoreSdk_CreateSkeletonSetup(t_SKL, &t_SklIndex);
237 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
238 {
239 return;
240 }
241
242 // setup nodes and chains for the skeleton hand
243 if (!SetupHandNodes(t_SklIndex)) return;
244 if (!SetupHandChains(t_SklIndex)) return;
245
246 // load skeleton
247 uint32_t t_ID = 0;
248 t_Res = CoreSdk_LoadSkeleton(t_SklIndex, &t_ID);
249 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
250 {
251 return;
252 }
253}
254
268NodeSetup SDKMinimalClient::CreateNodeSetup(uint32_t p_Id, uint32_t p_ParentId, float p_PosX, float p_PosY, float p_PosZ, std::string p_Name)
269{
270 NodeSetup t_Node;
271 NodeSetup_Init(&t_Node);
272 t_Node.id = p_Id; //Every ID needs to be unique per node in a skeleton.
273 CopyString(t_Node.name, sizeof(t_Node.name), p_Name);
274 t_Node.type = NodeType::NodeType_Joint;
275 //Every node should have a parent unless it is the Root node.
276 t_Node.parentID = p_ParentId; //Setting the node ID to its own ID ensures it has no parent.
277 t_Node.settings.usedSettings = NodeSettingsFlag::NodeSettingsFlag_None;
278
279 t_Node.transform.position.x = p_PosX;
280 t_Node.transform.position.y = p_PosY;
281 t_Node.transform.position.z = p_PosZ;
282 return t_Node;
283}
284
285ManusVec3 SDKMinimalClient::CreateManusVec3(float p_X, float p_Y, float p_Z)
286{
287 ManusVec3 t_Vec;
288 t_Vec.x = p_X;
289 t_Vec.y = p_Y;
290 t_Vec.z = p_Z;
291 return t_Vec;
292}
293
300bool SDKMinimalClient::SetupHandNodes(uint32_t p_SklIndex)
301{
302 // Define number of fingers per hand and number of joints per finger
303 const uint32_t t_NumFingers = 5;
304 const uint32_t t_NumJoints = 4;
305
306 // Create an array with the initial position of each hand node.
307 // Note, these values are just an example of node positions and refer to the hand laying on a flat surface.
308 ManusVec3 t_Fingers[t_NumFingers * t_NumJoints] = {
309 CreateManusVec3(0.024950f, 0.000000f, 0.025320f), //Thumb CMC joint
310 CreateManusVec3(0.000000f, 0.000000f, 0.032742f), //Thumb MCP joint
311 CreateManusVec3(0.000000f, 0.000000f, 0.028739f), //Thumb IP joint
312 CreateManusVec3(0.000000f, 0.000000f, 0.028739f), //Thumb Tip joint
313
314 //CreateManusVec3(0.011181f, 0.031696f, 0.000000f), //Index CMC joint // Note: we are not adding the matacarpal bones in this example, if you want to animate the metacarpals add each of them to the corresponding finger chain.
315 CreateManusVec3(0.011181f, 0.000000f, 0.052904f), //Index MCP joint, if metacarpal is present: CreateManusVec3(0.000000f, 0.000000f, 0.052904f)
316 CreateManusVec3(0.000000f, 0.000000f, 0.038257f), //Index PIP joint
317 CreateManusVec3(0.000000f, 0.000000f, 0.020884f), //Index DIP joint
318 CreateManusVec3(0.000000f, 0.000000f, 0.018759f), //Index Tip joint
319
320 //CreateManusVec3(0.000000f, 0.033452f, 0.000000f), //Middle CMC joint
321 CreateManusVec3(0.000000f, 0.000000f, 0.051287f), //Middle MCP joint
322 CreateManusVec3(0.000000f, 0.000000f, 0.041861f), //Middle PIP joint
323 CreateManusVec3(0.000000f, 0.000000f, 0.024766f), //Middle DIP joint
324 CreateManusVec3(0.000000f, 0.000000f, 0.019683f), //Middle Tip joint
325
326 //CreateManusVec3(-0.011274f, 0.031696f, 0.000000f), //Ring CMC joint
327 CreateManusVec3(-0.011274f, 0.000000f, 0.049802f), //Ring MCP joint, if metacarpal is present: CreateManusVec3(0.000000f, 0.000000f, 0.049802f),
328 CreateManusVec3(0.000000f, 0.000000f, 0.039736f), //Ring PIP joint
329 CreateManusVec3(0.000000f, 0.000000f, 0.023564f), //Ring DIP joint
330 CreateManusVec3(0.000000f, 0.000000f, 0.019868f), //Ring Tip joint
331
332 //CreateManusVec3(-0.020145f, 0.027538f, 0.000000f), //Pinky CMC joint
333 CreateManusVec3(-0.020145f, 0.000000f, 0.047309f), //Pinky MCP joint, if metacarpal is present: CreateManusVec3(0.000000f, 0.000000f, 0.047309f),
334 CreateManusVec3(0.000000f, 0.000000f, 0.033175f), //Pinky PIP joint
335 CreateManusVec3(0.000000f, 0.000000f, 0.018020f), //Pinky DIP joint
336 CreateManusVec3(0.000000f, 0.000000f, 0.019129f), //Pinky Tip joint
337 };
338
339 // skeleton entry is already done. just the nodes now.
340 // setup a very simple node hierarchy for fingers
341 // first setup the root node
342 //
343 // root, This node has ID 0 and parent ID 0, to indicate it has no parent.
344 SDKReturnCode t_Res = CoreSdk_AddNodeToSkeletonSetup(p_SklIndex, CreateNodeSetup(0, 0, 0, 0, 0, "Hand"));
345 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
346 {
347 return false;
348 }
349
350 // then loop for 5 fingers
351 int t_FingerId = 0;
352 for (uint32_t i = 0; i < t_NumFingers; i++)
353 {
354 uint32_t t_ParentID = 0;
355 // then the digits of the finger that are linked to the root of the finger.
356 for (uint32_t j = 0; j < t_NumJoints; j++)
357 {
358 t_Res = CoreSdk_AddNodeToSkeletonSetup(p_SklIndex, CreateNodeSetup(1 + t_FingerId + j, t_ParentID, t_Fingers[i * 4 + j].x, t_Fingers[i * 4 + j].y, t_Fingers[i * 4 + j].z, "fingerdigit"));
359 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
360 {
361 printf("Failed to Add Node To Skeleton Setup. The error given %d.", t_Res);
362 return false;
363 }
364 t_ParentID = 1 + t_FingerId + j;
365 }
366 t_FingerId += t_NumJoints;
367 }
368 return true;
369}
370
376bool SDKMinimalClient::SetupHandChains(uint32_t p_SklIndex)
377{
378 // Add the Hand chain, this identifies the wrist of the hand
379 {
380 ChainSettings t_ChainSettings;
381 ChainSettings_Init(&t_ChainSettings);
382 t_ChainSettings.usedSettings = ChainType::ChainType_Hand;
383 t_ChainSettings.hand.handMotion = HandMotion::HandMotion_IMU;
384 t_ChainSettings.hand.fingerChainIdsUsed = 5; //we will have 5 fingers
385 t_ChainSettings.hand.fingerChainIds[0] = 1; //links to the other chains we will define further down
386 t_ChainSettings.hand.fingerChainIds[1] = 2;
387 t_ChainSettings.hand.fingerChainIds[2] = 3;
388 t_ChainSettings.hand.fingerChainIds[3] = 4;
389 t_ChainSettings.hand.fingerChainIds[4] = 5;
390
391 ChainSetup t_Chain;
392 ChainSetup_Init(&t_Chain);
393 t_Chain.id = 0; //Every ID needs to be unique per chain in a skeleton.
394 t_Chain.type = ChainType::ChainType_Hand;
395 t_Chain.dataType = ChainType::ChainType_Hand;
396 t_Chain.side = Side::Side_Left;
397 t_Chain.dataIndex = 0;
398 t_Chain.nodeIdCount = 1;
399 t_Chain.nodeIds[0] = 0; //this links to the hand node created in the SetupHandNodes
400 t_Chain.settings = t_ChainSettings;
401
402 SDKReturnCode t_Res = CoreSdk_AddChainToSkeletonSetup(p_SklIndex, t_Chain);
403 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
404 {
405 return false;
406 }
407 }
408
409 // Add the 5 finger chains
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++)
416 {
417 ChainSettings t_ChainSettings;
418 ChainSettings_Init(&t_ChainSettings);
419 t_ChainSettings.usedSettings = t_FingerTypes[i];
420 t_ChainSettings.finger.handChainId = 0; //This links to the wrist chain above.
421 //This identifies the metacarpal bone, if none exists, or the chain is a thumb it should be set to -1.
422 //The metacarpal bone should not be part of the finger chain, unless you are defining a thumb which does need it.
423 t_ChainSettings.finger.metacarpalBoneId = -1;
424 t_ChainSettings.finger.useLeafAtEnd = false; //this is set to true if there is a leaf bone to the tip of the finger.
425 ChainSetup t_Chain;
426 ChainSetup_Init(&t_Chain);
427 t_Chain.id = i + 1; //Every ID needs to be unique per chain in a skeleton.
428 t_Chain.type = t_FingerTypes[i];
429 t_Chain.dataType = t_FingerTypes[i];
430 t_Chain.side = Side::Side_Left;
431 t_Chain.dataIndex = 0;
432 if (i == 0) // Thumb
433 {
434 t_Chain.nodeIdCount = 4; //The amount of node id's used in the array
435 t_Chain.nodeIds[0] = 1; //this links to the hand node created in the SetupHandNodes
436 t_Chain.nodeIds[1] = 2; //this links to the hand node created in the SetupHandNodes
437 t_Chain.nodeIds[2] = 3; //this links to the hand node created in the SetupHandNodes
438 t_Chain.nodeIds[3] = 4; //this links to the hand node created in the SetupHandNodes
439 }
440 else // All other fingers
441 {
442 t_Chain.nodeIdCount = 4; //The amount of node id's used in the array
443 t_Chain.nodeIds[0] = (i * 4) + 1; //this links to the hand node created in the SetupHandNodes
444 t_Chain.nodeIds[1] = (i * 4) + 2; //this links to the hand node created in the SetupHandNodes
445 t_Chain.nodeIds[2] = (i * 4) + 3; //this links to the hand node created in the SetupHandNodes
446 t_Chain.nodeIds[3] = (i * 4) + 4; //this links to the hand node created in the SetupHandNodes
447 }
448 t_Chain.settings = t_ChainSettings;
449
450 SDKReturnCode t_Res = CoreSdk_AddChainToSkeletonSetup(p_SklIndex, t_Chain);
451 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
452 {
453 return false;
454 }
455 }
456 return true;
457}
458
462{
463 if (s_Instance)
464 {
465 ClientSkeletonCollection* t_NxtClientSkeleton = new ClientSkeletonCollection();
466 t_NxtClientSkeleton->skeletons.resize(p_SkeletonStreamInfo->skeletonsCount);
467
468 for (uint32_t i = 0; i < p_SkeletonStreamInfo->skeletonsCount; i++)
469 {
470 CoreSdk_GetSkeletonInfo(i, &t_NxtClientSkeleton->skeletons[i].info);
471 t_NxtClientSkeleton->skeletons[i].nodes = new SkeletonNode[t_NxtClientSkeleton->skeletons[i].info.nodesCount];
472 CoreSdk_GetSkeletonData(i, t_NxtClientSkeleton->skeletons[i].nodes, t_NxtClientSkeleton->skeletons[i].info.nodesCount);
473 }
475 if (s_Instance->m_NextSkeleton != nullptr) delete s_Instance->m_NextSkeleton;
476 s_Instance->m_NextSkeleton = t_NxtClientSkeleton;
477 s_Instance->m_SkeletonMutex.unlock();
478 }
479}
int main()
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.
ChainType dataType
SkeletonType type
int32_t fingerChainIdsUsed
ManusVec3 position
NodeType type
ChainSettings settings
uint32_t parentID
SkeletonTargetType targetType
ChainType type
NodeSettings settings
SkeletonSettings settings
ChainSettingsFinger finger
uint32_t dataIndex
uint32_t nodeIds[MAX_CHAIN_LENGTH]
HandMotion handMotion
SkeletonTargetUserIndexData skeletonTargetUserIndexData
int32_t fingerChainIds[MAX_NUM_FINGER_IDS]
char name[MAX_NUM_CHARS_IN_SKELETON_NAME]
uint32_t nodeIdCount
ChainSettingsHand hand
char name[MAX_NUM_CHARS_IN_NODE_NAME]
uint32_t id
ChainType usedSettings
ManusTransform transform
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
Definition: SDKClient.hpp:83
Used to store all the final animated skeletons received from Core.
Definition: SDKClient.hpp:81
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.
void Run()
main loop
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.