Implemented finding park space
[des2015.git] / dsl / runtime / src / nl / ru / des / BasicBehaviour.java
index 2de5ab3..44fcbe2 100644 (file)
@@ -61,8 +61,32 @@ public abstract class BasicBehaviour implements Behavior{
                        Thread.yield();
                }
                measMotor.stop(true);
-               reset();
-               rightTurn(45);
+               
+               turnRandom(30, 45);
+       }
+       
+       protected void measureRock(){
+               long time = System.currentTimeMillis();
+               rightMotor.forward();
+               leftMotor.forward();
+               while(System.currentTimeMillis()-time<1500){
+                       Thread.yield();
+               }
+               
+               rightMotor.stop(true);
+               leftMotor.stop(true);
+               
+               measMotor.backward();
+               while(!suppressed && !measMotor.isStalled()){
+                       Thread.yield();
+               }
+               measMotor.forward();
+               while(!suppressed && !measMotor.isStalled()){
+                       Thread.yield();
+               }
+               measMotor.stop(true);
+               
+               turnRandom(30, 45);
        }
        
        protected void turnRandom(int from, int to){