void Start()
 {
     Manus.ManusInit();
     glove    = new Glove(hand);
     testloop = 0;
     hg       = HandGesture.Default;
 }
Ejemplo n.º 2
0
 public void ParseContent(Manus manus, string header, string __)
 {
     if (!float.TryParse(header, out speed))
     {
         throw new ManusBuildingException(this.GetType().Name + " was unable to parse \"" + header + "\" as a number!");
     }
 }
Ejemplo n.º 3
0
 public void ParseContent(Manus manus, string header, string _)
 {
     if (!int.TryParse(header.Trim(), out p_steps))
     {
         throw new ManusBuildingException(this.GetType().Name + " was unable to parse \"" + header + "\" as an integer!");
     }
 }
Ejemplo n.º 4
0
 public void ParseContent(Manus manus, string header, string _)
 {
     if (!float.TryParse(header.Trim(), out waittime))
     {
         throw new ManusBuildingException(this.GetType().Name + " was unable to parse \"" + header + "\" as a float!");
     }
 }
Ejemplo n.º 5
0
 void Start()
 {
     Manus.ManusInit();
     glove           = new Glove(hand);
     timer           = new Timer();
     timer.AutoReset = false;
     timer.Elapsed  += Timer_Elapsed;
 }
        /// <summary>
        /// Returns the Manus hand object based on the given enum request.
        /// </summary>
        /// <param name="device">The enum for left/right hand</param>
        /// <returns>The Manus hand object</returns>
        public static manus_hand_t GetHand(device_type_t device)
        {
            manus_hand_t tempHand = new manus_hand_t();

            Manus.ManusGetHand(handData.Session, device, out tempHand);

            return(tempHand);
        }
Ejemplo n.º 7
0
        protected override void StartHaptics(HumanBodyBones bodyPart, BodyCoordinateHit hitLocation, float intensity)
        {
#if VRTK_DEFINE_SDK_MANUS_VR
            Manus.ManusSetVibration(handData.Session,
                                    isRightGlove ? device_type_t.GLOVE_RIGHT : device_type_t.GLOVE_LEFT,
                                    intensity,
                                    (ushort)hapticDuration);
#endif
        }
Ejemplo n.º 8
0
        protected override void CancelHaptics()
        {
#if VRTK_DEFINE_SDK_MANUS_VR
            Manus.ManusSetVibration(handData.Session,
                                    isRightGlove ? device_type_t.GLOVE_RIGHT : device_type_t.GLOVE_LEFT,
                                    0,
                                    (ushort)hapticDuration);
#endif
        }
        bool manusIsConnected(IEntity entity)
        {
            var vrGloveHand = entity.GetComponent <IF_VR_Glove_Hand>();

            HandDataManager.EnsureLoaded();
            var deviceType = vrGloveHand.Type == IF_VR_HandType.Left ? device_type_t.GLOVE_LEFT : device_type_t.GLOVE_RIGHT;

            vrGloveHand.Connected = Manus.ManusIsConnected(HandDataManager.ManusSession, deviceType);
            return(vrGloveHand.Connected);
        }
Ejemplo n.º 10
0
    /// <summary>
    /// Makes the motor in the Manus Glove vibrate for a certain duration
    /// </summary>
    /// <param name="aPower">The power of the motor from 0 to 1</param>
    /// <param name="aDuration">The duration in seconds</param>
    public int SetVibrationPeriod(float aPower, float aDuration)
    {
        if (timer == null || timer.Enabled)
        {
            return(Manus.ERROR);
        }

        timer.Interval = aDuration * 1000.0;
        timer.Start();
        return(Manus.ManusSetVibration(hand, aPower));
    }
Ejemplo n.º 11
0
        public void ParseContent(Manus manus, string header, string body)
        {
            // Reset so they dont take values from previous manus
            target     = null;
            doneAction = SetPopupSettings.Action.Undefined;
            slowPrint  = false;

            this.header = header;
            this.body   = body;
            //// Trim all the lines
            //this.body = string.Join("\n", new List<string>(body.Split('\n')).ConvertAll(line=>line.Trim()).ToArray());
        }
