void Start() { Manus.ManusInit(); glove = new Glove(hand); testloop = 0; hg = HandGesture.Default; }
public void ParseContent(Manus manus, string header, string __) { if (!float.TryParse(header, out speed)) { throw new ManusBuildingException(this.GetType().Name + " was unable to parse \"" + header + "\" as a number!"); } }
public void ParseContent(Manus manus, string header, string _) { if (!int.TryParse(header.Trim(), out p_steps)) { throw new ManusBuildingException(this.GetType().Name + " was unable to parse \"" + header + "\" as an integer!"); } }
public void ParseContent(Manus manus, string header, string _) { if (!float.TryParse(header.Trim(), out waittime)) { throw new ManusBuildingException(this.GetType().Name + " was unable to parse \"" + header + "\" as a float!"); } }
void Start() { Manus.ManusInit(); glove = new Glove(hand); timer = new Timer(); timer.AutoReset = false; timer.Elapsed += Timer_Elapsed; }
/// <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); }
protected override void StartHaptics(HumanBodyBones bodyPart, BodyCoordinateHit hitLocation, float intensity) { #if VRTK_DEFINE_SDK_MANUS_VR Manus.ManusSetVibration(handData.Session, isRightGlove ? device_type_t.GLOVE_RIGHT : device_type_t.GLOVE_LEFT, intensity, (ushort)hapticDuration); #endif }
protected override void CancelHaptics() { #if VRTK_DEFINE_SDK_MANUS_VR Manus.ManusSetVibration(handData.Session, isRightGlove ? device_type_t.GLOVE_RIGHT : device_type_t.GLOVE_LEFT, 0, (ushort)hapticDuration); #endif }
bool manusIsConnected(IEntity entity) { var vrGloveHand = entity.GetComponent <IF_VR_Glove_Hand>(); HandDataManager.EnsureLoaded(); var deviceType = vrGloveHand.Type == IF_VR_HandType.Left ? device_type_t.GLOVE_LEFT : device_type_t.GLOVE_RIGHT; vrGloveHand.Connected = Manus.ManusIsConnected(HandDataManager.ManusSession, deviceType); return(vrGloveHand.Connected); }
/// <summary> /// Makes the motor in the Manus Glove vibrate for a certain duration /// </summary> /// <param name="aPower">The power of the motor from 0 to 1</param> /// <param name="aDuration">The duration in seconds</param> public int SetVibrationPeriod(float aPower, float aDuration) { if (timer == null || timer.Enabled) { return(Manus.ERROR); } timer.Interval = aDuration * 1000.0; timer.Start(); return(Manus.ManusSetVibration(hand, aPower)); }
public void ParseContent(Manus manus, string header, string body) { // Reset so they dont take values from previous manus target = null; doneAction = SetPopupSettings.Action.Undefined; slowPrint = false; this.header = header; this.body = body; //// Trim all the lines //this.body = string.Join("\n", new List<string>(body.Split('\n')).ConvertAll(line=>line.Trim()).ToArray()); }
//Cycles one period of update for each of the manus hands. void Update() { //Manus.ManusInit(out session); isL = Manus.ManusIsConnected(session, device_type_t.GLOVE_LEFT); isR = Manus.ManusIsConnected(session, device_type_t.GLOVE_RIGHT); add_manus_hand(ref lefth, ref leftraw, device_type_t.GLOVE_LEFT, left_arm, myProfileL); add_manus_hand(ref righth, ref rightraw, device_type_t.GLOVE_RIGHT, right_arm, myProfileR); //Finger[] f = this.hands[0].get_hand_profile_manus().ToArray(); if (Is_right) { double[] ls = this.hands[1].get_raw_hand().ToArray(); bat_value = this.hands[1].get_bat(); index = ls[0]; middle = ls[1]; ring = ls[2]; thumb = ls[3]; //List<Finger> tempF = this.hands[1].get_hand(); //List<pose> ps = tempF[my_finger_opt].get_finger_data(); //my_quart = ps[select_option].rotation; my_quart = this.hands[1].get_wrist(); my_quart.x = (my_quart.x * 180F) / 3.14165F; my_quart.y = (my_quart.y * 180F) / 3.14165F; my_quart.z = (my_quart.z * 180F) / 3.14165F; my_quart.w = (my_quart.w * 180F) / 3.14165F; my_vec = my_quart.eulerAngles; } else { double[] ls = this.hands[0].get_raw_hand().ToArray(); bat_value = this.hands[0].get_bat(); index = ls[0]; middle = ls[1]; ring = ls[2]; thumb = ls[3]; //List<Finger> tempF = this.hands[0].get_hand(); //List<pose> ps = tempF[my_finger_opt].get_finger_data(); //my_quart = ps[select_option].rotation; my_quart = this.hands[0].get_wrist(); my_quart.x = (my_quart.x * 180F) / 3.14165F; my_quart.y = (my_quart.y * 180F) / 3.14165F; my_quart.z = (my_quart.z * 180F) / 3.14165F; my_quart.w = (my_quart.w * 180F) / 3.14165F; my_vec = my_quart.eulerAngles; } //Quaternion q = hands[0].get_wrist(); // Debug.Log("Wrist data= X: " + q.x + "Y: " + q.y + "Z: " + q.z + "W: " + q.w); //Debug.Log(carpal_inx); }
//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; } }
/// <summary> /// Constructor which loads the HandModel /// </summary> void Start() { // Ensure the library initialized correctly. Manus.ManusInit(); // Initialize the glove and the associated skeletal model. glove = new Glove(hand); if (hand == GLOVE_HAND.GLOVE_LEFT) { modelObject = Resources.Load <GameObject>("Manus_Handv2_Left"); animationClip = Resources.Load <AnimationClip>("Manus_Handv2_Left"); } else { modelObject = Resources.Load <GameObject>("Manus_Handv2_Right"); animationClip = Resources.Load <AnimationClip>("Manus_Handv2_Right"); } gameRoot = FindDeepChild(gameObject.transform, "Wrist"); modelRoot = FindDeepChild(modelObject.transform, "Wrist"); modelObject.SetActive(true); }
/// <summary> /// Vibrate the glove /// </summary> private void VibrateHand(device_type_t device) { Manus.ManusSetVibration(HandData.Instance.Session, device, 0.7f, 150); }
public static void ManusSDKDllInit() { Manus.ManusInit(out session); }
public void VibrateVerySoftLeft() { Manus.ManusSetVibration(handData.Session, device_type_t.GLOVE_LEFT, 0.6f, 300); }
public void VibrateSoftRight() { Manus.ManusSetVibration(handData.Session, device_type_t.GLOVE_RIGHT, 0.8f, 150); }
public void VibrateSoftLeft() { Manus.ManusSetVibration(handData.Session, device_type_t.GLOVE_LEFT, 0.9f, 150); }
public void VibrateVerySoftRight() { Manus.ManusSetVibration(handData.Session, device_type_t.GLOVE_RIGHT, 0.5f, 300); }
/// <summary> /// Vibrate the glove /// </summary> private void VibrateHand() { Manus.ManusSetVibration(HandData.Session, DeviceType, 0.7f, 150); }
//vibrate right hand private void VibrateHandRight() { Manus.ManusSetVibration(HandData.Instance.Session, DeviceTypeRight, 0.7f, 150); }
public void ParseContent(Manus manus, string _, string body) { string[] allRows = body.Split(Loader.linebreaks, StringSplitOptions.None); for (int i = 0; i < allRows.Length; i++) { string row = allRows[i].Trim(); if (row.Length == 0) { continue; } Match match = Regex.Match(row, @"^([_\-\wåäöÅÄÖ.,]+)\s*=\s*(.+)\s*$"); if (!match.Success) { throw new ManusBuildingException("Unable to parse bubble settings \"" + allRows[i] + "\""); } string g1 = match.Groups[1].Value.TrimEnd(); string g2 = match.Groups[2].Value.TrimEnd(); switch (g1.ToLower()) { case "action": try { doneAction = (Action)Enum.Parse(typeof(Action), g2, true); if (doneAction == Action.Undefined) { throw new Exception(); } } catch { throw new ManusBuildingException("Unable to parse action, no enum value matches \"" + g2 + "\""); } break; case "target": Match m = Regex.Match(g2, @"^\(([\s\d\.,\-;]+)\)$"); if (m.Success) { // It's in paranteses. Convert all to numbers string content = m.Groups[1].Value; List <float> numbers; try { numbers = content.Split(';', ',').Select(s => float.Parse(s.Replace(" ", "").Replace("\t", ""))).ToList(); } catch { throw new ManusBuildingException("Unable to parse target position. Invalid number representations in \"" + g2 + "\""); } switch (numbers.Count) { case 1: target = Mathf.RoundToInt(numbers[0]); break; case 2: target = new Vector2(numbers[0], numbers[1]); break; case 3: target = new Vector3(numbers[0], numbers[1], numbers[2]); break; default: throw new ManusBuildingException("Invalid number of number values (" + numbers.Count + "). Only (row), (x,y), and (x,y,z) are valid."); } } else { // May be a selectable target = g2; } break; case "slowprint": slowPrint = MyParseBool(g2); if (!slowPrint.HasValue) { throw new ManusBuildingException("Unable to parse slowprint, invalid boolean value \"" + g2 + "\"!"); } break; default: throw new ManusBuildingException("Unknown bubble setting \"" + g1 + "\""); } } }
/// <summary> /// Makes the motor in the Manus Glove vibrate at a constant power. /// If the motor is currently set with SetVibrationPeriod, that timer is stopped. /// Turn the motor off by setting the power to 0. /// </summary> /// <param name="aPower">The power of the motor from 0 to 1</param> public int SetConstantVibration(float aPower) { return(Manus.ManusSetVibration(hand, aPower)); }
void onApplicationQuit() { Manus.ManusExit(); }
private void Timer_Elapsed(object sender, ElapsedEventArgs e) { Manus.ManusSetVibration(hand, 0.0f); }
public void ParseContent(Manus manus, string _, string body) { code = body ?? string.Empty; }
public void ParseContent(Manus manus, string _, string __) { }
public static void ManusSDKDllShut() { Manus.ManusExit(session); }