Exemple #1
0
    public void Update()
    {
        ///<summary>
        /// configure the robot arm
        /// </summary>
        ///
        if (this.name == "CuGo1")
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                DetectAllTargets();
                SetTargetsInLayers(allTargets.ToArray()); // from this always use targetsOnL1,L2,L3 list
                ObserveStateBeforeMovementandAssign(allTargets.ToArray());
                //PrintLookUpTable(L1lookupTable);
                //PrintLookUpTable(L2lookupTable);
                //PrintLookUpTable(L3lookupTable);
            }
            if (Input.GetKeyDown(KeyCode.R))
            {
                for (int i = 0; i < joints.Count; i++)
                {
                    joints[i].resetRot = true;
                }
                // flip the rotation value and send
                angleVal *= -1;
                udpClient.InitiateTimer(1); // 0 for forward 1 for backword
            }
        }
        else if (this.name == "CuGo2")
        {
            if (Input.GetKeyDown(KeyCode.S))
            {
                DetectAllTargets();
                SetTargetsInLayers(allTargets.ToArray()); // from this always use targetsOnL1,L2,L3 list
                ObserveStateBeforeMovementandAssign(allTargets.ToArray());
                //PrintLookUpTable(L1lookupTable);
                //PrintLookUpTable(L2lookupTable);
                //PrintLookUpTable(L3lookupTable);
            }
            if (Input.GetKeyDown(KeyCode.B))
            {
                for (int i = 0; i < joints.Count; i++)
                {
                    joints[i].resetRot = true;
                }
                // flip the rotation value and send
                angleVal *= -1;
                udpClient.InitiateTimer(1); // 0 for forward 1 for backword
            }
        }
        //if (CuGoRun)
        //{
        //    DetectAllTargets();
        //    SetTargetsInLayers(allTargets.ToArray()); // from this always use targetsOnL1,L2,L3 list
        //    ObserveStateBeforeMovementandAssign(allTargets.ToArray());
        //    CuGoRun = !CuGoRun;
        //}

        ///<summary>
        /// re configure to origin position
        /// </summary>



        CuGoP = transform.GetChild(0).position;
    }