コード例 #1
0
ファイル: ManualControl.cs プロジェクト: Yvoox/neuronalArm
    private void OnApplicationQuit()
    {
        SpaceNav.Instance.CloseDevice();
        StopCoroutine("DoWaitEvent");
        StopCoroutine("ArduinoEvent");
        // Reset position of robotic arm
        fingers.Clear();
        fingers.Add(auriculaire);
        fingers.Add(ringFinger);
        fingers.Add(middleFinger);
        fingers.Add(index);
        fingers.Add(thumb);

        /*    foreach(var finger in fingers)
         *  {
         *      connector.MoveFinger(finger.Key, 120);
         *  }*/

        byte fingersMask = 0;

        foreach (var finger in fingers)
        {
            fingersMask |= finger.mask;
            //connector.MoveFinger(finger.Key, (int)finger.Value.degree);
        }

        connector.MoveFinger(fingersMask, 120);
        connector.Close();
    }
コード例 #2
0
ファイル: ManualControl.cs プロジェクト: Yvoox/neuronalArm
    // Use this for initialization
    void Start()
    {
        arm = GetComponent <GameObject>();

        wrist        = GameObject.FindObjectOfType(typeof(WristControl)) as WristControl;
        auriculaire  = GameObject.FindObjectOfType(typeof(AuriculaireControl)) as AuriculaireControl;
        ringFinger   = GameObject.FindObjectOfType(typeof(RingControl)) as RingControl;
        middleFinger = GameObject.FindObjectOfType(typeof(MiddleControl)) as MiddleControl;
        index        = GameObject.FindObjectOfType(typeof(IndexControl)) as IndexControl;
        thumb        = GameObject.FindObjectOfType(typeof(ThumbControl)) as ThumbControl;

        fingers = new List <Finger>();
        fingers.Add(auriculaire);
        fingers.Add(ringFinger);
        fingers.Add(middleFinger);
        fingers.Add(index);
        fingers.Add(thumb);

        tempFingerDegree = 255;

        connector = new ArduinoConnector();
        Debug.Log(connector.port);
        connector.Open();


        connector.MoveFinger(31, 90);
        StartCoroutine(ArduinoEvent());
    }