Esempio n. 1
0
        // Update is called once per frame
        void Update()
        {
            manus_hand_t leftHand;
            manus_hand_t rightHand;

            // if the retrieval of the handdata is succesfull update the local value and wether the hand is closed
            if (Manus.ManusGetHand(session, device_type_t.GLOVE_LEFT, out leftHand) == manus_ret_t.MANUS_SUCCESS)
            {
                _leftHand = leftHand;
                UpdateCloseValue(AverageFingerValue(_leftHand), device_type_t.GLOVE_LEFT);
                //Debug.Log(_leftHand.raw.finger_sensor[0]);
                //Debug.Log(_leftHand.wrist.x + " " + _leftHand.wrist.y + " " + _leftHand.wrist.z + " " + _leftHand.wrist.w);

                ++counter;
                // if ((counter % 10) == 0) {
                srl.WriteLine(DateTime.Now.ToString("yyyy-MM-ddThh:mm:ss:ffff") + " " + _leftHand.wrist.x + " " + _leftHand.wrist.y + " " + _leftHand.wrist.z + " " + _leftHand.wrist.w + " " + _leftHand.raw.finger_sensor[0] + " " + _leftHand.raw.finger_sensor[1] + " " + _leftHand.raw.finger_sensor[2] + " " + _leftHand.raw.finger_sensor[3] + " " + _leftHand.raw.finger_sensor[4] + _leftHand.raw.finger_sensor[5] + " " + _leftHand.raw.finger_sensor[6] + " " + _leftHand.raw.finger_sensor[7] + " " + _leftHand.raw.finger_sensor[8] + " " + _leftHand.raw.finger_sensor[9]);
                //}
            }

            if (Manus.ManusGetHand(session, device_type_t.GLOVE_RIGHT, out rightHand) == manus_ret_t.MANUS_SUCCESS)
            {
                _rightHand = rightHand;

                UpdateCloseValue(AverageFingerValue(_rightHand), device_type_t.GLOVE_RIGHT);
                srr.WriteLine(DateTime.Now.ToString("yyyy-MM-ddThh:mm:ss:ffff") + " " + _rightHand.wrist.x + " " + _rightHand.wrist.y + " " + _rightHand.wrist.z + " " + _rightHand.wrist.w + " " + _rightHand.raw.finger_sensor[0] + " " + _rightHand.raw.finger_sensor[1] + " " + _rightHand.raw.finger_sensor[2] + " " + _rightHand.raw.finger_sensor[3] + " " + _rightHand.raw.finger_sensor[4] + _rightHand.raw.finger_sensor[5] + " " + _rightHand.raw.finger_sensor[6] + " " + _rightHand.raw.finger_sensor[7] + " " + _rightHand.raw.finger_sensor[8] + " " + _rightHand.raw.finger_sensor[9]);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Get the average value of all fingers combined on the given hand
        /// </summary>
        /// <param name="hand"></param>
        /// <returns></returns>
        private double AverageFingerValue(manus_hand_t hand)
        {
            int    sensors = 0;
            double total   = 0;

            // Loop through all of the finger values
            for (int bendPosition = 0; bendPosition < 10; bendPosition++)
            {
                // Only get the sensor values of the first bending point without the thumb (1,3,5,7)
                if (bendPosition < 8)
                {
                    sensors++;
                    total += hand.raw.finger_sensor[bendPosition];
                }
            }
            return(total / sensors);
        }
Esempio n. 3
0
 public static extern manus_ret_t ManusGetHand_id(manus_session_t session, UInt32 dongle_id, device_type_t device_type, out manus_hand_t out_hand);
Esempio n. 4
0
 public static extern manus_ret_t ManusGetHand(manus_session_t session, device_type_t device_type, out manus_hand_t out_hand);