this will fix the behaviour'
authorMart Lubbers <mart@martlubbers.net>
Wed, 16 Dec 2015 11:26:11 +0000 (12:26 +0100)
committerMart Lubbers <mart@martlubbers.net>
Wed, 16 Dec 2015 11:26:11 +0000 (12:26 +0100)
dsl/runtime/src/nl/ru/des/BasicBehaviour.java

index fb70588..e55558d 100644 (file)
@@ -33,11 +33,11 @@ public abstract class BasicBehaviour implements Behavior{
 
        protected void measure(){
                measMotor.backward();
-               while(!measMotor.isStalled()){
+               while(suppressed == SuppressedState.IN_ACTION && !measMotor.isStalled()){
                        Thread.yield();
                }
                measMotor.forward();
-               while(!measMotor.isStalled()){
+               while(suppressed == SuppressedState.IN_ACTION && !measMotor.isStalled()){
                        Thread.yield();
                }
                measMotor.stop(true);
@@ -50,7 +50,7 @@ public abstract class BasicBehaviour implements Behavior{
                sensors.resetGyro();
                rightMotor.backward();
                leftMotor.forward();
-               while(suppressed != SuppressedState.SUPPRESSED && Math.abs(sensors.gyro()) < angle){
+               while(suppressed == SuppressedState.IN_ACTION && Math.abs(sensors.gyro()) < angle){
                        Thread.yield();
                }
                LCDPrinter.print(Float.toString(sensors.gyro()));
@@ -62,7 +62,7 @@ public abstract class BasicBehaviour implements Behavior{
                sensors.resetGyro();
                leftMotor.backward();
                rightMotor.forward();
-               while(suppressed != SuppressedState.SUPPRESSED && Math.abs(sensors.gyro()) < angle){
+               while(suppressed == SuppressedState.IN_ACTION && Math.abs(sensors.gyro()) < angle){
                        Thread.yield();
                }
                LCDPrinter.print(Float.toString(sensors.gyro()));