}
public RobotState getRobotState(int r, int g, int b) throws GPSException
{
RobotState state = null;
boolean realSimulationRecognizeFailed =false;
try
{
recognizeRobot( r , g , b );
}
catch (GPSException e)
{
// Si la simulacion es real, si no se reconoce el color del robot no pasa nada
if(Simulation.getCurrent().getType() != Defines.REAL_SIMULATION )
throw new GPSException( e.getMessage() );
else
realSimulationRecognizeFailed = true;
}
gpsSemaphore.WAIT();
if ( robot != null || realSimulationRecognizeFailed)
{
state = new RobotState();
if(realSimulationRecognizeFailed) {
state.position = new double[] { 0 , 0 };
state.course = 1;
} else {
state.position = new double[] { robot.x , robot.y };