Ejemplo n.º 1
0
        /// <summary>
        /// Creates the SM of the primite action: Take-Object
        /// </summary>
        /// <param name="brain">HAL9000Brain instance</param>
        /// <param name="cmdMan">HAL9000CmdMan instance</param>
        /// <param name="objectToTake">Name of the object to take. Default: empty string.</param>
        public NavigateTo(HAL9000Brain brain, HAL9000CmdMan cmdMan, GPSR_WORLD SMConfiguration, string locationToReach = "")
        {
            this.brain = brain;
            this.cmdMan = cmdMan;

            finalStatus = Status.Ready;

            this.SMConfiguration = SMConfiguration;
            this.locationToReach = locationToReach;

            navigSucceded = "I reach the location.";
            navigFailed = "I can't reach the location.";

            SM = new FunctionBasedStateMachine();
            SM.AddState(new FunctionState((int)States.InitialState, InitialState));

            SM.AddState(new FunctionState((int)States.RiseArms, RiseArms));
            SM.AddState(new FunctionState((int)States.Navigate, Navigate));
            SM.AddState(new FunctionState((int)States.Navigate_Succeeded, Navigate_Succeeded));
            SM.AddState(new FunctionState((int)States.Navigate_Failed, Navigate_Failed));

            SM.AddState(new FunctionState((int)States.FinalState, FinalState, true));

            SM.SetFinalState((int)States.FinalState);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates the SM of the primite action: Take-Object
        /// </summary>
        /// <param name="brain">HAL9000Brain instance</param>
        /// <param name="cmdMan">HAL9000CmdMan instance</param>
        /// <param name="objectToTake">Name of the object to take. Default: empty string.</param>
        public TellPhrase(HAL9000Brain brain, HAL9000CmdMan cmdMan, GPSR_WORLD SMConfiguration, string phrase)
        {
            this.brain = brain;
            this.cmdMan = cmdMan;

            finalStatus = Status.Ready;

            this.SMConfiguration = SMConfiguration;
            this.phraseToTell = phrase;

            SM = new FunctionBasedStateMachine();
            SM.AddState(new FunctionState((int)States.InitialState, InitialState));

            SM.AddState(new FunctionState((int)States.StateTellPhrase, StateTellPhrase));

            SM.AddState(new FunctionState((int)States.FinalState, FinalState, true));

            SM.SetFinalState((int)States.FinalState);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates the SM of the primite action: Take-Object
        /// </summary>
        /// <param name="brain">HAL9000Brain instance</param>
        /// <param name="cmdMan">HAL9000CmdMan instance</param>
        /// <param name="objectToTake">Name of the object to take. Default: empty string.</param>
        public AnswerQuestion(HAL9000Brain brain, HAL9000CmdMan cmdMan, GPSR_WORLD SMConfiguration)
        {
            this.brain = brain;
            this.cmdMan = cmdMan;

            finalStatus = Status.Ready;
            attemptCounter = 0;

            this.SMConfiguration = SMConfiguration;

            SM = new FunctionBasedStateMachine();
            SM.AddState(new FunctionState((int)States.InitialState, InitialState));

            SM.AddState(new FunctionState((int)States.StateQuestion, StateQuestion));
            SM.AddState(new FunctionState((int)States.StateAnswer, StateAnswer));

            SM.AddState(new FunctionState((int)States.FinalState, FinalState, true));

            SM.SetFinalState((int)States.FinalState);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates the SM of the primite action: Take-Object
        /// </summary>
        /// <param name="brain">HAL9000Brain instance</param>
        /// <param name="cmdMan">HAL9000CmdMan instance</param>
        /// <param name="objectToTake">Name of the object to take. Default: empty string.</param>
        public BringObject(HAL9000Brain brain, HAL9000CmdMan cmdMan, GPSR_WORLD SMConfiguration, string objectName="")
        {
            this.brain = brain;
            this.cmdMan = cmdMan;

            finalStatus = Status.Ready;

            this.SMConfiguration = SMConfiguration;
            this.objectName = objectName;

            foundPersonMessage = "Human please get close to me and take the object.";

            SM = new FunctionBasedStateMachine();
            SM.AddState(new FunctionState((int)States.InitialState, InitialState));

            SM.AddState(new FunctionState((int)States.DeliverObject, DeliverObject));

            SM.AddState(new FunctionState((int)States.FinalState, FinalState, true));

            SM.SetFinalState((int)States.FinalState);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates the SM of the primite action: Take-Object
        /// </summary>
        /// <param name="brain">HAL9000Brain instance</param>
        /// <param name="cmdMan">HAL9000CmdMan instance</param>
        /// <param name="objectToTake">Name of the object to take. Default: empty string.</param>
        public TakeObject(HAL9000Brain brain, HAL9000CmdMan cmdMan, GPSR_WORLD SMConfiguration, string objectToTake="")
        {
            this.brain = brain;
            this.cmdMan = cmdMan;

            finalStatus = Status.Ready;

            this.SMConfiguration = SMConfiguration;
            this.objectToTake = objectToTake;

            SATO_succeeded = "I got it.";
            SATO_failed = "I can't take the object.";

            SM = new FunctionBasedStateMachine();
            SM.AddState(new FunctionState((int)States.InitialState, InitialState));

            SM.AddState(new FunctionState((int)States.SearchAndTakeObject, SearchAndTakeObject));
            SM.AddState(new FunctionState((int)States.SATO_Failed, SATO_Failed));
            SM.AddState(new FunctionState((int)States.SATO_Succeeded, SATO_Succeeded));

            SM.AddState(new FunctionState((int)States.FinalState, FinalState, true));

            SM.SetFinalState((int)States.FinalState);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Configuration state
        /// </summary>
        private int InitialState(int currentState, object o)
        {
            TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Initializing GPSR test.");

            //Load the WORLD configuration for this test
            SMConfiguration = new GPSR_WORLD();

            // TODO: Change the next status
            return (int)States.EnterArena;
        }