int SearchCloseObjects(int currentState, object o) { if (cmdMan.ST_PLN_fashionfind_object(ObjectToFind, 180000, out objectsFound)) { attemptCounter = 0; TextBoxStreamWriter.DefaultLog.WriteLine("Objects found."); return((int)States.SetObjectToTake); } if (attemptCounter < 2) { attemptCounter++; TextBoxStreamWriter.DefaultLog.WriteLine("No objects were found, trying again"); this.brain.SayAsync("I did not find the " + ObjectToFind + ". I will try again"); //this.cmdMan.MVN_PLN_move(-0.25, 0, 0, 5000); Thread.Sleep(2500); return(currentState); } this.brain.SayAsync("I did not find " + (anyObject?"any":"") + ObjectToFind); TextBoxStreamWriter.DefaultLog.WriteLine("Requested Object NOT found, SM was not successful."); attemptCounter = 0; this.finalState = FinalStates.Failed; return((int)States.FinalState); }
int SearchCloseObjects(int currentState, object o) { List <string> objectsFound = new List <string>(); if (cmdMan.ST_PLN_fashionfind_object(ObjectToFind, 90000, out objectsFound)) { TextBoxStreamWriter.DefaultLog.WriteLine("Objects found."); this.foundObjectsCount = (byte)objectsFound.Count; if (!anyObject) { if (objectsFound.Contains(ObjectToFind)) { TextBoxStreamWriter.DefaultLog.WriteLine("Requested Object found."); attemptCounter = 0; return((int)States.TakeObject); } if (attemptCounter < 3) { attemptCounter++; TextBoxStreamWriter.DefaultLog.WriteLine("object NOT found, trying again"); this.brain.SayAsync("I did not find the " + ObjectToFind + ". I will try again"); //this.cmdMan.MVN_PLN_move(-0.25, 0, 0, 5000); Thread.Sleep(2500); return(currentState); } TextBoxStreamWriter.DefaultLog.WriteLine("Requested Object NOT found, will try to continue the test."); attemptCounter = 0; this.finalState = FinalStates.Failed; return((int)States.FinalState); /*foreach (string obj in objectsFound) * { * //cmdMan.SPG_GEN_say(obj); * * if (obj == objectToBring) * { * TextBoxStreamWriter.DefaultLog.WriteLine("Requested Object founded"); * nextStage = 70; * founded = true; * } * }*/ } else { ObjectToFind = objectsFound[0]; foundObject = objectsFound[0]; attemptCounter = 0; TextBoxStreamWriter.DefaultLog.WriteLine("Some Object found."); return((int)States.TakeObject); } } else { if (attemptCounter < 3) { attemptCounter++; TextBoxStreamWriter.DefaultLog.WriteLine("No objects were found, trying again"); this.brain.SayAsync("I did not find the " + ObjectToFind + ". I will try again"); this.cmdMan.MVN_PLN_move(-0.25, 0, 0, 5000); Thread.Sleep(2500); return(currentState); } this.brain.SayAsync("I did not find " + (anyObject?"any":"") + ObjectToFind + " in " + objectLocation); TextBoxStreamWriter.DefaultLog.WriteLine("Requested Object NOT found, SM was not successful."); attemptCounter = 0; this.finalState = FinalStates.Failed; return((int)States.FinalState); } }