Ejemplo n.º 1
0
        /// <summary>
        /// The robot waits for an user voice confirmation of a location command (table or kitchen)
        /// </summary>
        /// <returns></returns>
        private int WaitForLocationConfirmation(int currentState, object o)
        {
            TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Waiting for location confirmation");
            //waits for an user voice confirmation
            if (this.brain.WaitForUserConfirmation())
            {
                cmdMan.MVN_PLN_stopfollowhuman();
                cmdMan.MVN_PLN_stopsavingpath();
                cmdMan.HEAD_lookat(SMConfiguration.HeadHomePan, SMConfiguration.HeadHomeTilt, 1000);
                cmdMan.ARMS_goto(SMConfiguration.ArmsHomePosition, 10000);

                if (tableCommandRecognized)
                {
                    TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Table location confirmed");

                    //Ask for the direction of the table
                    brain.SayAsync(SMConfiguration.TableDirectionAskingMessage);
                    brain.recognizedSentences.Clear();
                    Thread.Sleep(100);
                    return((int)States.WaitForTableDirectionCommand);
                }
                if (kitchenCommandRecognized)
                {
                    TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Kitchen location confrimed");
                    brain.SayAsync(SMConfiguration.OrderAskingMessage);
                    brain.recognizedSentences.Clear();
                    Thread.Sleep(1000);
                    TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Waiting for ordering command.");
                    return((int)States.WaitForOrderingCommand);
                }
            }
            brain.SayAsync("Ok no.");
            //Thread.Sleep(500);
            brain.recognizedSentences.Clear();
            return((int)States.WaitForLocationCommand);
            //return (int)States.FollowHuman;
        }