Пример #1
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));
 }
Пример #2
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.");
        }
Пример #3
0
        ///***Wrong assumption, it does not provide real-time data***
        private void add_manus_profile_hands(ref ik_profile_t my_profile, ref Manus_hand_obj my_hand)
        {
            List <double> temporary_finger_array = new List <double>(); //Temporary array for doubles to insert into finger.
            List <Finger> fingers = new List <Finger>();

            //Horrible method of phrasing, but what happens is that a List array is phrased over from the manus array
            //Index Finger
            for (int c = 0; c < 4; c++)
            {
                ///    temporary_finger_array.Add(my_profile.handProfile.index.bones[c]);
                temporary_finger_array.Add(my_profile.handProfile.fingers[0].bones[c]);
                // Debug.Log(my_profile.handProfile.fingers[0].bones[c]);
                // Debug.Log("Quack");
            }
            Finger index_bone = new Finger(temporary_finger_array);    // Array is inserted into the finger object.

            temporary_finger_array.Clear();
            fingers.Add(index_bone);//Finger is added into hand.

            //Middle Finger
            for (int c = 0; c < 4; c++)
            {
                temporary_finger_array.Add(my_profile.handProfile.fingers[1].bones[c]);
            }
            Finger middle_bone = new Finger(temporary_finger_array);    // Array is inserted into the finger object.

            temporary_finger_array.Clear();
            fingers.Add(middle_bone);//Finger is added into hand.

            //Ring Finger
            for (int c = 0; c < 4; c++)
            {
                temporary_finger_array.Add(my_profile.handProfile.fingers[2].bones[c]);
            }
            Finger ring_bone = new Finger(temporary_finger_array);    // Array is inserted into the finger object.

            temporary_finger_array.Clear();
            fingers.Add(ring_bone);//Finger is added into hand.

            //Pinky Finger
            for (int c = 0; c < 4; c++)
            {
                temporary_finger_array.Add(my_profile.handProfile.fingers[3].bones[c]);
            }

            Finger pinky_bone = new Finger(temporary_finger_array);    // Array is inserted into the finger object.

            temporary_finger_array.Clear();
            fingers.Add(pinky_bone);//Finger is added into hand.

            //Thumb Finger
            for (int c = 0; c < 4; c++)
            {
                temporary_finger_array.Add(my_profile.handProfile.fingers[4].bones[c]);
            }
            Finger thumb_bone = new Finger(temporary_finger_array);    // Array is inserted into the finger object.

            temporary_finger_array.Clear();
            fingers.Add(thumb_bone); //Finger is added into hand.

            my_hand.add_vector_fingers_manus_profile(fingers);
        }
Пример #4
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;
            }
        }