void setup_on_first_frame() { console_log("on first frame"); ipc->send_message("menu_plus", "set status", "verifying serial number"); serial_number = camera->getSerialNumber(); if (serial_number.size() == 10) { string char_string = ""; int char_count = 0; for (char& c : serial_number) { char_string += c; ++char_count; if (char_count == 4) break; } if (char_string == "0101") serial_verified = true; } if (!serial_verified) wait_for_device(); ipc->send_message("menu_plus", "set loading progress", "10"); console_log("serial number: " + serial_number); data_path_current_module = data_path + slash + serial_number; int x_accel; int y_accel; int z_accel; camera->getAccelerometerValues(&x_accel, &y_accel, &z_accel); Point3f heading = imu.compute_azimuth(x_accel, y_accel, z_accel); ipc->send_message("menu_plus", "set status", "loading calibration data"); reprojector.load(*ipc, true); ipc->send_message("menu_plus", "set loading progress", "40"); ipc->send_message("menu_plus", "set status", "initializing camera"); CameraInitializerNew::init(camera); ipc->send_message("menu_plus", "set status", "loading pose data"); pose_estimator.init(); ipc->send_message("menu_plus", "set loading progress", "70"); ipc->send_message("menu_plus", "set status", "starting cursor subprocess"); #ifdef _WIN32 child_module_name = "win_cursor_plus"; if (IsWindows8OrGreater()) child_module_path = executable_path + slash + "win_cursor_plus" + slash + "win_cursor_plus" + extension0; else child_module_path = executable_path + slash + "win_cursor_plus_fallback" + slash + "win_cursor_plus" + extension0; #elif __APPLE__ //todo: port to OSX #endif ipc->map_function("toggle imshow", [](const string message_body) { if (enable_imshow) enable_imshow = false; else enable_imshow = true; }); ipc->map_function("load settings", [](const string message_body) { load_settings(); }); ipc->send_message("menu_plus", "set loading progress", "100"); }
void on_first_frame() { bool serial_verfied = false; serial_number = camera->getSerialNumber(); if (serial_number.size() == 10) { string char_string = ""; int char_count = 0; for (char& c : serial_number) { char_string += c; ++char_count; if (char_count == 4) break; } if (char_string == "0101") serial_verfied = true; } if (!serial_verfied) { hide_cursors(); COUT << "please reconnect your Touch+ sensor" << endl; COUT << "restarting" << endl; wait_for_device(); } data_path_current_module = data_path + "\\" + serial_number; int x_accel; int y_accel; int z_accel; camera->getAccelerometerValues(&x_accel, &y_accel, &z_accel); Point3d heading = imu.compute_azimuth(x_accel, y_accel, z_accel); // if (heading.y > 60) // mode = "tool"; // else mode = "surface"; ipc->send_message("menu_plus", "show notification", "Please wait:Initializing Touch+ Software"); reprojector.load(*ipc); CameraInitializerNew::init(camera); pose_estimator.init(); if (mode == "surface") { child_module_name = "win_cursor_plus"; if (IsWindows8OrGreater()) child_module_path = executable_path + "\\win_cursor_plus\\win_cursor_plus.exe"; else child_module_path = executable_path + "\\win_cursor_plus_fallback\\win_cursor_plus.exe"; ipc->open_udp_channel("win_cursor_plus"); ipc->send_message("menu_plus", "show window", ""); ipc->send_message("menu_plus", "show wiggle", ""); } else { ipc->open_udp_channel("unity_demo", 3333); ipc->send_message("menu_plus", "hide window", ""); } ipc->map_function("toggle imshow", [](const string message_body) { if (enable_imshow) { enable_imshow = false; destroyAllWindows(); } else enable_imshow = true; }); ipc->map_function("load settings", [](const string message_body) { load_settings(); }); increment_wait_count = true; }