Ejemplo n.º 12
0
        //Cycles one period of update for each of the manus hands.
        void Update()
        {
            //Manus.ManusInit(out session);
            isL = Manus.ManusIsConnected(session, device_type_t.GLOVE_LEFT);
            isR = Manus.ManusIsConnected(session, device_type_t.GLOVE_RIGHT);
            add_manus_hand(ref lefth, ref leftraw, device_type_t.GLOVE_LEFT, left_arm, myProfileL);
            add_manus_hand(ref righth, ref rightraw, device_type_t.GLOVE_RIGHT, right_arm, myProfileR);

            //Finger[] f = this.hands[0].get_hand_profile_manus().ToArray();

            if (Is_right)
            {
                double[] ls = this.hands[1].get_raw_hand().ToArray();
                bat_value = this.hands[1].get_bat();
                index     = ls[0];
                middle    = ls[1];
                ring      = ls[2];
                thumb     = ls[3];
                //List<Finger> tempF = this.hands[1].get_hand();
                //List<pose> ps = tempF[my_finger_opt].get_finger_data();
                //my_quart = ps[select_option].rotation;
                my_quart   = this.hands[1].get_wrist();
                my_quart.x = (my_quart.x * 180F) / 3.14165F;
                my_quart.y = (my_quart.y * 180F) / 3.14165F;
                my_quart.z = (my_quart.z * 180F) / 3.14165F;
                my_quart.w = (my_quart.w * 180F) / 3.14165F;
                my_vec     = my_quart.eulerAngles;
            }
            else
            {
                double[] ls = this.hands[0].get_raw_hand().ToArray();
                bat_value = this.hands[0].get_bat();
                index     = ls[0];
                middle    = ls[1];
                ring      = ls[2];
                thumb     = ls[3];
                //List<Finger> tempF = this.hands[0].get_hand();
                //List<pose> ps = tempF[my_finger_opt].get_finger_data();
                //my_quart = ps[select_option].rotation;
                my_quart   = this.hands[0].get_wrist();
                my_quart.x = (my_quart.x * 180F) / 3.14165F;
                my_quart.y = (my_quart.y * 180F) / 3.14165F;
                my_quart.z = (my_quart.z * 180F) / 3.14165F;
                my_quart.w = (my_quart.w * 180F) / 3.14165F;
                my_vec     = my_quart.eulerAngles;
            }
            //Quaternion q = hands[0].get_wrist();

            // Debug.Log("Wrist data= X: " + q.x + "Y: " + q.y + "Z: " + q.z + "W: " + q.w);

            //Debug.Log(carpal_inx);
        }
Ejemplo n.º 13
0
        //I start the program.
        void Start()
        {
            Debug.Log("Starting Manus_API");
            session    = new IntPtr();
            lefth      = new manus_hand_t();
            righth     = new manus_hand_t();
            leftraw    = new manus_hand_raw_t();
            rightraw   = new manus_hand_raw_t();
            myProfileL = new ik_profile_t();
            myProfileR = new ik_profile_t();
            left_arm   = new ik_body_t();
            right_arm  = new ik_body_t();
            isR        = false;
            isL        = false;

            Manus.ManusInit(out session);
            Debug.Log("Done.");
        }
Ejemplo n.º 14
0
        //Function that phrases in a single finger
        private void add_manus_hand(ref manus_hand_t hand, ref manus_hand_raw_t raw_hand, device_type_t which_hand_side, ik_body_t body_side, ik_profile_t my_profile)
        {
            //Manus Hand Objects
            Manus_hand_obj hand_in_use = new Manus_hand_obj();

            //Process data for the left hand, including raw data.
            Manus.ManusGetHandRaw(session, which_hand_side, out raw_hand);
            Manus.ManusGetProfile(session, out my_profile);    ///Wrong assumption, it does not provide real-time data.
            Manus.ManusGetHand(session, which_hand_side, out hand);

            //Manus.ManusGetHand_id(session, 2602524395, which_hand_side, out hand);

            Manus.ManusGetBatteryLevel(session, which_hand_side, out bat_value);

            //Set Battery level
            hand_in_use.set_bat(bat_value);

            //Set Arm calculations
            add_arm_calc(ref hand, ref body_side, ref my_profile, ref hand_in_use);

            //Set the raw_double finger data from manus
            add_hand_fingers_raw(ref raw_hand, ref which_hand_side, ref hand_in_use);

            //Set manus_profile finger data
            add_manus_profile_hands(ref my_profile, ref hand_in_use);

            //Set regular Manus hand data
            add_hand_fingers(ref hand, ref which_hand_side, ref hand_in_use);

            //Add relevant data to the hands array
            if (which_hand_side == device_type_t.GLOVE_LEFT)
            {
                //hands.insert(hands.begin(),hand_in_use); //Left Glove
                hands[0] = hand_in_use;
            }
            else
            {
                //hands.assign(1, hand_in_use); //Right Glove
                hands[1] = hand_in_use;
            }
        }
Ejemplo n.º 15
0
    /// <summary>
    /// Constructor which loads the HandModel
    /// </summary>
    void Start()
    {
        // Ensure the library initialized correctly.
        Manus.ManusInit();

        // Initialize the glove and the associated skeletal model.
        glove = new Glove(hand);
        if (hand == GLOVE_HAND.GLOVE_LEFT)
        {
            modelObject   = Resources.Load <GameObject>("Manus_Handv2_Left");
            animationClip = Resources.Load <AnimationClip>("Manus_Handv2_Left");
        }
        else
        {
            modelObject   = Resources.Load <GameObject>("Manus_Handv2_Right");
            animationClip = Resources.Load <AnimationClip>("Manus_Handv2_Right");
        }

        gameRoot  = FindDeepChild(gameObject.transform, "Wrist");
        modelRoot = FindDeepChild(modelObject.transform, "Wrist");

        modelObject.SetActive(true);
    }
