Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (ROSCommunicationManager.Instance.connectedToROS)
        {
            if (!languageCalled)
            {
                TextToSpeechManager.Instance.LoadLanguage();
                languageCalled = true;
            }

            if (!ntpTimeSet)
            {
                ntpTimeSet = true;
                UnbiasedTime.Init(MainMenuManager.Instance.currentSetup.GetIP());
            }

            //Load known object types from database
            if (!ObjectsManager.Instance.objectReloadInitiated)
            {
                ObjectsManager.Instance.ReloadObjectTypes();
                ObjectsManager.Instance.objectReloadInitiated = true;
            }

            if (!ObjectsManager.Instance.objectTypesLoaded)
            {
                return;
            }

            //wait until time synchronizes with ntp
            if (!UnbiasedTime.Instance.TimeSynchronized)
            {
                //Debug.Log("TIME STILL NOT SYNCHRONIZED");
                return;
            }

            //Load robot reach radius
            if (!robotRadiusCalled)
            {
                robotRadiusCalled = true;
                RobotHelper.LoadRobotRadius();
                RobotHelper.LoadTableSize();
            }

            if (!TextToSpeechManager.Instance.languageSet)
            {
                return;
            }

#if UNITY_EDITOR
            if (!calibrated)
            {
                calibrated = true;

                //StartCoroutine(startFakeCalibration());
                //GameObject super_root = new GameObject("super_root");
                //super_root.transform.position = Vector3.zero;
                //worldAnchor.transform.parent = super_root.transform;
                //super_root.transform.eulerAngles = new Vector3(-90f, 0f, 0f);
                worldAnchor.transform.eulerAngles = new Vector3(-90f, 20f, 0f);
                //worldAnchor.transform.Rotate(180f, 0f, 0f, Space.Self);

                worldAnchorVisualizationCube.gameObject.SetActive(true);
                worldAnchorRecalibrationButton.gameObject.SetActive(true);
                if (OnSystemStarted != null)
                {
                    OnSystemStarted();
                }
            }
#endif
#if !UNITY_EDITOR
            if (!anchorLoaded && !calibrated && !calibration_launched && (WorldAnchorManager.Instance.AnchorStore != null))
            {
                string[] ids = WorldAnchorManager.Instance.AnchorStore.GetAllIds();
                //world anchor is present
                if (ids.Length == 1)
                {
                    //attaching an existing anchor name will load it instead
                    WorldAnchorManager.Instance.AttachAnchor(worldAnchor.gameObject, ids[0]);
                    worldAnchorVisualizationCube.gameObject.SetActive(true);
                    worldAnchorRecalibrationButton.gameObject.SetActive(true);
                    //helpAnchorVisualizationCube.gameObject.SetActive(false);

                    anchorLoaded = true;
                    calibrated   = true;

                    if (OnSystemStarted != null)
                    {
                        OnSystemStarted();
                    }
                }
                else
                {
                    StartCoroutine(startCalibration());
                    calibration_launched = true;
                }
            }
#endif
        }
    }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     UnbiasedTime.Init("time.windows.com");
 }