//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)); }
//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."); }
//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; } }