Ejemplo n.º 1
0
 public void SkipCalibration(bool ofRightHand)
 {
     if (currStage > VoidStage.WaitForStart) //I wont skip if we're waiting.
     {
         SG_CalibrationSequence calibrationLayer = ofRightHand ? rightCalibration : leftCalibration;
         if (calibrationLayer != null)
         {
             if (currStage == VoidStage.ConfirmCalibration && calibrationLayer.internalSequence != null &&
                 calibrationLayer.internalSequence is SGCore.Calibration.HG_QuickCalibration)
             {
                 Debug.Log("Attempting to still make something out of the calibration...");
                 ((SGCore.Calibration.HG_QuickCalibration)calibrationLayer.internalSequence).ManualCompleted = true; //bypass maually
             }
             else
             {
                 calibrationLayer.CancelCalibration();
             }
         }
         if (ofRightHand)
         {
             calibratingRight = false;
         }
         else
         {
             calibratingLeft = false;
         }
     }
     else
     {
         GoToStage(VoidStage.WaitingForFirst); //starting up instead...
     }
 }
Ejemplo n.º 2
0
 public static void StartCalibration(SG_CalibrationSequence sequence)
 {
     if (sequence != null)
     {
         sequence.StartCalibration(true);
         if (sequence.internalSequence != null && sequence.internalSequence is SGCore.Calibration.HG_QuickCalibration)
         {
             ((SGCore.Calibration.HG_QuickCalibration)sequence.internalSequence).autoEndAfter = -1;                     //disable auto ending.
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary> Unlocks the glove from this calibration sequence, and let others know it's finished. </summary>
 /// <param name="sequence"></param>
 /// <returns></returns>
 public virtual bool UnlockCalibraion(SG_CalibrationSequence sequence)
 {
     if (this.currentSequence == null || this.currentSequence == sequence)
     {
         this.currentSequence   = null;
         this.CalibrationLocked = false;
         this.CalibrationStage  = CalibrationStage.Done;
         this.CalibrationStateChanged.Invoke();
         return(true);
     }
     return(false);
 }
Ejemplo n.º 4
0
 /// <summary> Lock this glove to a SG_ClibrationSequence so that no others can interfere. Also lets us know this glove is currently being calibrated. </summary>
 /// <param name="sequence"></param>
 /// <returns></returns>
 public virtual bool LockCalibration(SG_CalibrationSequence sequence)
 {
     if (sequence != null && !CalibrationLocked)
     {
         this.currentSequence   = sequence;
         this.CalibrationLocked = true;
         this.CalibrationStage  = CalibrationStage.Calibrating;
         this.CalibrationStateChanged.Invoke();
         return(true);
     }
     return(false);
 }
Ejemplo n.º 5
0
 public bool CheckConfirm(bool shouldCheck, SG_TrackedHand hand, SG_CalibrationSequence sequence, ref bool[] gest)
 {
     if (shouldCheck)
     {
         float[] normalizedFlexion;
         if (hand != null && hand.gloveHardware != null && hand.gloveHardware.GetNormalizedFlexion(out normalizedFlexion))
         {
             bool allGood = true;
             //Debug.Log(SG.Util.SG_Util.ToString(normalizedFlexion));
             for (int f = 0; f < normalizedFlexion.Length && f < gest.Length && f < thumbsUpThresholds.Length; f++)
             {
                 if (gest[f])                         //finger is currently making a gesture
                 {
                     if (f == 0)
                     {
                         gest[f] = normalizedFlexion[f] < thumbsUpThresholds[f] + thumbPassThreshold;
                     }
                     else
                     {
                         gest[f] = normalizedFlexion[f] > thumbsUpThresholds[f] - thumbPassThreshold;
                     }
                 }
                 else                         //finger is not yet in the right spot
                 {
                     if (f == 0)
                     {
                         gest[f] = normalizedFlexion[f] < thumbsUpThresholds[f];
                     }
                     else
                     {
                         gest[f] = normalizedFlexion[f] > thumbsUpThresholds[f];
                     }
                 }
                 if (!gest[f])
                 {
                     allGood = false;
                 }
             }
             return(allGood);
         }
         return(false);
     }
     return(true);
 }
Ejemplo n.º 6
0
 public static bool GetCalibrationLayer(SG_TrackedHand hand, out SG_CalibrationSequence calibrationLayer)
 {
     calibrationLayer = hand != null && hand.calibration != null ? hand.calibration : null;
     return(calibrationLayer != null);
 }