Ejemplo n.º 1
0
        private void ApplyAngles(DeviceType device, ref byte[] rawFrame)
        {
            var angles = RPY.ParseDataForOrientationAngles(rawFrame);

            if (device == DeviceType.Shirt)
            {
                AbsoluteAngles.SetUpperBodyAngles(
                    new UnityEngine.Vector3(angles.Center.Roll, angles.Center.Pitch, angles.Center.Yaw) * Mathf.Rad2Deg,
                    new UnityEngine.Vector3(angles.LeftUpper.Roll, angles.LeftUpper.Pitch, angles.LeftUpper.Yaw) *
                    Mathf.Rad2Deg,
                    new UnityEngine.Vector3(angles.LeftLower.Roll, angles.LeftLower.Pitch, angles.LeftLower.Yaw) *
                    Mathf.Rad2Deg,
                    new UnityEngine.Vector3(angles.RightUpper.Roll, angles.RightUpper.Pitch, angles.RightUpper.Yaw) *
                    Mathf.Rad2Deg,
                    new UnityEngine.Vector3(angles.RightLower.Roll, angles.RightLower.Pitch, angles.RightLower.Yaw) *
                    Mathf.Rad2Deg);
            }
            else if (device == DeviceType.Pants)
            {
                AbsoluteAngles.SetLowerBodyAngles(
                    new UnityEngine.Vector3(angles.Center.Roll, angles.Center.Pitch, angles.Center.Yaw) * Mathf.Rad2Deg,
                    new UnityEngine.Vector3(angles.LeftUpper.Roll, angles.LeftUpper.Pitch, angles.LeftUpper.Yaw) *
                    Mathf.Rad2Deg,
                    new UnityEngine.Vector3(angles.LeftLower.Roll, angles.LeftLower.Pitch, angles.LeftLower.Yaw) *
                    Mathf.Rad2Deg,
                    new UnityEngine.Vector3(angles.RightUpper.Roll, angles.RightUpper.Pitch, angles.RightUpper.Yaw) *
                    Mathf.Rad2Deg,
                    new UnityEngine.Vector3(angles.RightLower.Roll, angles.RightLower.Pitch, angles.RightLower.Yaw) *
                    Mathf.Rad2Deg);
            }
        }
Ejemplo n.º 2
0
        public bool IsActive(DeviceType device)
        {
            switch (device)
            {
            case DeviceType.Shirt:
                return(IsShirtActive);

            case DeviceType.Pants:
                return(ArePantsActive);

            case DeviceType.All:
                return(IsShirtActive && ArePantsActive);
            }
            return(false);
        }
Ejemplo n.º 3
0
 public void Calibrate(DeviceType device)
 {
     if (device == DeviceType.None)
     {
         Debug.LogError(name + ": Device is 'None'!");
         return;
     }
     if (IsActive(device))
     {
         Debug.LogError(name + ": Device '" + device + "' must be disconnected to calibrate!");
         return;
     }
     Debug.Log(name + ": Calibrating '" + device + "'...");
     _pullInterface.StartCalibration(device);
 }
Ejemplo n.º 4
0
        public void Connect(DeviceType device)
        {
            if (device == DeviceType.None)
            {
                Debug.LogError(name + ": Device is 'None'!");
                return;
            }
            if (IsActive(device))
            {
                Debug.LogError(name + ": Device '" + device + "' is already connected!");
                return;
            }
            // If should connect to both but we're already connected to one device, still connect to the other.
            if (device == DeviceType.All && IsShirtActive)
            {
                Debug.LogError(name + ": Device 'Shirt' is already connected!");
                device = DeviceType.Pants;
            }
            else if (device == DeviceType.All && ArePantsActive)
            {
                Debug.LogError(name + ": Device 'Pants' is already connected!");
                device = DeviceType.Shirt;
            }
            else if (device == DeviceType.Shirt && ArePantsActive)
            {
                Disconnect();
                device = DeviceType.All;
            }
            else if (device == DeviceType.Pants && IsShirtActive)
            {
                Disconnect();
                device = DeviceType.All;
            }

            Debug.Log(name + ": Connecting '" + device + "'...");
            _pullInterface.StartStreaming(device);
        }
Ejemplo n.º 5
0
 public DeviceStatusEvent(DeviceType device, int status)
 {
 }