\r
@define CELDAS_MAX_VELOCITY 30.\r
@define CELDAS_TURNO 100.\r
+@define CELDAS_SENSOR_THRESHOLD 9.\r
\r
PhysicalControl : CeldasControl {\r
% This class is used for building simple vehicle \r
bodyLink (object).\r
\r
wheels (list).\r
- sensors (list).\r
\r
+ to init:\r
bodyShape = new Shape.\r
return (fSensor get-sensor-value).\r
\r
+to update-entorno:\r
- entorno{"sensor_f"} = (fSensor get-data).\r
- entorno{"sensor_b"} = (bSensor get-data).\r
- entorno{"sensor_r"} = (rSensor get-data).\r
- entorno{"sensor_l"} = (lSensor get-data).\r
+ entorno{"sensor_f"} = (fSensor get-sensor-value).\r
+ entorno{"sensor_b"} = (bSensor get-sensor-value).\r
+ entorno{"sensor_r"} = (rSensor get-sensor-value).\r
+ entorno{"sensor_l"} = (lSensor get-sensor-value).\r
entorno{"movido"} = 0. # TODO\r
sa update-entorno with entorno. \r
\r
sa update-datos-finales with datos-finales.\r
\r
+to iterate:\r
- fl, fr(float).\r
+ self update-entorno.\r
\r
if (0): # TODO posicion_final == posicion_actual\r
{\r
print "Llegamos al FINAL!!!".\r
+ self set-global-velocity to 0.\r
return.\r
}\r
\r
if (plan_finished):\r
{\r
- self update-entorno.\r
sa plan. # Si no tenemos plan, lo hacemos\r
plan_finished = 0.\r
# TODO posicion_inicial = posicion_actual\r
\r
if (iterate == 0):\r
{\r
- print "iteracion 0".\r
if (sa has-next-theory):\r
{\r
- print "hay teoria".\r
teoria = sa get-next-theory.\r
if ((teoria get-accion) == "adelante"):\r
{\r
\r
if (iterate == CELDAS_TURNO):\r
{\r
- self update-entorno.\r
# TODO if (posicion_actual == posicion_inicial): movido = false. else movido = true.\r
if (sa validate theory teoria):\r
{\r
- print "valida".\r
}\r
else\r
{\r
- print "Teoria no valida".\r
plan_finished = 1.\r
}\r
}\r
% Gets the sensor value. This should be used from post-iterate,\r
% if not, the sensor reading correspond to the previous\r
% iteration.\r
+ val (float).\r
+\r
+ val = self get-data.\r
+ if (val > CELDAS_SENSOR_THRESHOLD): return 0.\r
+ else return 1.\r
\r
#+ to iterate:\r
\r
i (object).\r
min,dist (float).\r
v,obs(vector).\r
- aux(float).\r
j (int).\r
des2,des3(int).\r
wallBegin,wallEnd,wallCenter (float).\r
- \r
- toObstacle(vector).\r
- largeWall (float).\r
- \r
obsLoc (vector). \r
- location (vector).\r
posObstacle,destiny,yo(vector).\r
\r
draw clear.\r