예제 #1
0
 void Start()
 {
     calibrationController = FindObjectOfType <CalibrationController>();
     lifespan = 3f;
     calibrationController.lifespan = this.lifespan;
     //Debug.Log(new AccuracyCalculator(3, 30, 14).Accuracy());
 }
예제 #2
0
 private void InteractionEnded()
 {
     if (HandCalibrationMode && calibrationController != null && !RightPoseInProgress)
     {
         if (flowController.AddCalibrationController(calibrationController) &&
             flowController.leftHandEnabled && flowController.rightHandEnabled)
         {
             HandCalibrationMode = false;
             flowController.CalibrationFinished();
         }
         else
         {
             TextToSpeech.Instance.StopSpeaking();
             audioSource.Stop();
             if (calibrationController.IsRightHand() && flowController.leftHandEnabled)
             {
                 if (uiController.greekEnabled)
                 {
                     uiController.PrintText("Tο δεξι χέρι βαθμονομήθηκε επιτυχώς." + "\n" + "Επαναλάβετε την ίδια διαδικασία με το αριστερό χέρι σας");
                     audioSource.Stop();
                     audioSource.clip = uiController.doLeftCalibClip;
                     audioSource.Play();
                 }
                 else
                 {
                     uiController.PrintText("Right Hand calibrated successfully." + "\n" + "Now let's calibrate the left one");
                     TextToSpeech.Instance.StopSpeaking();
                     TextToSpeech.Instance.StartSpeaking("Right Hand calibrated successfully. Now let's calibrate the left one");
                 }
             }
             else if (!calibrationController.IsRightHand() && flowController.rightHandEnabled)
             {
                 if (uiController.greekEnabled)
                 {
                     uiController.PrintText("Tο αριστερό χέρι βαθμονομήθηκε επιτυχώς." + "\n" + "Επαναλάβετε την ίδια διαδικασία με το δεξί χέρι σας");
                     audioSource.Stop();
                     audioSource.clip = uiController.doRightCalibClip;
                     audioSource.Play();
                 }
                 else
                 {
                     uiController.PrintText("Left Hand calibrated successfully." + "\n" + " Now let's calibrate the right one");
                     TextToSpeech.Instance.StopSpeaking();
                     TextToSpeech.Instance.StartSpeaking("Left Hand calibrated successfully. Now let's calibrate the right one");
                 }
             }
             else
             {
                 HandCalibrationMode = false;
                 flowController.CalibrationFinished();
             }
             calibrationController = null;
         }
         handObject.SetActive(false);
         trackingHand = new HandStruct(false);
     }
 }
예제 #3
0
        private void pictureBox4_Click(object sender, EventArgs e)
        {
            CalibrationController calibrationController = new CalibrationController(new Calibration());

            timer1.Enabled = false;
            timer2.Enabled = false;
            this.Hide();
            calibrationController.view.Show();
            FormInteraction.IsCalibrationShow = true;
            timer3.Enabled = true;
        }
예제 #4
0
    public float GetHeadDisatnceLowerLimit(bool hand)
    {
        CalibrationController currentController = hand ? rightController : leftController;

        if (currentController.GetHighestPoseHeadHandDistance() > currentController.GetRightPoseHeadHandDistance())
        {
            return(currentController.GetRightPoseHeadHandDistance());
        }
        else
        {
            return(currentController.GetHighestPoseHeadHandDistance());
        }
    }
예제 #5
0
    private void InteractionManager_InteractionSourceDetected(InteractionSourceDetectedEventArgs args)
    {
        if (args.state.source.kind == InteractionSourceKind.Hand)
        {
            handObject.SetActive(true);
            UtilitiesScript.Instance.ChangeObjectColor(trackingHand.hand, Color.white);
            //Get hand position and illustrate it
            if (args.state.sourcePose.TryGetPosition(out Vector3 pos))
            {
                handObject.transform.position = pos;
            }

            //Define if it's the right hand
            bool IsRightHand = UtilitiesScript.Instance.IsRightFromHead(pos);
            trackingHand = new HandStruct(handObject, IsRightHand);
            // Control calibration
            if (HandCalibrationMode)
            {
                if (!flowController.IsHandCalibrated(IsRightHand))
                {
                    calibrationController = new CalibrationController(IsRightHand);
                    startTime             = Time.time;
                    RightPoseInProgress   = true;
                }
                else
                {
                    if (uiController.greekEnabled)
                    {
                        string handText = IsRightHand ? "Δεξί" : "Αριστερό";
                        uiController.PrintText(handText + " χέρι έχει ήδη βαθμονομηθεί");
                        audioSource.Stop();
                        audioSource.clip = IsRightHand ? uiController.rightAlreadyCalibClip : uiController.leftAlreadyCalibClip;
                        audioSource.Play();
                    }
                    else
                    {
                        string handText = IsRightHand ? "Right" : "Left";
                        uiController.PrintText(handText + " hand already calibrated");
                        TextToSpeech.Instance.StopSpeaking();
                        TextToSpeech.Instance.StartSpeaking(handText + "already calibrated");
                    }
                }
            }
            //Gather hand data
            if (DataCollectionMode) //Gather values for every hand movement
            {
                float height = Mathf.Abs(pos.y - Camera.main.transform.position.y);
                dataScript.AddValue(pos, height, trackingHand.rightHand);
            }
        }
    }
예제 #6
0
    public bool AddCalibrationController(CalibrationController controller)
    {
        //Store controllers
        if (controller.IsRightHand())
        {
            rightController = controller;
        }
        else
        {
            leftController = controller;
        }

        //Are controllers full ?
        return((rightController != null && leftController != null) ? true : false);
    }
예제 #7
0
 public void StartCalibration()
 {
     // Reset variables
     success            = 0;
     fail               = 0;
     timer              = 0;
     maxHeightRightHand = 0;
     maxHeightLeftHand  = 0;
     manipulations      = 0;
     violation          = 0;
     rightHandPlaying   = false;
     // Start hand calibration
     handsTrackingController.EnableHandCalibration();
     rightController = null;
     leftController  = null;
 }
예제 #8
0
 // Start is called before the first frame update
 void Start()
 {
     calibCube             = GameObject.Find("CalibCube");
     calibrationController = GameObject.Find("ARToolKit").GetComponent <CalibrationController>();
 }