コード例 #1
0
        private int SATO_Failed(int currentState, object o)
        {
            TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> SATO_Failed state reached.");

            cmdMan.SPG_GEN_say(SATO_failed, 3000);
            finalStatus = Status.Failed;
            // TODO: Change the next status
            return((int)States.FinalState);
        }
コード例 #2
0
 private int Navigate_Succeeded(int currentState, object o)
 {
     TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Navigate_Succeeded state reached.");
     //return the arms to home position
     if (!(SMConfiguration.ARMS_usedArm == ""))
     {
         cmdMan.ARMS_goto(SMConfiguration.ARMS_home, 10000);
     }
     cmdMan.SPG_GEN_say(navigSucceded, 3000);
     finalStatus = Status.OK;
     // TODO: Change the next status
     return((int)States.FinalState);
 }
コード例 #3
0
        private int StateTellPhrase(int currentState, object o)
        {
            TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> StateTellPhrase state reached.");

            switch (phraseToTell)
            {
            case "time":
                cmdMan.SPG_GEN_say(System.DateTime.Now.ToString(), 5000);
                break;

            case "your_name":
                cmdMan.SPG_GEN_say("Hello I'm the robot Justina", 5000);
                break;

            default:
                break;
            }

            return((int)States.FinalState);
        }
コード例 #4
0
ファイル: GPSR.cs プロジェクト: NonatoLagunas/AP_GPSR_2015
        /// <summary>
        /// the robot navigate to the operator location
        /// </summary>
        /// <returns>WaitForCommand state if the navigation primiive was executed succesfully. NavigateToOperator otherwise.</returns>
        private int NavigateToOperator(int currentState, object o)
        {
            TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> NavigateToOperator state reached.");

            NavigateTo sm_navigation = new NavigateTo(this.brain, this.cmdMan, SMConfiguration, SMConfiguration.MVNPLN_operatorLocation);

            NavigateTo.Status navig_status = sm_navigation.Execute();
            if (navig_status == NavigateTo.Status.OK)
            {
                //if the robot reach the location then ask for a command
                cmdMan.SPG_GEN_say(SMConfiguration.SPGEN_waitforcomman, 5000);
                Thread.Sleep(1000);
                brain.recognizedSentences.Clear();

                attemptCounter = 0;
                return((int)States.WaitForCommand);
            }
            else
            {
                attemptCounter++;
                //the robot cannot navigate to
                if (attemptCounter < attemptLimit)
                {
                    TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> connot navigate to te aperator at attempt: " + attemptCounter + ". Trying again.");
                    return((int)States.NavigateToOperator);
                }
                else
                {
                    //reset the attempt counter
                    TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Cannot navigate to the operator. Try to continue with the test.");
                    attemptCounter = 0;
                    return((int)States.WaitForCommand);
                }
            }
        }
コード例 #5
0
ファイル: RoboZoo.cs プロジェクト: NonatoLagunas/AP_GPSR_2015
        private int MarkerFound(int currentState, object o)
        {
            TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> MarkerFound state reached.");
            //jump to the perform state of the detected command
            int nextState;

            switch (SMConfiguration.generateIntegerCommand(SMConfiguration.markerCommand))
            {
            case (int)RoboZoo_WORLD.Commands.Dance:
                TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Dance command detected.");
                SMConfiguration.commandDetected = true;
                nextState = (int)States.PerformDance;
                break;

            case (int)RoboZoo_WORLD.Commands.Presentation:
                TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Presentation command detected.");
                SMConfiguration.commandDetected = true;
                nextState = (int)States.PerformPresentation;
                break;

            case (int)RoboZoo_WORLD.Commands.Hypnotize:
                TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Hypnotize command detected.");
                SMConfiguration.commandDetected = true;
                nextState = (int)States.PerformHipnotize;
                break;

            case -1:
                TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> The string command " + SMConfiguration.markerCommand + " does not have a integer representation.");
                nextState = (int)States.SearchMarker;
                break;

            default:
                TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Integer representation for " + SMConfiguration.markerCommand + " not parsed (verify your code).");
                nextState = (int)States.SearchMarker;
                break;
            }

            if (SMConfiguration.commandDetected)
            {
                TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Stoping threads.");
                //Stop the head search movement
                if (t_HEADSearchMovements.IsAlive)
                {
                    t_HEADSearchMovements.Join();
                }
                //Stop the arms search movement
                if (t_ARMSSearchMovements.IsAlive)
                {
                    t_ARMSSearchMovements.Join();
                }
                //Stop the spgen search movement
                if (t_SPGENSearchPhrases.IsAlive)
                {
                    t_SPGENSearchPhrases.Join();
                }

                cmdMan.SPG_GEN_say(SMConfiguration.getDetectedCommandPhrase(), 3000);
            }

            TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Jump to the next state.");
            return(nextState);
        }