Esempio n. 1
0
        void Update()
        {
            if (Input.GetKey(KeyCode.T))
            {
                StartCoroutine(Train());
            }
            if (Input.GetKey(KeyCode.Alpha0))
            {
                StartCoroutine(Infer(target.position));
            }
            if (Input.GetKeyUp(KeyCode.Alpha1))
            {
                target.position = new Vector3(-2.21f, 3.08f, 0);
                StartCoroutine(arm.Pose(75, 77));
            }
            if (Input.GetKeyUp(KeyCode.Alpha2))
            {
                target.position = new Vector3(-2.21f, 3.45f, 0);
                StartCoroutine(arm.Pose(75, 77));
            }
            if (Input.GetKeyUp(KeyCode.Alpha3))
            {
                target.position = new Vector3(-2.21f, 0, 0);
                StartCoroutine(arm.Pose(75, 133));
            }
            if (Input.GetKeyUp(KeyCode.D))
            {
                Vector2 hand     = arm.Hand.position;
                Vector2 balloon  = target.position;
                Vector3 delta    = (balloon - hand);
                float   distance = Vector2.Distance(hand, balloon) * 0.02f;

                Debug.Log(distance.ToString("F5"));
                Debug.Log(delta.ToString("F5"));
                Debug.Log((delta * distance).ToString("F5"));
            }
        }