Пример #1
0
        private bool tryNavigation(string locationToReach)
        {
            bool success = false;

            if (!cmdMan.MVN_PLN_getclose(locationToReach, 50000))
            {
                if (!cmdMan.MVN_PLN_getclose(locationToReach, 50000))
                {
                    if (cmdMan.MVN_PLN_getclose(locationToReach, 50000))
                    {
                        success = true;
                    }
                }
                else
                {
                    success = true;
                }
            }
            else
            {
                success = true;
            }


            return(success);
        }
Пример #2
0
        /// <summary>
        /// The robot navigates to a given table to take an order, if there is no more tables to visit then
        /// the robot goes to the kitchen to take the food/drinks/etc
        /// </summary>
        private int GoToOrderTable(int currentState, object o)
        {
            TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> GoToOrderTable state rached.");
            //TODO:Launch a thread to detect request while navigating

            if (tablesToVisit.Count > 0)
            {
                //obtain the current table MVN_PLN location to visit
                MapLocation tableLocation = tablesToVisit.Dequeue();

                TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Going to: " + tableLocation.Name);

                //navigate to the current table
                brain.SayAsync(SMConfiguration.builTableVisitMessage(tableLocation.Alias));
                if (!cmdMan.MVN_PLN_getclose(tableLocation.Name, 20000))
                {
                    if (!cmdMan.MVN_PLN_getclose(tableLocation.Name, 20000))
                    {
                        cmdMan.MVN_PLN_getclose(tableLocation.Name, 20000);
                    }
                }

                //TODO: ask for an order
                return((int)States.FinalState);
            }
            MapLocation kitchenLocation = SMConfiguration.MvnPlnKitchenLocation;

            TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Going to: " + SMConfiguration.MvnPlnKitchenLocation.Name);
            cmdMan.SPG_GEN_asay(SMConfiguration.GoingToKitchenMessage, 5000);
            //TODO: go to the kitchen to grasp object
            return((int)States.FinalState);
        }
        /// <summary>
        /// The robot leaves the arena
        /// </summary>
        private int LeaveArena(int currentState, object o)
        {
            TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> State reached LeaveArena");

            if (!cmdMan.MVN_PLN_getclose(SMConfiguration.LeaveLocation, 15000))
            {
                if (!cmdMan.MVN_PLN_getclose(SMConfiguration.LeaveLocation, 15000))
                {
                    cmdMan.MVN_PLN_getclose(SMConfiguration.LeaveLocation, 15000);
                }
            }

            return((int)States.FinalState);
        }
Пример #4
0
        int GetCloseObjectLocation(int currentState, object o)
        {
            cmdMan.HEAD_lookat(0, 0, 5000);

            TextBoxStreamWriter.DefaultLog.WriteLine("Getting close to: " + this.objectLocation);

            if (cmdMan.MVN_PLN_getclose(this.objectLocation, 600000))
            {
                cmdMan.SPG_GEN_asay("i have arrived to the " + this.objectLocation, 10000);
                TextBoxStreamWriter.DefaultLog.WriteLine("Location reached: " + this.objectLocation);
                this.attemptCounter = 0;
                return((int)States.SearchCloseObjects);
            }

            if (attemptCounter < 3)
            {
                this.attemptCounter++;
                TextBoxStreamWriter.DefaultLog.WriteLine("Cant get close to the specified location, trying again.");
                /// para interface
                cmdMan.SPG_GEN_asay("I can't get close to the" + this.objectLocation, 10000);
                return(currentState);
            }

            //this.brain.SayAsync("I could not get close to the specified location");
            this.attemptCounter = 0;
            TextBoxStreamWriter.DefaultLog.WriteLine("Cant get close to the specified location, will try to continue with the test.");
            return((int)States.SearchCloseObjects);
        }
Пример #5
0
        private int GoToPartyRoom(int currentState, object o)
        {
            if (attemptCounter < 2)
            {
                this.cmdMan.ARMS_goto("standby", 8000);
                if (cmdMan.MVN_PLN_getclose(partyroomLocation, 180000))
                {
                    attemptCounter = 0;
                    TextBoxStreamWriter.DefaultLog.WriteLine("Arrived to party room.");
                    return((int)States.WaitForRequest);
                }

                attemptCounter++;
                TextBoxStreamWriter.DefaultLog.WriteLine("Could not get close to party room, trying again.");
                return(currentState);
            }

            attemptCounter = 0;
            TextBoxStreamWriter.DefaultLog.WriteLine("Could not get close to party room. Will continue with the test.");
            return((int)States.WaitForRequest);
        }
 private int GoToRequest(int currentState, object o)
 {
     if (attemptCounter < 3)
     {
         if (cmdMan.MVN_PLN_getclose("human " + requestId, 60000))
         {
             TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Getclose to human success at attempt" + attemptCounter);
             finalState = FinalStates.OK;
             return((int)States.FinalState);
         }
         else
         {
             TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Getclose to human FAILED at attempt" + attemptCounter);
             attemptCounter++;
             return(currentState);
         }
     }
     attemptCounter = 0;
     finalState     = FinalStates.HumanNotReachable;
     return((int)States.FinalState);
 }