/// <summary> /// Initialize Tango Service and Config. /// </summary> public void InitApplication() { Debug.Log("-----------------------------------Initializing Tango"); _TangoInitialize(); TangoConfig.InitConfig(TangoEnums.TangoConfigType.TANGO_CONFIG_DEFAULT); if (m_enableVideoOverlay && m_useExperimentalVideoOverlay) { int yTextureWidth = 0; int yTextureHeight = 0; int uvTextureWidth = 0; int uvTextureHeight = 0; TangoConfig.GetInt32(TangoConfig.Keys.EXPERIMENTAL_Y_TEXTURE_WIDTH, ref yTextureWidth); TangoConfig.GetInt32(TangoConfig.Keys.EXPERIMENTAL_Y_TEXTURE_HEIGHT, ref yTextureHeight); TangoConfig.GetInt32(TangoConfig.Keys.EXPERIMENTAL_UV_TEXTURE_WIDTH, ref uvTextureWidth); TangoConfig.GetInt32(TangoConfig.Keys.EXPERIMENTAL_UV_TEXTURE_HEIGHT, ref uvTextureHeight); if (yTextureWidth == 0 || yTextureHeight == 0 || uvTextureWidth == 0 || uvTextureHeight == 0) { Debug.Log("Video overlay texture sizes were not set properly"); } m_yuvTexture.ResizeAll(yTextureWidth, yTextureHeight, uvTextureWidth, uvTextureHeight); } }
/// <summary> /// Initialize depth perception. /// </summary> private void _InitializeDepth() { if (TangoConfig.SetBool(TangoConfig.Keys.ENABLE_DEPTH_PERCEPTION_BOOL, m_enableDepth) && m_enableDepth) { _SetDepthCallbacks(); } }
/// <summary> /// Initialize depth perception. /// </summary> private void _InitializeDepth() { if (TangoConfig.SetBool(TangoConfig.Keys.ENABLE_DEPTH_PERCEPTION_BOOL, m_enableDepth) && m_enableDepth) { _SetDepthCallbacks(); } bool depthConfigValue = false; TangoConfig.GetBool(TangoConfig.Keys.ENABLE_DEPTH_PERCEPTION_BOOL, ref depthConfigValue); Debug.Log("TangoConfig bool for key: " + TangoConfig.Keys.ENABLE_DEPTH_PERCEPTION_BOOL + " has value set of: " + depthConfigValue); }
/// <summary> /// Initialize depth perception. /// </summary> private void _InitializeDepth() { if (TangoConfig.SetBool(TangoConfig.Keys.ENABLE_DEPTH_PERCEPTION_BOOL, m_enableDepth) && m_enableDepth) { _SetDepthCallbacks(); } bool depthConfigValue = false; TangoConfig.GetBool(TangoConfig.Keys.ENABLE_DEPTH_PERCEPTION_BOOL, ref depthConfigValue); DebugLogger.GetInstance.WriteToLog(DebugLogger.EDebugLevel.DEBUG_INFO, "TangoConfig bool for key: " + TangoConfig.Keys.ENABLE_DEPTH_PERCEPTION_BOOL + " has value set of: " + depthConfigValue); }
/// <summary> /// Connect to the Tango Service. /// </summary> private void _TangoConnect() { if (TangoServiceAPI.TangoService_connect(m_callbackContext, TangoConfig.GetConfig()) != Common.ErrorType.TANGO_SUCCESS) { DebugLogger.GetInstance.WriteToLog(DebugLogger.EDebugLevel.DEBUG_CRITICAL, CLASS_NAME + ".Connect() Could not connect to the Tango Service!"); } else { DebugLogger.GetInstance.WriteToLog(DebugLogger.EDebugLevel.DEBUG_INFO, CLASS_NAME + ".Connect() Tango client connected to service!"); } }
/// <summary> /// Connect to the Tango Service. /// </summary> private void _TangoConnect() { if (!m_isServiceConnected) { m_isServiceConnected = true; if (TangoServiceAPI.TangoService_connect(m_callbackContext, TangoConfig.GetConfig()) != Common.ErrorType.TANGO_SUCCESS) { Debug.Log(CLASS_NAME + ".Connect() Could not connect to the Tango Service!"); } else { Debug.Log(CLASS_NAME + ".Connect() Tango client connected to service!"); } } }
/// <summary> /// Disconnect from the Tango service. /// /// This is called automatically when the TangoApplication goes away. You only need /// to call this to disconnect from the Tango service before the TangoApplication goes /// away. /// </summary> public void Shutdown() { Debug.Log("Tango Shutdown"); if (m_tangoConfig != null) { m_tangoConfig.Dispose(); m_tangoConfig = null; } if (m_tangoRuntimeConfig != null) { m_tangoRuntimeConfig.Dispose(); m_tangoRuntimeConfig = null; } _TangoDisconnect(); }
/// <summary> /// Connect to the Tango Service. /// </summary> private void _TangoConnect() { if (!m_isServiceConnected) { m_isServiceConnected = true; AndroidHelper.PerformanceLog("Unity _TangoConnect start"); if (TangoServiceAPI.TangoService_connect(m_callbackContext, TangoConfig.GetConfig()) != Common.ErrorType.TANGO_SUCCESS) { Debug.Log(CLASS_NAME + ".Connect() Could not connect to the Tango Service!"); } else { AndroidHelper.PerformanceLog("Unity _TangoConnect end"); Debug.Log(CLASS_NAME + ".Connect() Tango client connected to service!"); } } }
/// <summary> /// Initialize motion tracking. /// </summary> private void _InitializeMotionTracking(string UUID) { System.Collections.Generic.List <TangoCoordinateFramePair> framePairs = new System.Collections.Generic.List <TangoCoordinateFramePair>(); if (TangoConfig.SetBool(TangoConfig.Keys.ENABLE_AREA_LEARNING_BOOL, m_enableAreaLearning) && m_enableAreaLearning) { m_areaLearningSetSucces = true; } else { m_areaLearningSetSucces = false; } if (TangoConfig.SetBool(TangoConfig.Keys.ENABLE_MOTION_TRACKING_BOOL, m_enableMotionTracking) && m_enableMotionTracking) { TangoCoordinateFramePair motionTracking; motionTracking.baseFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_START_OF_SERVICE; motionTracking.targetFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_DEVICE; if (!string.IsNullOrEmpty(UUID)) { TangoConfig.SetString(TangoConfig.Keys.LOAD_AREA_DESCRIPTION_UUID_STRING, UUID); TangoCoordinateFramePair areaDescription; areaDescription.baseFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_AREA_DESCRIPTION; areaDescription.targetFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_DEVICE; TangoCoordinateFramePair startToADF; startToADF.baseFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_AREA_DESCRIPTION; startToADF.targetFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_START_OF_SERVICE; framePairs.Add(areaDescription); framePairs.Add(startToADF); } framePairs.Add(motionTracking); } if (framePairs.Count > 0) { _SetMotionTrackingCallbacks(framePairs.ToArray()); } TangoConfig.SetBool(TangoConfig.Keys.ENABLE_MOTION_TRACKING_AUTO_RECOVERY_BOOL, m_motionTrackingAutoReset); }
/// <summary> /// Initialize motion tracking. /// </summary> private void _InitializeMotionTracking(string UUID) { System.Collections.Generic.List <TangoCoordinateFramePair> framePairs = new System.Collections.Generic.List <TangoCoordinateFramePair>(); if (TangoConfig.SetBool(TangoConfig.Keys.ENABLE_MOTION_TRACKING_BOOL, m_enableMotionTracking) && m_enableMotionTracking) { TangoCoordinateFramePair motionTracking; motionTracking.baseFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_START_OF_SERVICE; motionTracking.targetFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_DEVICE; framePairs.Add(motionTracking); if (TangoConfig.SetBool(TangoConfig.Keys.ENABLE_AREA_LEARNING_BOOL, m_enableAreaLearning) && m_enableAreaLearning) { Debug.Log("Area Learning is enabled."); if (!string.IsNullOrEmpty(UUID)) { TangoConfig.SetBool("config_experimental_high_accuracy_small_scale_adf", m_useExperimentalADF); TangoConfig.SetString(TangoConfig.Keys.LOAD_AREA_DESCRIPTION_UUID_STRING, UUID); } TangoCoordinateFramePair areaDescription; areaDescription.baseFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_AREA_DESCRIPTION; areaDescription.targetFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_DEVICE; TangoCoordinateFramePair startToADF; startToADF.baseFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_AREA_DESCRIPTION; startToADF.targetFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_START_OF_SERVICE; framePairs.Add(areaDescription); framePairs.Add(startToADF); } } if (framePairs.Count > 0) { _SetMotionTrackingCallbacks(framePairs.ToArray()); } // The C API does not default this to on, but it is locked down. TangoConfig.SetBool(TangoConfig.Keys.ENABLE_LOW_LATENCY_IMU_INTEGRATION, true); TangoConfig.SetBool(TangoConfig.Keys.ENABLE_MOTION_TRACKING_AUTO_RECOVERY_BOOL, m_motionTrackingAutoReset); }
/// <summary> /// Shutdown this instance. /// </summary> public void Shutdown() { Debug.Log("Tango Shutdown"); TangoConfig.Free(); _TangoDisconnect(); }
/// <summary> /// Initialize Tango Service and Config. /// </summary> public void InitApplication() { Debug.Log("-----------------------------------Initializing Tango"); _TangoInitialize(); TangoConfig.InitConfig(TangoEnums.TangoConfigType.TANGO_CONFIG_DEFAULT); }
/// <summary> /// Raises the destroy event. /// </summary> void OnDestroy() { Debug.Log("On Destroy"); TangoConfig.Free(); _TangoDisconnect(); }