예제 #1
0
        //Add vector/quarternion measurements to a finger
        private void add_hand_fingers(ref manus_hand_t device, ref device_type_t side, ref Manus_hand_obj manus_hand)
        {
            List <Finger> single_hand_array = new List <Finger>(); //Finger array
            List <pose>   temp_finger;                             //Temporary array for bones.

            for (int i = 0; i < 5; i++)                            //Illiterate through the fingers
            {
                temp_finger = new List <pose>();
                for (int j = 0; j < 5; j++)      //Illiterate through the poses.
                {
                    pose temp_pose = new pose(); //Temporary pose format.
                    temp_pose.rotation    = process_quat(device.fingers[i].joints[j].rotation);
                    temp_pose.translation = process_vector(device.fingers[i].joints[j].translation);
                    temp_finger.Add(temp_pose);               //Add poses to a temporay finger array
                }
                Finger real_finger = new Finger(temp_finger); //Instantiate a finger class
                single_hand_array.Add(real_finger);           //Add the finger to the hand
            }


            //**NEW** Pass imu Data to device.
            quat_t[]     quarts          = device.raw.imu;
            Quaternion[] quarts_to_write = new Quaternion[2];
            quarts_to_write[0] = process_quat(quarts[0]);
            quarts_to_write[1] = process_quat(quarts[1]);
            manus_hand.set_imus(quarts_to_write);


            manus_hand.add_vector_fingers(single_hand_array); //Add in vector data from manus for each individual bone.
            manus_hand.set_wrist(process_quat(device.wrist)); //**NEW** Add in wrist data into the manus_hand_obj
        }
        /// <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);
        }
예제 #3
0
 //Add the calcuations for the arm calculations on the manus API
 private void add_arm_calc(ref manus_hand_t hand, ref ik_body_t body_side, ref ik_profile_t my_profile, ref Manus_hand_obj my_hand)
 {
     //double arm_calcs[2];
     ManusVR.Manus.ManusUpdateIK(session, ref body_side); //Broken, does nothing.
     //Hand function to set the profile characteristics of the arm.
     my_hand.set_lenghts_arm(my_profile.shoulderLength, my_profile.upperArmLength, my_profile.upperNeckLength, my_profile.lowerArmLength,
                             my_profile.lowerNeckLength, process_vector(my_profile.upperNeckOffset));
     ////print_quat(process_quat(body_side.left.lowerArm.rotation));
     ////print_vector(process_vector(body_side.left.lowerArm.translation));
 }
        public override bool IsFingerBent(Hand handId, Finger fingerId)
        {
#if VRTK_DEFINE_SDK_MANUS_VR
            manus_hand_t hand        = GetHand(HandToDeviceType(handId));
            ManusFingers fingerIndex = FingerIndiceToManusFinger(fingerId);

            return(hand.raw.finger_sensor[(int)fingerIndex] >= FINGER_CLOSE_BEND_THRESHOLD);
#else
            return(false);
#endif
        }
예제 #5
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.");
        }
예제 #6
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;
            }
        }