Beispiel #1
0
        private void InitHydraRead()
        {
            if (Sixense.Init() == Sixense.SUCCESS)
            {
                int attempts   = 0;
                int base_found = 0;
                while (base_found == 0 && attempts++ < 2)
                {
                    base_found = Sixense.IsBaseConnected(0);

                    if (base_found == 0)
                    {
                        Thread.Sleep(1000);
                    }
                }

                if (base_found == 0)
                {
                    Sixense.Exit();
                    throw new Exception("Hydra not attached");
                }

                Sixense.SetActiveBase(0);
            }
            else
            {
                throw new Exception("Failed to initialize Hydra");
            }
        }
Beispiel #2
0
        //-----------------------------------------------------------------------
        public override Action Start()
        {
            int r = Sixense.Init();

            if (r == Sixense.SUCCESS)
            {
                int attempts   = 0;
                int base_found = 0;
                while (base_found == 0 && attempts < 2)
                {
                    Thread.Sleep(1000);
                    base_found = Sixense.IsBaseConnected(0);
                }

                if (base_found == 0)
                {
                    Sixense.Exit();
                    throw new Exception("Hydra not attached");
                }

                Controller    = new Sixense.ControllerData[2];
                Controller[0] = new Sixense.ControllerData();
                Controller[1] = new Sixense.ControllerData();

                Angles    = new Sixense.ControllerAngles[2];
                Angles[0] = new Sixense.ControllerAngles();
                Angles[1] = new Sixense.ControllerAngles();

                r = Sixense.SetActiveBase(0);
                return(null);
            }
            else
            {
                throw new Exception("Failed to initialize Hydra");
            }
        }