void CheckToStart()
        {
            RH_Mode = RH.Init(HANDTYPE.RIGHT_HAND);
            LH_Mode = LH.Init(HANDTYPE.LEFT_HAND);
            print("RH_Mode: " + RH_Mode);
            print("LH_Mode: " + LH_Mode);
            if (RH_Mode && LH_Mode)
            {
                Mode               = VRTRIXGloveRunningMode.PAIR;
                status.text        = "GLOVE STATUS:   CONNECTED";
                mode.text          = "MODE:   PAIR";
                L_status_text.text = "LEFT HAND STATUS: CONNECTED";
                R_status_text.text = "RIGHT HAND STATUS: CONNECTED";
            }
            else if (RH_Mode)
            {
                Mode               = VRTRIXGloveRunningMode.RIGHT;
                status.text        = "GLOVE STATUS:   CONNECTED";
                mode.text          = "MODE:   RIGHT ONLY";
                R_status_text.text = "RIGHT HAND STATUS: CONNECTED";
            }
            else if (LH_Mode)
            {
                Mode               = VRTRIXGloveRunningMode.LEFT;
                status.text        = "GLOVE STATUS:   CONNECTED";
                mode.text          = "MODE:   LEFT ONLY";
                L_status_text.text = "LEFT HAND STATUS: CONNECTED";
            }
            else
            {
                Mode      = VRTRIXGloveRunningMode.NONE;
                mode.text = "MODE:   NONE";
            }


            if (RH_Mode)
            {
                RH_Thread = new Thread(ReceiveRHData);
                RH_Thread.Start();
            }

            if (LH_Mode)
            {
                LH_Thread = new Thread(ReceiveLHData);
                LH_Thread.Start();
            }
        }
 void Update()
 {
     if (RH_Mode && LH_Mode)
     {
         Mode = VRTRIXGloveRunningMode.PAIR;
     }
     else if (RH_Mode)
     {
         Mode = VRTRIXGloveRunningMode.RIGHT;
     }
     else if (LH_Mode)
     {
         Mode = VRTRIXGloveRunningMode.LEFT;
     }
     else
     {
         Mode = VRTRIXGloveRunningMode.NONE;
     }
 }
        void CheckToStart()
        {
            RH_Mode = RH.Init(HANDTYPE.RIGHT_HAND) && (RH_tracker != null);
            LH_Mode = LH.Init(HANDTYPE.LEFT_HAND) && (LH_tracker != null);
            if (RH_Mode && LH_Mode)
            {
                Mode = VRTRIXGloveRunningMode.PAIR;
            }
            else if (RH_Mode)
            {
                Mode = VRTRIXGloveRunningMode.RIGHT;
            }
            else if (LH_Mode)
            {
                Mode = VRTRIXGloveRunningMode.LEFT;
            }
            else
            {
                Mode = VRTRIXGloveRunningMode.NONE;
            }

            try
            {
                if (RH_Mode)
                {
                    ReceiveRHData();
                }

                if (LH_Mode)
                {
                    ReceiveLHData();
                }
            }
            catch (Exception e)
            {
                print("Exception caught: " + e);
            }
        }
Example #4
0
        void CheckToStart()
        {
            RH_tracker = CheckDeviceModelName(HANDTYPE.RIGHT_HAND);
            LH_tracker = CheckDeviceModelName(HANDTYPE.LEFT_HAND);
            RH_Mode    = RH.Init(HANDTYPE.RIGHT_HAND) && (RH_tracker != null);
            LH_Mode    = LH.Init(HANDTYPE.LEFT_HAND) && (LH_tracker != null);
            if (RH_Mode && LH_Mode)
            {
                Mode = VRTRIXGloveRunningMode.PAIR;
            }
            else if (RH_Mode)
            {
                Mode = VRTRIXGloveRunningMode.RIGHT;
            }
            else if (LH_Mode)
            {
                Mode = VRTRIXGloveRunningMode.LEFT;
            }
            else
            {
                Mode = VRTRIXGloveRunningMode.NONE;
            }


            if (RH_Mode)
            {
                RH_Thread = new Thread(ReceiveRHData);
                RH_Thread.Start();
                print("Righthand Port Opened!");
            }

            if (LH_Mode)
            {
                LH_Thread = new Thread(ReceiveLHData);
                LH_Thread.Start();
                print("Lefthand Port Opened!");
            }
        }
