/// <summary> 
        /// Override of ILocalizer.
        /// </summary>
        public void UpdateLocalizer()
        {
            if (_slamInterop != null)
            {
                _slamInterop.TargetGO = _targetGO;
                _slamInterop.Update(_fromCompositor);

                if (_loadMapAtInitRequested && SensorsReady() )
                {
                    LoadSlamMap(_loadMapName);
                    _loadMapAtInitRequested = false;
                    _waitForSlamLoadingCoroutine = StartCoroutine(WaitForSlamLoading());
                }

                _slamInterop.GetTrackingStatus(out _status);
                ProcessSlamFeedback(_status, _lastStatus);
                _lastStatus = _status;

                if (_rotationOnlyTracking != _rotationOnlyTrackingPrevious)
                {
                    if (_rotationOnlyTracking)
                    {
                        onSlamTrackingLost.Invoke();
                    }
                    else
                    {
                        onSlamTrackingRelocalized.Invoke();
                    }

                    ToggleRotationOnlyTracking();
                    _rotationOnlyTrackingPrevious = _rotationOnlyTracking;
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Override of ILocalizer.
        /// </summary>
        public void UpdateLocalizer()
        {
            bool slamIsReady = SlamFeedback.FilterReady && SlamFeedback.TrackingReady && (SlamFeedback.percent_initialized == 100);

            if (_slamInterop != null)
            {
                _slamInterop.TargetGO = _targetGO;
                _slamInterop.Update(slamIsReady, _fromCompositor);

                if (_loadMapAtInitRequested && SlamFeedback.CameraReady)
                {
                    LoadSlamMap(_loadMapName);
                    _loadMapAtInitRequested      = false;
                    _waitForSlamLoadingCoroutine = StartCoroutine(WaitForSlamLoading());
                }

                if (_enableJsonFeedback && SlamFeedback != null)
                {
                    _lastSlamFeedback.ParseStruct(_feedbackStruct);

                    _slamInterop.GetSlamFeedback(out _feedbackStruct);
                    SlamFeedback.ParseStruct(_feedbackStruct);

                    ProcessSlamFeedback(SlamFeedback, _lastSlamFeedback);
                }

                if (_rotationOnlyTracking != _rotationOnlyTrackingPrevious)
                {
                    if (_rotationOnlyTracking)
                    {
                        onSlamTrackingLost.Invoke();
                    }
                    else
                    {
                        onSlamTrackingRelocalized.Invoke();
                    }

                    ToggleRotationOnlyTracking();
                    _rotationOnlyTrackingPrevious = _rotationOnlyTracking;
                }
            }
        }