8#define GO_TO_DISPLAY(p_Key,p_Function) if (GetKeyDown(p_Key)) { ClearConsole();\
9 m_CurrentInteraction = std::bind(&SDKClient::p_Function, this); return ClientReturnCode::ClientReturnCode_Success;}
11#define GO_TO_MENU_IF_REQUESTED() if (GetKeyDown('Q')) { ClearConsole();\
12 m_CurrentInteraction = nullptr; return ClientReturnCode::ClientReturnCode_Success;}
38 return ClientReturnCode::ClientReturnCode_FailedPlatformSpecificInitialization;
47 return ClientReturnCode::ClientReturnCode_FailedToResizeWindow;
51 if (t_IntializeResult != ClientReturnCode::ClientReturnCode_Success)
53 spdlog::error(
"Failed to initialize the Core functionality. The value returned was {}.", t_IntializeResult);
54 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
57 return ClientReturnCode::ClientReturnCode_Success;
82 case ClientState::ClientState_PickingConnectionType:
85 if (t_Result != ClientReturnCode::ClientReturnCode_Success) {
return t_Result; }
87 case ClientState::ClientState_LookingForHosts:
90 if (t_Result != ClientReturnCode::ClientReturnCode_Success &&
91 t_Result != ClientReturnCode::ClientReturnCode_FailedToFindHosts) {
95 case ClientState::ClientState_NoHostsFound:
98 if (t_Result != ClientReturnCode::ClientReturnCode_Success) {
return t_Result; }
100 case ClientState::ClientState_PickingHost:
103 if (t_Result != ClientReturnCode::ClientReturnCode_Success) {
return t_Result; }
105 case ClientState::ClientState_ConnectingToCore:
108 if (t_Result != ClientReturnCode::ClientReturnCode_Success) {
return t_Result; }
110 case ClientState::ClientState_DisplayingData:
121 if (t_Result != ClientReturnCode::ClientReturnCode_Success) {
return t_Result; }
123 case ClientState::ClientState_Disconnected:
126 if (t_Result != ClientReturnCode::ClientReturnCode_Success) {
return t_Result; }
130 spdlog::error(
"Encountered the unrecognized state {}.",
static_cast<int>(
m_State));
131 return ClientReturnCode::ClientReturnCode_UnrecognizedStateEncountered;
137 spdlog::info(
"Pressed escape, so the client will now close.");
143 std::this_thread::sleep_for(std::chrono::milliseconds(10));
146 return ClientReturnCode::ClientReturnCode_Success;
155 if (t_Result != SDKReturnCode::SDKReturnCode_Success)
157 spdlog::error(
"Failed to shut down the SDK wrapper. The value returned was {}.", t_Result);
158 return ClientReturnCode::ClientReturnCode_FailedToShutDownSDK;
163 return ClientReturnCode::ClientReturnCode_FailedPlatformSpecificShutdown;
166 return ClientReturnCode::ClientReturnCode_Success;
174 spdlog::info(
"Connected to manus core.");
183 if (t_Result == SDKReturnCode::SDKReturnCode_Success)
185 const std::string t_Versions =
"Sdk version : " + std::string(t_SdkVersion.
versionInfo) +
", Core version : " + std::string(t_CoreVersion.
versionInfo) +
".";
189 spdlog::info(
"Versions are compatible.{}", t_Versions);
193 spdlog::warn(
"Versions are not compatible with each other.{}", t_Versions);
198 spdlog::error(
"Failed to get the versions from the SDK. The value returned was {}.", t_Result);
201 uint32_t t_SessionId;
203 if (t_SessionIdResult == SDKReturnCode::SDKReturnCode_Success && t_SessionId != 0)
205 spdlog::info(
"Session Id: {}", t_SessionId);
210 spdlog::info(
"Failed to get the Session ID from Core. The value returned was{}.", t_SessionIdResult);
227 spdlog::info(
"Disconnected from manus core.");
243 for (uint32_t i = 0; i < p_SkeletonStreamInfo->
skeletonsCount; i++)
246 t_NxtClientSkeleton->
skeletons[i].nodes.resize(t_NxtClientSkeleton->
skeletons[i].info.nodesCount);
279 switch (p_SystemMessage->
type)
281 case SystemMessageType::SystemMessageType_TemporarySkeletonModified:
305 for (uint32_t i = 0; i < p_Ergo->
dataCount; i++)
318 if (t_Ergo ==
nullptr)
continue;
322 for (
int j = 0; j < ErgonomicsDataType::ErgonomicsDataType_MAX_SIZE; j++)
337 float t_Power =
static_cast<float>(std::pow(
339 static_cast<double>(p_NumDecimalsToKeep)));
340 return std::round(p_Value * t_Power) / t_Power;
366 if (t_InitializeResult != SDKReturnCode::SDKReturnCode_Success)
368 spdlog::error(
"Failed to initialize the Manus Core SDK. The value returned was {}.", t_InitializeResult);
369 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
373 if (t_CallBackResults != ::ClientReturnCode::ClientReturnCode_Success)
375 spdlog::error(
"Failed to initialize callbacks.");
376 return t_CallBackResults;
386 t_VUH.
up = AxisPolarity::AxisPolarity_PositiveY;
387 t_VUH.
view = AxisView::AxisView_ZFromViewer;
399 if (t_CoordinateResult != SDKReturnCode::SDKReturnCode_Success)
401 spdlog::error(
"Failed to initialize the Manus Core SDK coordinate system. The value returned was {}.", t_InitializeResult);
402 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
405 return ClientReturnCode::ClientReturnCode_Success;
414 if (t_ShutDownResult != SDKReturnCode::SDKReturnCode_Success)
416 spdlog::error(
"Failed to shutdown the SDK. The value returned was {}.", t_ShutDownResult);
417 return ClientReturnCode::ClientReturnCode_FailedToShutDownSDK;
421 if (t_IntializeResult != ClientReturnCode::ClientReturnCode_Success)
423 spdlog::error(
"Failed to initialize the SDK functionality. The value returned was {}.", t_IntializeResult);
424 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
427 return ClientReturnCode::ClientReturnCode_Success;
439 if (t_RegisterConnectCallbackResult != SDKReturnCode::SDKReturnCode_Success)
441 spdlog::error(
"Failed to register callback function for after connecting to Manus Core. The value returned was {}.", t_RegisterConnectCallbackResult);
442 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
449 if (t_RegisterDisconnectCallbackResult != SDKReturnCode::SDKReturnCode_Success)
451 spdlog::error(
"Failed to register callback function for after disconnecting from Manus Core. The value returned was {}.", t_RegisterDisconnectCallbackResult);
452 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
459 if (t_RegisterSkeletonCallbackResult != SDKReturnCode::SDKReturnCode_Success)
461 spdlog::error(
"Failed to register callback function for processing skeletal data from Manus Core. The value returned was {}.", t_RegisterSkeletonCallbackResult);
462 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
468 if (t_RegisterLandscapeCallbackResult != SDKReturnCode::SDKReturnCode_Success)
470 spdlog::error(
"Failed to register callback for landscape from Manus Core. The value returned was {}.", t_RegisterLandscapeCallbackResult);
471 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
478 if (t_RegisterSystemCallbackResult != SDKReturnCode::SDKReturnCode_Success)
480 spdlog::error(
"Failed to register callback function for system feedback from Manus Core. The value returned was {}.", t_RegisterSystemCallbackResult);
481 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
488 if (t_RegisterErgonomicsCallbackResult != SDKReturnCode::SDKReturnCode_Success)
490 spdlog::error(
"Failed to register callback function for ergonomics data from Manus Core. The value returned was {}.", t_RegisterErgonomicsCallbackResult);
491 return ClientReturnCode::ClientReturnCode_FailedToInitialize;
494 return ClientReturnCode::ClientReturnCode_Success;
507 bool t_BuiltInDebug =
false;
509 if (t_Result == SDKReturnCode::SDKReturnCode_Success)
513 spdlog::warn(
"The DLL was built in debug configuration, please rebuild in release before releasing.");
518 spdlog::error(
"Failed to check if the DLL was built in Debug Configuration. The value returned was {}.", t_Result);
521 spdlog::info(
"Press a key to choose a connection type, or [ESC] to exit.");
522 spdlog::info(
"[L] Local -> Automatically connect to Core running on this computer.");
523 spdlog::info(
"[H] Host -> Find a host running Core anywhere on the network.");
524 spdlog::info(
"[G] GRPC -> Try to connect to the preset GRPC address (See settings folder).");
529 spdlog::info(
"Picked local.");
533 m_State = ClientState::ClientState_LookingForHosts;
537 spdlog::info(
"Picked host.");
541 m_State = ClientState::ClientState_LookingForHosts;
545 spdlog::info(
"Picked GRPC.");
548 m_State = ClientState::ClientState_ConnectingToCore;
551 return ClientReturnCode::ClientReturnCode_Success;
558 spdlog::info(
"Looking for hosts...");
562 if (t_StartResult != SDKReturnCode::SDKReturnCode_Success)
564 spdlog::error(
"Failed to look for hosts. The error given was {}.", t_StartResult);
566 return ClientReturnCode::ClientReturnCode_FailedToFindHosts;
571 if (t_NumberResult != SDKReturnCode::SDKReturnCode_Success)
573 spdlog::error(
"Failed to get the number of available hosts. The error given was {}.", t_NumberResult);
575 return ClientReturnCode::ClientReturnCode_FailedToFindHosts;
580 spdlog::warn(
"No hosts found.");
581 m_State = ClientState::ClientState_NoHostsFound;
583 return ClientReturnCode::ClientReturnCode_FailedToFindHosts;
588 if (t_HostsResult != SDKReturnCode::SDKReturnCode_Success)
590 spdlog::error(
"Failed to get the available hosts. The error given was {}.", t_HostsResult);
592 return ClientReturnCode::ClientReturnCode_FailedToFindHosts;
596 m_State = ClientState::ClientState_ConnectingToCore;
597 return ClientReturnCode::ClientReturnCode_Success;
600 m_State = ClientState::ClientState_PickingHost;
601 return ClientReturnCode::ClientReturnCode_Success;
610 spdlog::info(
"No hosts were found. Retry?");
611 spdlog::info(
"[R] retry");
612 spdlog::info(
"[ESC] exit");
617 spdlog::info(
"Retrying.");
619 m_State = ClientState::ClientState_PickingConnectionType;
623 return ClientReturnCode::ClientReturnCode_Success;
633 spdlog::info(
"[R] retry [ESC] exit");
634 spdlog::info(
"Pick a host to connect to.");
635 spdlog::info(
"Found the following hosts:");
638 for (
unsigned int t_HostNumber = 0; t_HostNumber < 10 && t_HostNumber <
m_NumberOfHostsFound; t_HostNumber++)
641 "[{}] hostname \"{}\", IP address \"{}\" Version {}.{}.{}",
651 for (
unsigned int t_HostNumber = 0; t_HostNumber < 10 && t_HostNumber <
m_NumberOfHostsFound; t_HostNumber++)
655 spdlog::info(
"Selected host {}.", t_HostNumber);
658 m_State = ClientState::ClientState_ConnectingToCore;
666 spdlog::info(
"Retrying.");
668 m_State = ClientState::ClientState_PickingConnectionType;
671 return ClientReturnCode::ClientReturnCode_Success;
677 SDKReturnCode t_ConnectResult = SDKReturnCode::SDKReturnCode_Error;
689 if (t_ConnectResult == SDKReturnCode::SDKReturnCode_NotConnected)
691 m_State = ClientState::ClientState_NoHostsFound;
693 return ClientReturnCode::ClientReturnCode_Success;
695 if (t_ConnectResult != SDKReturnCode::SDKReturnCode_Success)
697 spdlog::error(
"Failed to connect to Core. The error given was {}.", t_ConnectResult);
699 return ClientReturnCode::ClientReturnCode_FailedToConnect;
702 m_State = ClientState::ClientState_DisplayingData;
710 return ClientReturnCode::ClientReturnCode_Success;
744 if (
m_Landscape ==
nullptr)
return ClientReturnCode::ClientReturnCode_Success;
759 return ClientReturnCode::ClientReturnCode_Success;
768 SPDLOG_INFO(
"<<Main Menu>> [ESC] quit");
769 SPDLOG_INFO(
"[G] Go To Gloves & Dongle Menu");
770 SPDLOG_INFO(
"[S] Go To Skeleton Menu");
771 SPDLOG_INFO(
"[X] Go To Temporary Skeleton Menu");
772 SPDLOG_INFO(
"[T] Go To Tracker Menu");
773 SPDLOG_INFO(
"[D] Go To Landscape Time Info");
785 return ClientReturnCode::ClientReturnCode_Success;
792 SPDLOG_INFO(
"[Q] Back <<Gloves & Dongles>> [ESC] quit");
793 SPDLOG_INFO(
"Haptic keys: left:([1]-[5] = pinky-thumb.) right:([6]-[0] = thumb-pinky.)");
805 return ClientReturnCode::ClientReturnCode_Success;
810 SPDLOG_INFO(
"[Q] Back <<Skeleton>> [ESC] quit");
811 SPDLOG_INFO(
"<Skeleton>[N] Load Skeleton [M] Unload Skeleton");
812 SPDLOG_INFO(
"<Skeleton Haptics> left:([1]-[5] = pinky-thumb) right:([6]-[0] = thumb-pinky)");
825 return ClientReturnCode::ClientReturnCode_Success;
830 SPDLOG_INFO(
"[Q] Back <<Gloves & Dongles>> [ESC] quit");
831 SPDLOG_INFO(
"[O] Toggle Test Tracker [G] Toggle per user tracker display");
842 return ClientReturnCode::ClientReturnCode_Success;
847 SPDLOG_INFO(
"[Q] Back <<Temporary Skeleton>> [ESC] quit");
848 SPDLOG_INFO(
"<Skeleton>[A] Auto allocate chains and load skeleton");
849 SPDLOG_INFO(
"<Skeleton>[B] Build Temporary Skeleton [C] Clear Temporary Skeleton [D] Clear All Temporary Skeletons For The Current Session");
850 SPDLOG_INFO(
"<Skeleton>[E] Save Temporary Skeleton To File, [F] Get Temporary Skeleton From File");
863 return ClientReturnCode::ClientReturnCode_Success;
868 SPDLOG_INFO(
"[Q] Back <<Landscape Time Data>> [ESC] quit");
880 return ClientReturnCode::ClientReturnCode_Success;
887 if (
m_Host ==
nullptr) {
return ClientReturnCode::ClientReturnCode_FailedToConnect; }
891 auto t_Duration = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::high_resolution_clock::now() -
m_TimeSinceLastDisconnect).count();
892 spdlog::info(
"The SDK lost connection with Manus Core {} seconds ago.", t_Duration);
893 spdlog::info(
"[P] Pick a new host. [ESC] exit");
899 spdlog::info(
"Automatically trying to reconnect to GRPC address.");
902 if (t_ReconnectResult != ClientReturnCode::ClientReturnCode_FailedToConnect)
904 return t_ReconnectResult;
909 spdlog::info(
"Automatically trying to reconnect to local host.");
912 if (t_ReconnectResult != ClientReturnCode::ClientReturnCode_FailedToConnect)
914 return t_ReconnectResult;
919 spdlog::info(
"[R] Try to reconnect to the last host {} at {}.",
m_Host->hostName,
m_Host->ipAddress);
922 spdlog::info(
"Reconnecting");
925 if (t_ReconnectResult != ClientReturnCode::ClientReturnCode_FailedToConnect)
927 return t_ReconnectResult;
937 spdlog::info(
"Picking new host.");
941 if (t_RestartResult != ClientReturnCode::ClientReturnCode_Success)
943 spdlog::error(
"Failed to Restart CoreConnection.");
944 return ClientReturnCode::ClientReturnCode_FailedToRestart;
947 m_State = ClientState::ClientState_PickingConnectionType;
950 return ClientReturnCode::ClientReturnCode_Success;
956 if (p_ReconnectionTime <= 0) { p_ReconnectionTime = std::numeric_limits<int32_t>::max(); }
957 if (p_ReconnectionAttempts <= 0) { p_ReconnectionAttempts = std::numeric_limits<int32_t>::max(); }
961 if (t_RestartResult != ClientReturnCode::ClientReturnCode_Success)
963 spdlog::error(
"Failed to Restart CoreConnection.");
964 return ClientReturnCode::ClientReturnCode_FailedToRestart;
967 std::chrono::high_resolution_clock::time_point t_Start = std::chrono::high_resolution_clock::now();
969 while ((p_ReconnectionAttempts > 0) && (p_ReconnectionTime > 0))
971 spdlog::info(
"Trying to reconnect to {} at {}. Attempt {}.",
m_Host->hostName,
m_Host->ipAddress, t_Attempt);
972 spdlog::info(
"Attempts remaining: {}. Seconds before time out: {}.", p_ReconnectionAttempts, p_ReconnectionTime);
976 if (t_ConnectionResult == SDKReturnCode::SDKReturnCode_Success)
978 spdlog::info(
"Reconnected to ManusCore.");
979 return ClientReturnCode::ClientReturnCode_Success;
985 if (t_ConnectionResult == ClientReturnCode::ClientReturnCode_Success)
987 spdlog::info(
"Reconnected to ManusCore.");
988 return ClientReturnCode::ClientReturnCode_Success;
994 if (t_ConnectionResult == SDKReturnCode::SDKReturnCode_Success)
996 spdlog::info(
"Reconnected to ManusCore.");
997 return ClientReturnCode::ClientReturnCode_Success;
1001 p_ReconnectionTime -=
static_cast<int32_t
>(std::chrono::duration_cast<std::chrono::seconds>(std::chrono::high_resolution_clock::now() - t_Start).count());
1002 --p_ReconnectionAttempts;
1006 spdlog::info(
"Failed to reconnect to ManusCore.");
1007 m_State = ClientState::ClientState_Disconnected;
1008 return ClientReturnCode::ClientReturnCode_FailedToConnect;
1016 const std::string t_FingerNames[
NUM_FINGERS_ON_HAND] = {
"[thumb] ",
"[index] ",
"[middle]",
"[ring] ",
"[pinky] " };
1020 int t_DataOffset = 0;
1021 if (!p_Left)t_DataOffset = 20;
1023 const std::string* t_JointNames = t_ThumbJointNames;
1024 for (
unsigned int t_FingerNumber = 0; t_FingerNumber <
NUM_FINGERS_ON_HAND; t_FingerNumber++)
1026 spdlog::info(
"{} {} spread: {:>6}, {} stretch: {:>6}, {} stretch: {:>6}, {} stretch: {:>6} ",
1027 t_FingerNames[t_FingerNumber],
1036 t_JointNames = t_FingerJointNames;
1045 spdlog::info(
" -- Ergo Timestamp {:02d}:{:02d}:{:02d}.{:03d} ~ {:02d}/{:02d}/{:d}(D/M/Y)",
1055 spdlog::info(
" ...No Data...");
1064 spdlog::info(
" ...No Data...");
1079 return "Glongle (Glove Dongle)";
1106 uint32_t t_DongleCount = 0;
1108 if (t_DongleCount == 0)
return;
1110 uint32_t* t_DongleIds =
new uint32_t[t_DongleCount]();
1111 if (
CoreSdk_GetDongleIds(t_DongleIds, t_DongleCount) != SDKReturnCode::SDKReturnCode_Success)
return;
1115 for (uint32_t i = 0; i < t_DongleCount; i++)
1118 spdlog::info(
" -- Dongle -- 0x{:X}", t_DongleData.
id);
1119 if (t_Result == SDKReturnCode::SDKReturnCode_Success)
1121 spdlog::info(
" Type: {} - {}",
1124 spdlog::info(
" License: {}", t_DongleData.
licenseType);
1128 spdlog::info(
" ...No Data...");
1184 uint32_t t_NumberOfAvailabletrackers = 0;
1186 if (t_TrackerResult != SDKReturnCode::SDKReturnCode_Success)
1188 spdlog::error(
"Failed to get tracker data. The error given was {}.", t_TrackerResult);
1192 spdlog::info(
"received available trackers :{} ", t_NumberOfAvailabletrackers);
1194 if (t_NumberOfAvailabletrackers == 0)
return;
1197 if (t_TrackerResult != SDKReturnCode::SDKReturnCode_Success)
1199 spdlog::error(
"Failed to get tracker data. The error given was {}.", t_TrackerResult);
1207 uint32_t t_NumberOfAvailableUsers = 0;
1209 if (t_UserResult != SDKReturnCode::SDKReturnCode_Success)
1211 spdlog::error(
"Failed to get user count. The error given was {}.", t_UserResult);
1214 if (t_NumberOfAvailableUsers == 0)
return;
1216 uint32_t* t_UserIds =
new uint32_t[t_NumberOfAvailableUsers];
1218 if (t_UserResult != SDKReturnCode::SDKReturnCode_Success)
1220 spdlog::error(
"Failed to get user data. The error given was {}.", t_UserResult);
1224 for (
size_t i = 0; i < t_NumberOfAvailableUsers; i++)
1226 uint32_t t_NumberOfAvailabletrackers = 0;
1228 if (t_TrackerResult != SDKReturnCode::SDKReturnCode_Success)
1230 spdlog::error(
"Failed to get tracker data. The error given was {}.", t_TrackerResult);
1234 if (t_NumberOfAvailabletrackers == 0)
continue;
1236 spdlog::info(
"received available trackers for user id[{}] :{} ", t_UserIds[i], t_NumberOfAvailabletrackers);
1238 if (t_NumberOfAvailabletrackers == 0)
return;
1241 if (t_TrackerResult != SDKReturnCode::SDKReturnCode_Success)
1243 spdlog::error(
"Failed to get tracker data. The error given was {}.", t_TrackerResult);
1253 case TimecodeFPS::TimecodeFPS_23_976:
1254 return "23.976 FPS (24 dropframe)";
1255 case TimecodeFPS::TimecodeFPS_24:
1257 case TimecodeFPS::TimecodeFPS_25:
1259 case TimecodeFPS::TimecodeFPS_29_97:
1260 return "29.97 FPS (30 dropframe)";
1261 case TimecodeFPS::TimecodeFPS_30:
1263 case TimecodeFPS::TimecodeFPS_50:
1265 case TimecodeFPS::TimecodeFPS_59_94:
1266 return "59.94 FPS (60 dropframe)";
1267 case TimecodeFPS::TimecodeFPS_60:
1270 return "Undefined FPS";
1291 case ChainType::ChainType_FingerIndex:
1293 spdlog::info(
"received Skeleton chain type: ChainType_FingerIndex");
1296 case ChainType::ChainType_FingerMiddle:
1298 spdlog::info(
"received Skeleton chain type: ChainType_FingerMiddle");
1301 case ChainType::ChainType_FingerPinky:
1303 spdlog::info(
"received Skeleton chain type: ChainType_FingerPinky");
1306 case ChainType::ChainType_FingerRing:
1308 spdlog::info(
"received Skeleton chain type: ChainType_FingerRing");
1311 case ChainType::ChainType_FingerThumb:
1313 spdlog::info(
"received Skeleton chain type: ChainType_FingerThumb");
1316 case ChainType::ChainType_Hand:
1318 spdlog::info(
"received Skeleton chain type: ChainType_Hand");
1321 case ChainType::ChainType_Head:
1323 spdlog::info(
"received Skeleton chain type: ChainType_Head");
1326 case ChainType::ChainType_Leg:
1328 spdlog::info(
"received Skeleton chain type: ChainType_Leg");
1331 case ChainType::ChainType_Neck:
1333 spdlog::info(
"received Skeleton chain type: ChainType_Neck");
1336 case ChainType::ChainType_Pelvis:
1338 spdlog::info(
"received Skeleton chain type: ChainType_Pelvis");
1341 case ChainType::ChainType_Shoulder:
1343 spdlog::info(
"received Skeleton chain type: ChainType_Shoulder");
1346 case ChainType::ChainType_Spine:
1348 spdlog::info(
"received Skeleton chain type: ChainType_Spine");
1351 case ChainType::ChainType_Arm:
1353 spdlog::info(
"received Skeleton chain type: ChainType_Arm");
1356 case ChainType::ChainType_Invalid:
1359 spdlog::info(
"received Skeleton chain type: ChainType_Invalid");
1377 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
1379 spdlog::error(
"Failed to get temporary skeleton. The error given was {}.", t_Res);
1414 static uint32_t t_TotalNumberOfTemporarySkeletonsInCore = 0;
1415 auto t_TimeSinceLastTemporarySkeletonUpdate = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() -
m_LastTemporarySkeletonUpdate).count();
1418 spdlog::info(
"Total number of temporary skeletons in core: {} ", t_TotalNumberOfTemporarySkeletonsInCore);
1423 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
1425 spdlog::error(
"Failed to get all temporary skeletons. The error given was {}.", t_Res);
1429 t_TotalNumberOfTemporarySkeletonsInCore = 0;
1430 for (uint32_t i = 0; i < t_TemporarySkeletonSessionsData.
sessionsCount; i++)
1438 t_TotalNumberOfTemporarySkeletonsInCore++;
1443 spdlog::info(
"Total number of temporary skeletons in core: {} ", t_TotalNumberOfTemporarySkeletonsInCore);
1455 uint32_t t_DongleId = 0;
1456 uint32_t t_GloveIds[2] = { 0,0 };
1457 uint32_t t_DongleCount = 0;
1459 if (t_DongleCount == 0)
return;
1461 uint32_t* t_DongleIds =
new uint32_t[t_DongleCount]();
1462 if (
CoreSdk_GetDongleIds(t_DongleIds, t_DongleCount) != SDKReturnCode::SDKReturnCode_Success)
return;
1464 for (uint32_t i = 0; i < t_DongleCount; i++)
1468 if (!t_GloveIds[0] && !t_GloveIds[1])
continue;
1469 t_DongleId = t_DongleIds[i];
1472 if (t_DongleId == 0)
return;
1475 const int t_LeftHand = 0;
1476 const int t_RightHand = 1;
1480 t_HapticState[t_LeftHand].shouldHapticFinger[1] =
GetKey(
'4');
1481 t_HapticState[t_LeftHand].shouldHapticFinger[2] =
GetKey(
'3');
1482 t_HapticState[t_LeftHand].shouldHapticFinger[3] =
GetKey(
'2');
1483 t_HapticState[t_LeftHand].shouldHapticFinger[4] =
GetKey(
'1');
1484 t_HapticState[t_RightHand].shouldHapticFinger[0] =
GetKey(
'6');
1485 t_HapticState[t_RightHand].shouldHapticFinger[1] =
GetKey(
'7');
1486 t_HapticState[t_RightHand].shouldHapticFinger[2] =
GetKey(
'8');
1487 t_HapticState[t_RightHand].shouldHapticFinger[3] =
GetKey(
'9');
1488 t_HapticState[t_RightHand].shouldHapticFinger[4] =
GetKey(
'0');
1492 static std::chrono::high_resolution_clock::time_point s_TimeOfLastHapticsCommandSent;
1493 const std::chrono::high_resolution_clock::time_point s_Now = std::chrono::high_resolution_clock::now();
1494 const long long s_MillisecondsSinceLastHapticCommand = std::chrono::duration_cast<std::chrono::milliseconds>(s_Now - s_TimeOfLastHapticsCommandSent).count();
1502 const float s_FullPower = 1.0f;
1506 if (t_GloveIds[t_HandNumber] == 0)
continue;
1514 if (t_Glove.
familyType != DeviceFamilyType::DeviceFamilyType_Prime1)
1524 uint32_t t_NumberOfHapticsDongles = 0;
1526 (t_NumberOfHapticsDongles == 0))
1537 for (
unsigned int t_FingerNumber = 0; t_FingerNumber <
NUM_FINGERS_ON_HAND; t_FingerNumber++)
1539 t_HapticsPowers[t_FingerNumber] = t_HapticState[t_HandNumber].shouldHapticFinger[t_FingerNumber] ? s_FullPower : 0.0f;
1554 delete[] t_HapticsDongles;
1581 const int t_LeftHand = 0;
1582 const int t_RightHand = 1;
1586 t_HapticState[t_LeftHand].shouldHapticFinger[1] =
GetKey(
'4');
1587 t_HapticState[t_LeftHand].shouldHapticFinger[2] =
GetKey(
'3');
1588 t_HapticState[t_LeftHand].shouldHapticFinger[3] =
GetKey(
'2');
1589 t_HapticState[t_LeftHand].shouldHapticFinger[4] =
GetKey(
'1');
1590 t_HapticState[t_RightHand].shouldHapticFinger[0] =
GetKey(
'6');
1591 t_HapticState[t_RightHand].shouldHapticFinger[1] =
GetKey(
'7');
1592 t_HapticState[t_RightHand].shouldHapticFinger[2] =
GetKey(
'8');
1593 t_HapticState[t_RightHand].shouldHapticFinger[3] =
GetKey(
'9');
1594 t_HapticState[t_RightHand].shouldHapticFinger[4] =
GetKey(
'0');
1598 static std::chrono::high_resolution_clock::time_point s_TimeOfLastHapticsCommandSent;
1599 const std::chrono::high_resolution_clock::time_point s_Now = std::chrono::high_resolution_clock::now();
1600 const long long s_MillisecondsSinceLastHapticCommand = std::chrono::duration_cast<std::chrono::milliseconds>(s_Now - s_TimeOfLastHapticsCommandSent).count();
1608 const float s_FullPower = 1.0f;
1615 for (
unsigned int t_FingerNumber = 0; t_FingerNumber <
NUM_FINGERS_ON_HAND; t_FingerNumber++)
1617 t_HapticsPowers[t_FingerNumber] = t_HapticState[t_HandNumber].shouldHapticFinger[t_FingerNumber] ? s_FullPower : 0.0f;
1619 bool t_IsHaptics =
false;
1683 CopyString(t_TrackerId.
id,
sizeof(t_TrackerId.
id), std::string(
"Test Tracker"));
1685 t_TrackerData.
isHmd =
false;
1687 t_TrackerData.
trackerType = TrackerType::TrackerType_Unknown;
1689 t_TrackerData.
rotation = { 1.0f, 0.0f, 0.0f, 0.0f };
1690 t_TrackerData.
quality = TrackerQuality::TrackingQuality_Trackable;
1692 t_TrackerDatas[0] = t_TrackerData;
1695 if (t_TrackerSend != SDKReturnCode::SDKReturnCode_Success)
1697 spdlog::error(
"Failed to send tracker data. The error given was {}.", t_TrackerSend);
1722 t_Node.
type = NodeType::NodeType_Joint;
1751 const uint32_t t_NumFingers = 5;
1752 const uint32_t t_NumJoints = 4;
1756 ManusVec3 t_Fingers[t_NumFingers * t_NumJoints] = {
1793 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
1795 spdlog::error(
"Failed to Add Node To Skeleton Setup. The error given was {}.", t_Res);
1801 for (uint32_t i = 0; i < t_NumFingers; i++)
1803 uint32_t t_ParentID = 0;
1805 for (uint32_t j = 0; j < t_NumJoints; j++)
1808 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
1810 printf(
"Failed to Add Node To Skeleton Setup. The error given %d.", t_Res);
1813 t_ParentID = 1 + t_FingerId + j;
1815 t_FingerId += t_NumJoints;
1831 t_ChainSettings.
usedSettings = ChainType::ChainType_Hand;
1843 t_Chain.
type = ChainType::ChainType_Hand;
1844 t_Chain.
dataType = ChainType::ChainType_Hand;
1845 t_Chain.
side = Side::Side_Left;
1849 t_Chain.
settings = t_ChainSettings;
1852 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
1854 spdlog::error(
"Failed to Add Chain To Skeleton Setup. The error given was {}.", t_Res);
1860 const ChainType t_FingerTypes[5] = { ChainType::ChainType_FingerThumb,
1861 ChainType::ChainType_FingerIndex,
1862 ChainType::ChainType_FingerMiddle,
1863 ChainType::ChainType_FingerRing,
1864 ChainType::ChainType_FingerPinky };
1865 for (
int i = 0; i < 5; i++)
1878 t_Chain.
type = t_FingerTypes[i];
1879 t_Chain.
dataType = t_FingerTypes[i];
1880 t_Chain.
side = Side::Side_Left;
1893 t_Chain.
nodeIds[0] = (i * 4) + 1;
1894 t_Chain.
nodeIds[1] = (i * 4) + 2;
1895 t_Chain.
nodeIds[2] = (i * 4) + 3;
1896 t_Chain.
nodeIds[3] = (i * 4) + 4;
1898 t_Chain.
settings = t_ChainSettings;
1901 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
1917 uint32_t t_SklIndex = 0;
1921 t_SKL.
type = SkeletonType::SkeletonType_Hand;
1932 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
1934 spdlog::error(
"Failed to Create Skeleton Setup. The error given was {}.", t_Res);
1946 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
1948 spdlog::error(
"Failed to load skeleton. The error given was {}.", t_Res);
1955 spdlog::error(
"Failed to give skeleton an ID.");
1965 spdlog::error(
"There was no skeleton for us to unload.");
1970 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
1972 spdlog::error(
"Failed to unload skeleton. The error given was {}.", t_Res);
1985 uint32_t t_SklIndex = 0;
1990 t_Settings.
targetType = SkeletonTargetType::SkeletonTarget_UserData;
1996 t_SKL.
type = SkeletonType::SkeletonType_Hand;
2001 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2003 spdlog::error(
"Failed to Create Skeleton Setup. The error given was {}.", t_Res);
2013 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2015 spdlog::error(
"Failed to allocate chains for skeleton. The error given was {}.", t_Res);
2022 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2024 spdlog::error(
"Failed to get info about skeleton. The error given was {}.", t_Res);
2031 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2033 spdlog::error(
"Failed to get skeleton setup chains. The error given was {}.", t_Res);
2042 for (
size_t i = 0; i < t_SkeletonInfo.
chainsCount; i++)
2044 if (t_Chains[i].dataType == ChainType::ChainType_Hand)
2046 t_Chains[i].
side = Side::Side_Left;
2049 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2051 spdlog::error(
"Failed to overwrite Chain To Skeleton Setup. The error given was {}.", t_Res);
2064 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2066 spdlog::error(
"Failed to load skeleton. The error given was {}.", t_Res);
2073 spdlog::error(
"Failed to give skeleton an ID.");
2091 bool t_IsSkeletonModified =
false;
2096 uint32_t t_SklIndex = 0;
2101 t_Settings.
targetType = SkeletonTargetType::SkeletonTarget_UserData;
2107 t_SKL.
type = SkeletonType::SkeletonType_Body;
2112 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2114 spdlog::error(
"Failed to Create Skeleton Setup. The error given was {}.", t_Res);
2120 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2122 spdlog::error(
"Failed to Add Node To Skeleton Setup. The error given was {}.", t_Res);
2127 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2129 spdlog::error(
"Failed to Add Node To Skeleton Setup. The error given was {}.", t_Res);
2134 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2136 spdlog::error(
"Failed to Add Node To Skeleton Setup. The error given was {}.", t_Res);
2143 t_ChainSettings.
usedSettings = ChainType::ChainType_Leg;
2152 t_Chain.
type = ChainType::ChainType_Leg;
2153 t_Chain.
dataType = ChainType::ChainType_Leg;
2159 t_Chain.
settings = t_ChainSettings;
2160 t_Chain.
side = Side::Side_Left;
2163 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2165 spdlog::error(
"Failed to Add Chain To Skeleton Setup. The error given was {}.", t_Res);
2171 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2173 spdlog::error(
"Failed to save temporary skeleton. The error given was {}.", t_Res);
2180 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2182 spdlog::error(
"Failed to get temporary skeleton. The error given was {}.", t_Res);
2187 t_ChainSettings.
usedSettings = ChainType::ChainType_Head;
2190 t_Chain.
type = ChainType::ChainType_Head;
2191 t_Chain.
dataType = ChainType::ChainType_Head;
2195 t_Chain.
settings = t_ChainSettings;
2196 t_Chain.
side = Side::Side_Center;
2199 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2201 spdlog::error(
"Failed to Add Chain To Skeleton Setup. The error given was {}.", t_Res);
2207 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2209 spdlog::error(
"Failed to save temporary skeleton. The error given was {}.", t_Res);
2216 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2218 spdlog::error(
"Failed to get info about skeleton. The error given was {}.", t_Res);
2225 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2227 spdlog::error(
"Failed to get skeleton setup chains. The error given was {}.", t_Res);
2234 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2236 spdlog::error(
"Failed to get skeleton setup nodes. The error given was {}.", t_Res);
2244 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2246 spdlog::error(
"Failed to overwrite Skeleton Setup. The error given was {}.", t_Res);
2253 t_Settings.
targetType = SkeletonTargetType::SkeletonTarget_GloveData;
2260 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2262 spdlog::error(
"Failed to overwrite Skeleton Setup. The error given was {}.", t_Res);
2267 t_Chains[0].
side = Side::Side_Right;
2268 t_Nodes[0].
type = NodeType::NodeType_Mesh;
2271 for (
size_t i = 0; i < t_SkeletonInfo.
nodesCount; i++)
2274 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2276 spdlog::error(
"Failed to Add Node To Skeleton Setup. The error given was {}.", t_Res);
2282 for (
size_t i = 0; i < t_SkeletonInfo.
chainsCount; i++)
2285 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2287 spdlog::error(
"Failed to Add Chains To Skeleton Setup. The error given was {}.", t_Res);
2300 t_IsSkeletonModified =
true;
2302 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2304 spdlog::error(
"Failed to save temporary skeleton. The error given was {}.", t_Res);
2316 spdlog::error(
"There are no Temporary Skeletons to clear!");
2321 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2323 spdlog::error(
"Failed to Clear Temporary Skeleton. The error given was {}.", t_Res);
2335 spdlog::error(
"There are no Temporary Skeletons to clear!");
2339 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2341 spdlog::error(
"Failed to Clear All Temporary Skeletons. The error given was {}.", t_Res);
2355 bool t_IsSkeletonModified =
false;
2359 uint32_t t_SklIndex = 0;
2363 t_SKL.
type = SkeletonType::SkeletonType_Hand;
2371 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2373 spdlog::error(
"Failed to Create Skeleton Setup. The error given was {}.", t_Res);
2384 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2386 spdlog::error(
"Failed to save temporary skeleton. The error given was {}.", t_Res);
2391 uint32_t t_TemporarySkeletonLengthInBytes;
2394 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2396 spdlog::error(
"Failed to compress temporary skeleton and get size. The error given was {}.", t_Res);
2399 unsigned char* t_TemporarySkeletonData =
new unsigned char[t_TemporarySkeletonLengthInBytes];
2404 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2406 spdlog::error(
"Failed to get compressed temporary skeleton data. The error given was {}.", t_Res);
2416 std::string t_DirectoryPath =
2417 t_DirectoryPathString
2419 +
"ManusTemporarySkeleton";
2423 std::string t_DirectoryPathAndFileName =
2426 +
"TemporarySkeleton.mskl";
2430 t_File.write((
char*)t_TemporarySkeletonData, t_TemporarySkeletonLengthInBytes);
2434 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2436 spdlog::error(
"Failed to Clear Temporary Skeleton after saving. The error given was {}.", t_Res);
2452 std::string t_DirectoryPath =
2453 t_DirectoryPathString
2455 +
"ManusTemporarySkeleton";
2459 SPDLOG_WARN(
"Failed to read from client file, the mentioned directory does not exist");
2464 std::string t_DirectoryPathAndFileName =
2467 +
"TemporarySkeleton.mskl";
2474 SPDLOG_WARN(
"Failed to read from client file, the file does not exist in the mentioned directory");
2479 t_File.seekg(0, t_File.end);
2480 int t_FileLength = (int)t_File.tellg();
2481 t_File.seekg(0, t_File.beg);
2484 unsigned char* t_TemporarySkeletonData =
new unsigned char[t_FileLength];
2485 t_File.read((
char*)t_TemporarySkeletonData, t_FileLength);
2490 uint32_t t_TemporarySkeletonLengthInBytes = t_FileLength;
2492 if (t_TemporarySkeletonData ==
nullptr)
2494 SPDLOG_WARN(
"Failed to read the compressed temporary skeleton data from file");
2495 delete[] t_TemporarySkeletonData;
2502 uint32_t t_SklIndex = 0;
2504 if (t_Res != SDKReturnCode::SDKReturnCode_Success)
2506 spdlog::error(
"Failed to Create Skeleton Setup. The error given was {}.", t_Res);
2516 if (t_Result != SDKReturnCode::SDKReturnCode_Success)
2518 SPDLOG_WARN(
"Failed to load temporary skeleton data from client file in Core, the error code was: {}.", t_Result);
2522 delete[] t_TemporarySkeletonData;
2537 t_TSInfo.
year = 6969;
std::string ConvertDeviceClassTypeToString(DeviceClassType p_Type)
std::string ConvertDeviceFamilyTypeToString(DeviceFamilyType p_Type)
#define GO_TO_DISPLAY(p_Key, p_Function)
std::string GetFPSEnumName(TimecodeFPS p_FPS)
#define GO_TO_MENU_IF_REQUESTED()
CORESDK_API SDKReturnCode CoreSdk_GetDataForDongle(uint32_t p_DongleId, DongleLandscapeData *p_DongleData)
Gets the data for a dongle with the given id.
CORESDK_API SDKReturnCode CoreSdk_GetSkeletonSetupNodes(uint32_t p_SkeletonSetupIndex, NodeSetup *p_SDK)
Get setup nodes for a SkeletonSetup at a given index. The size of the given array must match the node...
CORESDK_API SDKReturnCode CoreSdk_GetNumberOfAvailableTrackersForUserId(uint32_t *p_NumberOfAvailableTrackers, uint32_t p_UserId)
Get the number of available trackers for a user with given Id.
CORESDK_API SDKReturnCode CoreSdk_SaveTemporarySkeleton(uint32_t p_SkeletonSetupIndex, uint32_t p_SessionId, bool p_IsSkeletonModified)
Save a SkeletonSetup at a given index and sessionId into Manus Core for use in the Dev Tools....
CORESDK_API SDKReturnCode CoreSdk_GetSkeletonSetupChains(uint32_t p_SkeletonSetupIndex, ChainSetup *p_SDK)
Get setup chains for a SkeletonSetup at a given index. The size of the given array must match the cha...
CORESDK_API SDKReturnCode CoreSdk_GetNumberOfHapticsDongles(uint32_t *p_NumberOfHapticsDongles)
Get the number of available haptics dongles.
CORESDK_API SDKReturnCode CoreSdk_CompressTemporarySkeletonAndGetSize(uint32_t p_SkeletonSetupIndex, uint32_t p_SessionId, uint32_t *p_TemporarySkeletonLengthInBytes)
Send a temporary skeleton to Core to compress it (convert it into an array of bytes) and then get the...
CORESDK_API SDKReturnCode CoreSdk_OverwriteSkeletonSetup(uint32_t p_SkeletonSetupIndex, SkeletonSetupInfo p_SkeletonSetup)
Overwrite an existing SkeletonSetup at a given index. This will remove all chains and nodes from the ...
CORESDK_API SDKReturnCode CoreSdk_AllocateChainsForSkeletonSetup(uint32_t p_SkeletonSetupIndex)
Allocate chains for a SkeletonSetup at a given index.
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_GetNumberOfAvailableTrackers(uint32_t *p_NumberOfAvailableTrackers)
Get the number of available trackers.
CORESDK_API SDKReturnCode CoreSdk_GetIdsOfAvailableTrackers(TrackerId *p_IdsOfAvailableTrackers, uint32_t p_NumberOfIdsThatFitInArray)
Fill the given array with the IDs of available trackers. The size of the given array must match the n...
CORESDK_API SDKReturnCode CoreSdk_GetDongleIds(uint32_t *p_DongleIds, uint32_t p_NumberOfIdsThatFitInArray)
Fill the given array with the IDs of all available dongles. The size of the given array must match th...
CORESDK_API SDKReturnCode CoreSdk_ConnectGRPC()
Connect to the preset GRPC address.
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_GetDataForGlove_UsingGloveId(uint32_t p_GloveId, GloveLandscapeData *p_GloveData)
Get data for the glove with the given glove ID.
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_GetCompressedTemporarySkeletonData(unsigned char *p_TemporarySkeletonData, uint32_t p_TemporarySkeletonLengthInBytes)
Get the compressed temporary skeleton data which are stored internally when calling function CoreSdk_...
CORESDK_API SDKReturnCode CoreSdk_VibrateFingersForSkeleton(uint32_t p_SkeletonId, Side p_HandType, const float *p_Powers)
Vibrate the motor on the fingers of a haptic glove associated to skeleton with given id....
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_GetNumberOfDongles(uint32_t *p_NumberOfDongles)
Get the number of available dongles.
CORESDK_API SDKReturnCode CoreSdk_GetNumberOfAvailableUsers(uint32_t *p_NumberOfAvailableUsers)
Get the number of available users. Note that this is reliant on the landscape, and the first second a...
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_GetTemporarySkeleton(uint32_t p_SkeletonSetupIndex, uint32_t p_SessionId)
Get a SkeletonSetup at a given index and sessionId from Manus Core. This function does NOT return a l...
CORESDK_API SDKReturnCode CoreSdk_GetTemporarySkeletonFromCompressedData(uint32_t p_SkeletonSetupIndex, uint32_t p_SessionId, unsigned char *p_TemporarySkeletonData, uint32_t p_TemporarySkeletonLengthInBytes)
Send the compressed data (an array of bytes) retrieved from a file to Core to be decompressed and con...
CORESDK_API SDKReturnCode CoreSdk_ClearAllTemporarySkeletons()
Clear all temporary skeletons associated to the current session both in the sdk and core....
CORESDK_API SDKReturnCode CoreSdk_RegisterCallbackForOnConnect(ConnectedToCoreCallback_t p_ConnectedCallback)
Register the callback function that is called when manus core gets connected to the sdk.
CORESDK_API SDKReturnCode CoreSdk_GetSkeletonSetupInfo(uint32_t p_SkeletonSetupIndex, SkeletonSetupInfo *p_SDK)
Get setup info for a SkeletonSetup at a given index.
CORESDK_API SDKReturnCode CoreSdk_UnloadSkeleton(uint32_t p_SkeletonId)
Unload a skeleton with a certain ID from Manus Core, so data will no longer be generated for it.
CORESDK_API SDKReturnCode CoreSdk_ClearTemporarySkeleton(uint32_t p_SkeletonSetupIndex, uint32_t p_SessionId)
Clear a SkeletonSetup at a given index and sessionId in Manus Core and the SDK. The given setup index...
CORESDK_API SDKReturnCode CoreSdk_SetTimestampInfo(ManusTimestamp *p_Timestamp, ManusTimestampInfo p_Info)
Sets the timestamp according to the info (more readable form of timestamp).
CORESDK_API SDKReturnCode CoreSdk_GetTemporarySkeletonsForAllSessions(TemporarySkeletonSessionsData *p_temporarySkeletonSessionsData)
Get information (name and index) for the SkeletonSetups of the all sessions connected to Core.
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_WasDllBuiltInDebugConfiguration(bool *p_WasBuiltInDebugConfiguration)
Check if the wrapper DLL was built in the debug configuration.
CORESDK_API SDKReturnCode CoreSdk_GetHapticsDongleIds(uint32_t *p_HapticsDongleIds, uint32_t p_NumberOfIdsThatFitInArray)
Fill the given array with the IDs of all available haptics dongles. The size of the given array must ...
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_GetVersionsAndCheckCompatibility(ManusVersion *p_SdkVersion, ManusVersion *p_CoreVersion, bool *p_AreVersionsCompatible)
Get the SDK and Core version used and check if they are compatible with each other.
CORESDK_API SDKReturnCode CoreSdk_RegisterCallbackForLandscapeStream(LandscapeStreamCallback_t p_LandscapeStreamCallback)
Register the callback function that is called when the landscape data comes in.
CORESDK_API SDKReturnCode CoreSdk_RegisterCallbackForErgonomicsStream(ErgonomicsStreamCallback_t p_ErgonomicsStreamCallback)
Register the callback function that is called when ergonomics data comes in.
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_DoesSkeletonGloveSupportHaptics(uint32_t p_SkeletonId, Side p_HandType, bool *p_IsHaptics)
Identifies if the glove associated to the skeleton with given id and side is a haptic one.
CORESDK_API SDKReturnCode CoreSdk_GetIdsOfAvailableUsers(uint32_t *p_IdsOfAvailableUsers, uint32_t p_NumberOfIdsThatFitInArray)
Fill the given array with the IDs of all available users. The size of the given array must match the ...
CORESDK_API SDKReturnCode CoreSdk_GetIdsOfAvailableTrackersForUserId(TrackerId *p_IdsOfAvailableTrackers, uint32_t p_UserId, uint32_t p_NumberOfIdsThatFitInArray)
Fill the given array with the IDs of available trackers for a user with given Id. The size of the giv...
CORESDK_API SDKReturnCode CoreSdk_ConnectToHost(ManusHost p_Host)
Connect to a host using the given host information.
CORESDK_API SDKReturnCode CoreSdk_RegisterCallbackForSystemStream(SystemStreamCallback_t p_SystemStreamCallback)
Register the callback function that is called when core system related data comes in.
CORESDK_API SDKReturnCode CoreSdk_GetSkeletonSetupArraySizes(uint32_t p_SkeletonSetupIndex, SkeletonSetupArraySizes *p_SkeletonInfo)
Get the skeleton info (number of nodes and chains) for a SkeletonSetup at a given index.
CORESDK_API SDKReturnCode CoreSdk_GetSessionId(uint32_t *p_SessionId)
Get the current session Id.
CORESDK_API SDKReturnCode CoreSdk_SendDataForTrackers(const TrackerData *p_TrackerData, uint32_t p_NumberOfTrackers)
Send data to Core for a tracker.
CORESDK_API SDKReturnCode CoreSdk_OverwriteChainToSkeletonSetup(uint32_t p_SkeletonSetupIndex, ChainSetup p_Chain)
Overwrite a chain in a SkeletonSetup, the chain to be overwritten is idenfified by p_Chain....
CORESDK_API SDKReturnCode CoreSdk_VibrateFingers(uint32_t p_DongleId, Side p_HandType, const float *p_Powers)
Vibrate the motor on the given fingers of a haptic glove. The order of the fingers is Thumb,...
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_RegisterCallbackForOnDisconnect(DisconnectedFromCoreCallback_t p_DisconnectedCallback)
Register the callback function that is called when manus core gets disconnected from the sdk.
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 SDKReturnCode CoreSdk_GetGlovesForDongle(uint32_t p_DongleId, uint32_t *p_LeftGloveId, uint32_t *p_RightGloveId)
Get glove id's for given dongle id.
CORESDK_API SDKReturnCode CoreSdk_GetTimestampInfo(ManusTimestamp p_Timestamp, ManusTimestampInfo *p_Info)
Gets the timestamp info (more readable form of timestamp).
CORESDK_API void ErgonomicsData_Init(ErgonomicsData *p_Val)
Initializer for a ErgonomicsData struct.
CORESDK_API void SkeletonSettings_Init(SkeletonSettings *p_Val)
Initializer for a SkeletonSettings struct.
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 ManusTimestampInfo_Init(ManusTimestampInfo *p_Val)
Initializer for a ManusTimestampInfo 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 ManusTimestamp_Init(ManusTimestamp *p_Val)
Initializer for a ManusTimestamp struct.
CORESDK_API void ChainSetup_Init(ChainSetup *p_Val)
Initializer for a ChainSetup struct.
int32_t fingerChainIdsUsed
char api[MAX_NUM_CHARS_IN_TIMECODE_INTERFACE_STRINGS]
TemporarySkeletonInfo skeletonInfo[MAX_NUMBER_OF_SKELETONS_PER_SESSION]
DeviceLandscape gloveDevices
TimecodeInterface currentInterface
ManusTimestamp publishTime
bool useEndPointApproximations
SkeletonTargetType targetType
bool reverseKneeDirection
char versionInfo[MAX_NUM_CHARS_IN_VERSION]
TrackerType_t trackerType
char infoString[MAX_NUM_CHARS_IN_SYSTEM_ERROR_MESSAGE]
char name[MAX_NUM_CHARS_IN_TIMECODE_INTERFACE_STRINGS]
SkeletonSettings settings
char id[MAX_NUM_CHARS_IN_TRACKER_ID]
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]
SkeletonTargetUserData skeletonTargetUserData
char name[MAX_NUM_CHARS_IN_NODE_NAME]
ErgonomicsData data[MAX_NUMBER_OF_ERGONOMICS_DATA]
char licenseType[MAX_NUM_CHARS_IN_LICENSE_TYPE]
float data[ErgonomicsDataType_MAX_SIZE]
DeviceFamilyType familyType
GloveLandscapeData gloves[MAX_NUMBER_OF_GLOVES]
DeviceClassType classType
TemporarySkeletonsForSession temporarySkeletonsSessions[MAX_NUMBER_OF_SESSIONS]
NodeSettingsFlag usedSettings
SDKReturnCode
The return values that can be given by SDK wrapper functions.
#define MAX_NUMBER_OF_DONGLES
Used to descriptively refer to the max number of supported dongles. Used with arrays and loops to mak...
ChainType
Describes the possible chain types used when setting up the skeleton.
Side
Describes the possible chain side.
#define MAX_NUMBER_OF_TRACKERS
Constants for the maximum number of trackers. Used with arrays and loops to make them more descriptiv...
DeviceClassType
Describes the different types of device classes.
DeviceFamilyType
Describes the different types of Manus devices.
#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...
TimecodeFPS
The possible FPS rates.
@ DeviceClassType_Glongle
@ DeviceFamilyType_Prime1
@ DeviceFamilyType_Quantum
@ DeviceFamilyType_PrimeX
@ DeviceFamilyType_Prime2
Stores all chain settings.
Stores the chain setup information.
Stores the information regarding the coordinate system used by the client, defined as VUH (view,...
Stores all the received dongle data.
Stores the received ergonomics data.
Stores the information sent by the ergonomics stream.
Stores all the received glove data.
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 a single version string.
Stores the node setup information. Each node represents a segment of the skeleton that can be animate...
Stores all the possible skeleton settings.
Stores the amount of nodes and chains in the skeleton setup.
Stores the skeleton setup information.
Stores the information sent by the skeleton stream.
Stores the data associated to System messages received from Core.
Stores the temporary skeleton available for all sessions connected to Core.
Stores all the tracker data that can be sent or received.
Stores the name of a tracker.
std::string m_SystemMessage
void PrintSystemMessage()
Prints the last received system messages received from Core.
void ApplyConsolePosition(const int p_ConsoleCurrentOffset)
Set the current console position. This handles the platform-specific part of advancing the console po...
virtual ClientReturnCode NoHostsFound()
When no available hosts are found the user can either retry or exit.
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
static void ClearConsole(void)
Clear the console window.
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,...
void UpdateInput(void)
Update the current keyboard state.
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...
bool PlatformSpecificInitialization(void)
Initialise things only needed for this platform.
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
bool GetKeyDown(const int p_Key)
Returns true first time it is called when key is pressed.
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...
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.
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...
bool ResizeWindow(const short int p_ConsoleWidth, const short int p_ConsoleHeight, const short int p_ConsoleScrollback)
Resize the window, so the log messages will fit. Make sure not to enter illegal sizes in here or SetC...
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)
bool DoesFolderOrFileExist(std::string p_Path_UTF8)
Check if the given folder or file exists. The folder path given should be in UTF-8 format.
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
bool PlatformSpecificShutdown(void)
Shut down things only needed for this platform.
void GetTemporarySkeletonFromFile()
void AllocateChains()
This support function sets up an incomplete hand skeleton and then uses manus core to allocate chains...
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 ...
bool GetKey(const int p_Key)
Gets key's current state. True is pressed false is not pressed.
void UnloadTestSkeleton()
This support function is used to unload a skeleton from Core.
std::ofstream GetOutputFileStream(std::string p_Path_UTF8)
Get an output stream for the given file. The file's path should be in UTF-8 format.
int32_t m_SecondsToAttemptReconnecting
std::string GetDocumentsDirectoryPath_UTF8(void)
Get the path to the user's Documents folder. The string should be in UTF-8 format.
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 CreateFolderIfItDoesNotExist(std::string p_Path_UTF8)
Create the given folder if it does not exist. The folder path given should be in UTF-8 format.
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
static const std::string s_SlashForFilesystemPath
The slash character that is used in the filesystem.
std::ifstream GetInputFileStream(std::string p_Path_UTF8)
Get an input stream for the given file. The file's path should be in UTF-8 format.
uint32_t m_FirstLeftGloveID
ClientSkeletonCollection * m_Skeleton
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...
constexpr unsigned int NUMBER_OF_HANDS_SUPPORTED
Constant expression: number of hands supported by demo.
ClientReturnCode
Values that can be returned by this application.
Haptic settings for a single glove.