public bool Initialize()
        {
            if (!SRanipal_Eye_API.IsViveProEye())
            {
                return(false);
            }
            // InitializeSranipal();

            return(SRanipal_Eye_Framework.Status == SRanipal_Eye_Framework.FrameworkStatus.WORKING);
        }
        private void Start()
        {
            if (!SRanipal_Eye_API.IsViveProEye())
            {
                _logger.Trace($"Is not ProEye, exit.");
                return;
            }

            _eyeMgr = GetComponentInChildren <EyeTrackingManager>();
            if (_eyeMgr)
            {
                _logger.Trace($"Found EyeTrackingManager.");
            }
            _mesh = _eyeMgr.targetMesh;
            if (_mesh)
            {
                _logger.Trace($"Found SkinnedMeshRenderer.");
            }

            _animator = GetComponentInChildren <Animator>();
            if (!_animator)
            {
                return;
            }
            var leftEyeTransform  = _animator.GetBoneTransform(HumanBodyBones.LeftEye);
            var rightEyeTransform = _animator.GetBoneTransform(HumanBodyBones.RightEye);

            if (!leftEyeTransform || !rightEyeTransform)
            {
                _logger.Trace($"Eye Tracking: Cannnot get Eye Transform.");
                return;
            }
            basicLeftEyeRot  = leftEyeTransform.localRotation;
            basicRightEyeRot = rightEyeTransform.localRotation;
            if (SRStatus == FrameworkStatus.WORKING)
            {
                workable = true;
                return;
            }
            Error result = SRanipal_API.Initial(SRanipal_Eye.ANIPAL_TYPE_EYE, IntPtr.Zero);

            if (result == Error.WORK)
            {
                _logger.Trace($"Initial Eye: {result}");
                SRStatus = FrameworkStatus.WORKING;
                workable = true;
            }
            else
            {
                _logger.Error($"Initial Eye: {result}");
                SRStatus = FrameworkStatus.ERROR;
            }
        }
Beispiel #3
0
    public bool Initialize(FieldOfUse fieldOfUse)
    {
        if (!SRanipal_Eye_API.IsViveProEye())
        {
            return(false);
        }

        _hmdToWorldTransformer = new HmdToWorldTransformer(estimatedEyeTrackerLatency_s: 0.040f);
        EnsureHTCFrameworkRunning();

        return(SRanipal_Eye_Framework.Status == SRanipal_Eye_Framework.FrameworkStatus.WORKING);
    }
                public void StartFramework()
                {
                    if (!EnableEye)
                    {
                        return;
                    }
                    if (Status == FrameworkStatus.WORKING)
                    {
                        return;
                    }
                    if (!SRanipal_Eye_API.IsViveProEye())
                    {
                        Status = FrameworkStatus.NOT_SUPPORT;
                        return;
                    }

                    Status = FrameworkStatus.START;
                    if (EnableEyeVersion == SupportedEyeVersion.version1)
                    {
                        Error result = SRanipal_API.Initial(SRanipal_Eye.ANIPAL_TYPE_EYE, IntPtr.Zero);
                        if (result == Error.WORK)
                        {
                            Debug.Log("[SRanipal] Initial Eye : " + result);
                            Status = FrameworkStatus.WORKING;
                        }
                        else
                        {
                            Debug.LogError("[SRanipal] Initial Eye : " + result);
                            Status = FrameworkStatus.ERROR;
                        }
                    }
                    else
                    {
                        Error result = SRanipal_API.Initial(SRanipal_Eye_v2.ANIPAL_TYPE_EYE_V2, IntPtr.Zero);
                        if (result == Error.WORK)
                        {
                            Debug.Log("[SRanipal] Initial Eye v2: " + result);
                            Status = FrameworkStatus.WORKING;
                        }
                        else
                        {
                            Debug.LogError("[SRanipal] Initial Eye v2: " + result);
                            Status = FrameworkStatus.ERROR;
                        }
                    }
                }
Beispiel #5
0
        private void Awake()
        {
            // Tobi XR Settings
            TobiiXR.Start(Settings);

            // Get the Participant Name
            _participantName = PlayerPrefs.HasKey("playerName")
                ? PlayerPrefs.GetString("playerName")
                : "DemoParticipant-" + DateTime.Now.ToFileTime();

            if (_participantName.Equals(""))
            {
                _participantName = "DemoParticipant-" + DateTime.Now.ToFileTime();
            }


            // Check eye calibration is required.
            bool isEyeCalibrationRequired = false;

            if (SRanipal_Eye_API.IsViveProEye())
            {
                int error = SRanipal_Eye_API.IsUserNeedCalibration(ref isEyeCalibrationRequired);
                if (isEyeCalibrationRequired)
                {
                    Debug.Log("Eye Calibration Required!");
                    Logger.Log(LogLevel.INFO, "Eye Calibration Required!");

                    SRanipal_Eye.LaunchEyeCalibration();
                    Debug.Log("Eye Calibration error: " + error);
                    Logger.Log(LogLevel.DEBUG, "Eye Calibration error: " + error);
                }
                else
                {
                    Debug.Log("Eye Calibration Not Required!");
                    Logger.Log(LogLevel.INFO, "Eye Calibration Not Required!");
                }
            }
            else
            {
                Debug.Log("Eye Tracking not supported in this device! Device is not HTC-Vive Pro Eye.");
                Logger.Log(LogLevel.INFO, "Eye Tracking not supported in this device! Device is not HTC-Vive Pro Eye.");
                enableEyeTracking = false;
            }
        }
 public void StopFramework()
 {
     if (SRanipal_Eye_API.IsViveProEye())
     {
         if (Status != FrameworkStatus.STOP)
         {
             if (EnableEyeVersion == SupportedEyeVersion.version1)
             {
                 Error result = SRanipal_API.Release(SRanipal_Eye.ANIPAL_TYPE_EYE);
                 if (result == Error.WORK)
                 {
                     Debug.Log("[SRanipal] Release Eye : " + result);
                 }
                 else
                 {
                     Debug.LogError("[SRanipal] Release Eye : " + result);
                 }
             }
             else
             {
                 Error result = SRanipal_API.Release(SRanipal_Eye_v2.ANIPAL_TYPE_EYE_V2);
                 if (result == Error.WORK)
                 {
                     Debug.Log("[SRanipal] Release Eye v2: " + result);
                 }
                 else
                 {
                     Debug.LogError("[SRanipal] Release Eye v2: " + result);
                 }
             }
         }
         else
         {
             Debug.Log("[SRanipal] Stop Framework : module not on");
         }
     }
     Status = FrameworkStatus.STOP;
 }