Ejemplo n.º 1
0
        bool ProcessRotation()
        {
            double       leftSignal  = brain.OutputSignalArray[1];
            double       rightSignal = brain.OutputSignalArray[2];
            double       difference  = rightSignal - leftSignal;
            const double threshold   = 0.1;

            if (leftSignal < 0.75 && rightSignal < 0.75)
            {
                return(false);
            }
            else if (difference < -threshold)
            {
                System.Diagnostics.Debug.WriteLine("LEFT");
                programMalmo.AddCommandToList("turn -1");
                return(true);
            }
            else if (difference > threshold)
            {
                System.Diagnostics.Debug.WriteLine("RIGHT");
                programMalmo.AddCommandToList("turn 1");
                return(true);
            }
            else
            {
                // Neither RIGHT nor LEFT is much more active than
                // the other, so no turning is done (moves instead)
                return(false);
            }
        }
Ejemplo n.º 2
0
        void OutputsToCommands()
        {
            System.Diagnostics.Debug.WriteLine("Outputs: " + brain.OutputSignalArray[0].ToString() + " " +
                                               brain.OutputSignalArray[0].ToString() + " " +
                                               brain.OutputSignalArray[1].ToString());

            double       leftSignal  = brain.OutputSignalArray[0];
            double       rightSignal = brain.OutputSignalArray[1];
            double       difference  = rightSignal - leftSignal;
            const double threshold   = 0.1;

            if (leftSignal < 0.75 && rightSignal < 0.75)
            {
                System.Diagnostics.Debug.WriteLine("MOVE");
                programMalmo.AddCommandToList("move 1");
            }
            else if (difference < -threshold)
            {
                System.Diagnostics.Debug.WriteLine("LEFT");
                programMalmo.AddCommandToList("turn -1");
            }
            else if (difference > threshold)
            {
                System.Diagnostics.Debug.WriteLine("RIGHT");
                programMalmo.AddCommandToList("turn 1");
            }
            else
            {
                // Neither RIGHT nor LEFT is much more active than
                // the other, so no turning is done (moves instead)
                System.Diagnostics.Debug.WriteLine("MOVE");
                programMalmo.AddCommandToList("move 1");
            }
        }
Ejemplo n.º 3
0
        void OutputsToCommands()
        {
            string frontSpeed = OutputToMovementStringValue(
                brain.OutputSignalArray[0], brain.OutputSignalArray[1]);
            string lateralSpeedString = OutputToMovementStringValue(
                brain.OutputSignalArray[2], brain.OutputSignalArray[3]);

            programMalmo.AddCommandToList("move " + frontSpeed);
            programMalmo.AddCommandToList("strafe " + lateralSpeedString);
            ProcessJumpOutput();
        }
        void OutputsToCommands()
        {
            /*
             * System.Diagnostics.Debug.WriteLine("Outputs: " + brain.OutputSignalArray[0].ToString() + " " +
             *  brain.OutputSignalArray[0].ToString() + " " +
             *  brain.OutputSignalArray[1].ToString());*/

            double frontSignal   = brain.OutputSignalArray[0];
            double lateralSignal = brain.OutputSignalArray[1];

            if (frontSignal > lateralSignal)
            {
                if (frontSignal > 0.5)
                {
                    //System.Diagnostics.Debug.WriteLine("ADVANCE");
                    programMalmo.AddCommandToList("move 1");
                }
                else
                {
                    //System.Diagnostics.Debug.WriteLine("BACKWARDS");
                    programMalmo.AddCommandToList("move -1");
                }
            }
            else
            {
                if (lateralSignal > 0.5)
                {
                    //System.Diagnostics.Debug.WriteLine("RIGHT");
                    programMalmo.AddCommandToList("strafe 1");
                }
                else
                {
                    //System.Diagnostics.Debug.WriteLine("LEFT");
                    programMalmo.AddCommandToList("strafe -1");
                }
            }
        }