/// <summary> /// The robot enters to the arena an goes to the MVN_PLN EntranceLocation /// </summary> private int EnterArena(int currentState, object o) { TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> State reached EnterArena"); SM_EnterArena.FinalStates enterArena_status; SM_EnterArena enterArena = new SM_EnterArena(brain, cmdMan, SMConfiguration.EntranceLocation); enterArena_status = enterArena.Execute(); if (enterArena_status == SM_EnterArena.FinalStates.OK) { if (!cmdMan.ARMS_goto(SMConfiguration.ArmsNavigationPosition, 3000)) { if (!cmdMan.ARMS_goto(SMConfiguration.ArmsNavigationPosition, 3000)) { cmdMan.ARMS_goto(SMConfiguration.ArmsNavigationPosition, 3000); } } return((int)States.GetCloseToTable); } else { return((int)States.EnterArena); } }
/// <summary> /// the robot enters to the arena (to an especificated MVN-PLN map location) /// </summary> /// <returns>NavigateToOperator state if the robot enters the arena, EnterArena otherwise</returns> private int EnterArena(int currentState, object o) { TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> EnterArena state reached."); SM_EnterArena sm = new SM_EnterArena(this.brain, this.cmdMan, SMConfiguration.MVNPLN_entranceLocation, false); SM_EnterArena.FinalStates final = sm.Execute(); if (final == SM_EnterArena.FinalStates.OK) { attemptCounter = 0; return((int)States.NavigateToOperator); } else { attemptCounter++; //the robot cannot entered the arena if (attemptCounter < attemptLimit) { TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Cannot enter to the arena at attempt " + attemptCounter + ". Try again."); return((int)States.EnterArena); } else { //reset the attempt counter TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Cannot enter to the arena. Try to continue with the test."); attemptCounter = 0; return((int)States.NavigateToOperator); } } }
private int EnterArena(int currentState, object o) { SM_EnterArena enterArenaSM = new SM_EnterArena(brain, cmdMan, entranceLocation, tryToOpenDoor); if (enterArenaSM.Execute() != SM_EnterArena.FinalStates.OK) { TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> Cannot enter the arena, trying to continue the test."); } return((int)States.GoToPartyRoom); }