Ejemplo n.º 16
0
 /// <summary>
 /// Vibrate the glove
 /// </summary>
 private void VibrateHand(device_type_t device)
 {
     Manus.ManusSetVibration(HandData.Instance.Session, device, 0.7f, 150);
 }
 public static void ManusSDKDllInit()
 {
     Manus.ManusInit(out session);
 }
Ejemplo n.º 18
0
 public void VibrateVerySoftLeft()
 {
     Manus.ManusSetVibration(handData.Session, device_type_t.GLOVE_LEFT, 0.6f, 300);
 }
Ejemplo n.º 19
0
 public void VibrateSoftRight()
 {
     Manus.ManusSetVibration(handData.Session, device_type_t.GLOVE_RIGHT, 0.8f, 150);
 }
Ejemplo n.º 20
0
 public void VibrateSoftLeft()
 {
     Manus.ManusSetVibration(handData.Session, device_type_t.GLOVE_LEFT, 0.9f, 150);
 }
Ejemplo n.º 21
0
 public void VibrateVerySoftRight()
 {
     Manus.ManusSetVibration(handData.Session, device_type_t.GLOVE_RIGHT, 0.5f, 300);
 }
 /// <summary>
 /// Vibrate the glove
 /// </summary>
 private void VibrateHand()
 {
     Manus.ManusSetVibration(HandData.Session, DeviceType, 0.7f, 150);
 }
Ejemplo n.º 23
0
 //vibrate right hand
 private void VibrateHandRight()
 {
     Manus.ManusSetVibration(HandData.Instance.Session, DeviceTypeRight, 0.7f, 150);
 }
Ejemplo n.º 24
0
        public void ParseContent(Manus manus, string _, string body)
        {
            string[] allRows = body.Split(Loader.linebreaks, StringSplitOptions.None);

            for (int i = 0; i < allRows.Length; i++)
            {
                string row = allRows[i].Trim();
                if (row.Length == 0)
                {
                    continue;
                }

                Match match = Regex.Match(row, @"^([_\-\wåäöÅÄÖ.,]+)\s*=\s*(.+)\s*$");

                if (!match.Success)
                {
                    throw new ManusBuildingException("Unable to parse bubble settings \"" + allRows[i] + "\"");
                }

                string g1 = match.Groups[1].Value.TrimEnd();
                string g2 = match.Groups[2].Value.TrimEnd();

                switch (g1.ToLower())
                {
                case "action":
                    try {
                        doneAction = (Action)Enum.Parse(typeof(Action), g2, true);
                        if (doneAction == Action.Undefined)
                        {
                            throw new Exception();
                        }
                    } catch {
                        throw new ManusBuildingException("Unable to parse action, no enum value matches \"" + g2 + "\"");
                    }
                    break;

                case "target":
                    Match m = Regex.Match(g2, @"^\(([\s\d\.,\-;]+)\)$");

                    if (m.Success)
                    {
                        // It's in paranteses. Convert all to numbers
                        string       content = m.Groups[1].Value;
                        List <float> numbers;
                        try {
                            numbers = content.Split(';', ',').Select(s => float.Parse(s.Replace(" ", "").Replace("\t", ""))).ToList();
                        } catch {
                            throw new ManusBuildingException("Unable to parse target position. Invalid number representations in \"" + g2 + "\"");
                        }

                        switch (numbers.Count)
                        {
                        case 1: target = Mathf.RoundToInt(numbers[0]); break;

                        case 2: target = new Vector2(numbers[0], numbers[1]); break;

                        case 3: target = new Vector3(numbers[0], numbers[1], numbers[2]); break;

                        default:
                            throw new ManusBuildingException("Invalid number of number values (" + numbers.Count + "). Only (row), (x,y), and (x,y,z) are valid.");
                        }
                    }
                    else
                    {
                        // May be a selectable
                        target = g2;
                    }
                    break;

                case "slowprint":
                    slowPrint = MyParseBool(g2);
                    if (!slowPrint.HasValue)
                    {
                        throw new ManusBuildingException("Unable to parse slowprint, invalid boolean value \"" + g2 + "\"!");
                    }
                    break;

                default:
                    throw new ManusBuildingException("Unknown bubble setting \"" + g1 + "\"");
                }
            }
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Makes the motor in the Manus Glove vibrate at a constant power.
 /// If the motor is currently set with SetVibrationPeriod, that timer is stopped.
 /// Turn the motor off by setting the power to 0.
 /// </summary>
 /// <param name="aPower">The power of the motor from 0 to 1</param>
 public int SetConstantVibration(float aPower)
 {
     return(Manus.ManusSetVibration(hand, aPower));
 }
Ejemplo n.º 26
0
 void onApplicationQuit()
 {
     Manus.ManusExit();
 }
Ejemplo n.º 27
0
 private void Timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     Manus.ManusSetVibration(hand, 0.0f);
 }
Ejemplo n.º 28
0
 public void ParseContent(Manus manus, string _, string body)
 {
     code = body ?? string.Empty;
 }
Ejemplo n.º 29
0
 public void ParseContent(Manus manus, string _, string __)
 {
 }
 public static void ManusSDKDllShut()
 {
     Manus.ManusExit(session);
 }