Beispiel #1
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.");
        }
Beispiel #2
0
        //Add finger calculations that are stated to be raw decimal calculations from the Manus SDK
        //Phrase the array of raw finger calculations from the Manus SDK.
        private void add_hand_fingers_raw(ref manus_hand_raw_t hand, ref device_type_t side, ref Manus_hand_obj manus_hand)
        {
            List <double> single_hand_array_raw = new List <double>();
            bool          set_grab      = false;
            bool          set_thumbs_up = false;

            for (int h = 0; h < 10; h++)
            {
                single_hand_array_raw.Add(hand.finger_sensor[h]);
            }

            int count_grab      = 0;
            int count_thumbs_up = 0;


            //If the finger is compressed beyond .75, add as a compressed finger
            foreach (double i in single_hand_array_raw)
            {
                if (i > .75)
                {
                    count_grab++;
                }
                //if (i > .95)
                //    count_thumbs_up++;
            }
            //if ( single_hand_array_raw[8] < .3 && single_hand_array_raw[9] < .3 && count_thumbs_up >= 7)
            //{
            //    set_thumbs_up = true;
            //}

            //If more than 8 fingers compressed, set grab.
            if (count_grab > 8)
            {
                set_grab = true;
            }



            manus_hand.set_grabbing(set_grab);
            manus_hand.set_hand_raw(single_hand_array_raw);
        }
Beispiel #3
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;
            }
        }