Example #5
0
        // Update is called once per frame
        void Update()
        {
            if (UIEnabled)
            {
                if (m_timeCounter < m_refreshTime)
                {
                    m_timeCounter += Time.deltaTime;
                    m_frameCounter++;
                }
                else
                {
                    m_lastFramerate = (float)m_frameCounter / m_timeCounter;
                    m_frameCounter  = 0;
                    m_timeCounter   = 0.0f;
                }
                m_FPS.GetComponent <Text>().text = "FRAME RATE:   " + m_lastFramerate.ToString() + " fps";


                if (RH_Mode)
                {
                    m_Status.GetComponent <Text>().text   = "GLOVE STATUS:   CONNECTED";
                    m_MODE.GetComponent <Text>().text     = "MODE:   RIGHT ONLY";
                    m_RHStatus.GetComponent <Text>().text = "RIGHT HAND STATUS: CONNECTED";

                    m_RHRadio.GetComponent <Text>().text = "Radio Strength:  " + RH.GetReceiveRadioStrength().ToString() + " dB";
                    RadioStrengthGUI(m_RHRadioBar.GetComponent <Image>(), RH.GetReceiveRadioStrength());
                    m_RHCal.GetComponent <Text>().text = "Cal Score:  " + RH.GetReceivedCalScoreMean().ToString();
                    CalScoreGUI(m_RHCalBar.GetComponent <Image>(), RH.GetReceivedCalScoreMean());

                    m_RHDataRate.GetComponent <Text>().text = "RIGHT HAND DATA RATE: " + RH.GetReceivedDataRate().ToString() + "/s";

                    m_RHand.GetComponent <Text>().text   = "R_Hand   " + RH.GetReceivedRotation(VRTRIXBones.R_Hand).ToString() + "    " + RH.GetReceivedCalScore(VRTRIXBones.R_Hand).ToString();
                    m_RThumb.GetComponent <Text>().text  = "R_Thumb   " + RH.GetReceivedRotation(VRTRIXBones.R_Thumb_2).ToString() + "    " + RH.GetReceivedCalScore(VRTRIXBones.R_Thumb_2).ToString();
                    m_RIndex.GetComponent <Text>().text  = "R_Index   " + RH.GetReceivedRotation(VRTRIXBones.R_Index_2).ToString() + "    " + RH.GetReceivedCalScore(VRTRIXBones.R_Index_2).ToString();
                    m_RMiddle.GetComponent <Text>().text = "R_Middle   " + RH.GetReceivedRotation(VRTRIXBones.R_Middle_2).ToString() + "    " + RH.GetReceivedCalScore(VRTRIXBones.R_Middle_2).ToString();
                    m_RRing.GetComponent <Text>().text   = "R_Ring   " + RH.GetReceivedRotation(VRTRIXBones.R_Ring_2).ToString() + "    " + RH.GetReceivedCalScore(VRTRIXBones.R_Ring_2).ToString();
                    m_RPinky.GetComponent <Text>().text  = "R_Pinky   " + RH.GetReceivedRotation(VRTRIXBones.R_Pinky_2).ToString() + "    " + RH.GetReceivedCalScore(VRTRIXBones.R_Pinky_2).ToString();
                }

                if (LH_Mode)
                {
                    m_Status.GetComponent <Text>().text   = "GLOVE STATUS:   CONNECTED";
                    m_MODE.GetComponent <Text>().text     = "MODE:   LEFT ONLY";
                    m_LHStatus.GetComponent <Text>().text = "LEFT HAND STATUS: CONNECTED";

                    m_LHRadio.GetComponent <Text>().text = "Radio Strength:  " + LH.GetReceiveRadioStrength().ToString() + " dB";
                    RadioStrengthGUI(m_LHRadioBar.GetComponent <Image>(), LH.GetReceiveRadioStrength());
                    m_LHCal.GetComponent <Text>().text = "Cal Score:  " + LH.GetReceivedCalScoreMean().ToString();
                    CalScoreGUI(m_LHCalBar.GetComponent <Image>(), LH.GetReceivedCalScoreMean());

                    m_LHDataRate.GetComponent <Text>().text = "LEFT HAND DATA RATE: " + LH.GetReceivedDataRate().ToString() + "/s";

                    m_LHand.GetComponent <Text>().text   = "L_HAND:   " + LH.GetReceivedRotation(VRTRIXBones.L_Hand) + "    " + LH.GetReceivedCalScore(VRTRIXBones.L_Hand).ToString();
                    m_LThumb.GetComponent <Text>().text  = "L_THUMB:   " + LH.GetReceivedRotation(VRTRIXBones.L_Thumb_2) + "    " + LH.GetReceivedCalScore(VRTRIXBones.L_Thumb_2).ToString();
                    m_LIndex.GetComponent <Text>().text  = "L_INDEX:   " + LH.GetReceivedRotation(VRTRIXBones.L_Index_2) + "    " + LH.GetReceivedCalScore(VRTRIXBones.L_Index_2).ToString();
                    m_LMiddle.GetComponent <Text>().text = "L_MIDDLE:   " + LH.GetReceivedRotation(VRTRIXBones.L_Index_2) + "    " + LH.GetReceivedCalScore(VRTRIXBones.L_Index_2).ToString();
                    m_LRing.GetComponent <Text>().text   = "L_RING:   " + LH.GetReceivedRotation(VRTRIXBones.L_Ring_2) + "    " + LH.GetReceivedCalScore(VRTRIXBones.L_Ring_2).ToString();
                    m_LPinky.GetComponent <Text>().text  = "L_PINKY:   " + LH.GetReceivedRotation(VRTRIXBones.L_Pinky_2) + "    " + LH.GetReceivedCalScore(VRTRIXBones.L_Pinky_2).ToString();
                }

                if (RH_Mode && LH_Mode)
                {
                    m_MODE.GetComponent <Text>().text = "MODE:   PAIR";
                }
            }

            if (RH_Mode)
            {
                Mode = VRTRIXGloveRunningMode.RIGHT;
            }
            if (LH_Mode)
            {
                Mode = VRTRIXGloveRunningMode.LEFT;
            }
            if (RH_Mode && LH_Mode)
            {
                Mode = VRTRIXGloveRunningMode.PAIR;
            }
        }