repositories
/
des2015.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
final commit
[des2015.git]
/
dsl
/
runtime
/
src
/
nl
/
ru
/
des
/
BasicBehaviour.java
diff --git
a/dsl/runtime/src/nl/ru/des/BasicBehaviour.java
b/dsl/runtime/src/nl/ru/des/BasicBehaviour.java
index
44fcbe2
..
945a709
100644
(file)
--- a/
dsl/runtime/src/nl/ru/des/BasicBehaviour.java
+++ b/
dsl/runtime/src/nl/ru/des/BasicBehaviour.java
@@
-29,13
+29,14
@@
public abstract class BasicBehaviour implements Behavior{
leftMotor.setAcceleration(Constants.acceleration);
rightMotor.stop(true);
leftMotor.stop(true);
leftMotor.setAcceleration(Constants.acceleration);
rightMotor.stop(true);
leftMotor.stop(true);
+ measMotor.stop(true);
}
protected void measureLake(){
long time = System.currentTimeMillis();
rightMotor.backward();
leftMotor.backward();
}
protected void measureLake(){
long time = System.currentTimeMillis();
rightMotor.backward();
leftMotor.backward();
- while(System.currentTimeMillis()-time
<50
0){
+ while(System.currentTimeMillis()-time
< 25
0){
Thread.yield();
}
Thread.yield();
}
@@
-44,32
+45,38
@@
public abstract class BasicBehaviour implements Behavior{
rightMotor.setSpeed(25);
leftMotor.setSpeed(25);
if(sensors.leftLight() && !sensors.rightLight()){
rightMotor.setSpeed(25);
leftMotor.setSpeed(25);
if(sensors.leftLight() && !sensors.rightLight()){
- leftTurn(1
5
);
+ leftTurn(1
0
);
} else if (sensors.rightLight() && !sensors.leftLight()){
} else if (sensors.rightLight() && !sensors.leftLight()){
- rightTurn(1
5
);
+ rightTurn(1
0
);
}
rightMotor.stop(true);
leftMotor.stop(true);
}
rightMotor.stop(true);
leftMotor.stop(true);
- measMotor.
backward(
);
- while(!suppressed && !measMotor.isStalled()){
+ measMotor.
rotate(-100, true
);
+ while(!suppressed && !measMotor.isStalled()
&& measMotor.isMoving()
){
Thread.yield();
}
Thread.yield();
}
- measMotor.
forward(
);
- while(!suppressed && !measMotor.isStalled()){
+ measMotor.
rotate(100, true
);
+ while(!suppressed && !measMotor.isStalled()
&& measMotor.isMoving()
){
Thread.yield();
}
measMotor.stop(true);
Thread.yield();
}
measMotor.stop(true);
- turnRandom(30, 45);
+ reset();
+ rightMotor.backward();
+ leftMotor.backward();
+ while(System.currentTimeMillis()-time < 250){
+ Thread.yield();
+ }
+ turnRandom(45, 60);
}
protected void measureRock(){
long time = System.currentTimeMillis();
rightMotor.forward();
leftMotor.forward();
}
protected void measureRock(){
long time = System.currentTimeMillis();
rightMotor.forward();
leftMotor.forward();
- while(System.currentTimeMillis()-time<1
5
00){
+ while(System.currentTimeMillis()-time<1
0
00){
Thread.yield();
}
Thread.yield();
}
@@
-86,6
+93,11
@@
public abstract class BasicBehaviour implements Behavior{
}
measMotor.stop(true);
}
measMotor.stop(true);
+ rightMotor.backward();
+ leftMotor.backward();
+ while(System.currentTimeMillis()-time<1000){
+ Thread.yield();
+ }
turnRandom(30, 45);
}
turnRandom(30, 45);
}
@@
-109,7
+121,7
@@
public abstract class BasicBehaviour implements Behavior{
}
rightMotor.stop(true);
leftMotor.stop(true);
}
rightMotor.stop(true);
leftMotor.stop(true);
-
LCDPrinter.print
(Float.toString(sensors.gyro()));
+
System.out.println
(Float.toString(sensors.gyro()));
}
protected void leftTurn(int angle){
}
protected void leftTurn(int angle){
@@
-123,7
+135,7
@@
public abstract class BasicBehaviour implements Behavior{
}
rightMotor.stop(true);
leftMotor.stop(true);
}
rightMotor.stop(true);
leftMotor.stop(true);
-
LCDPrinter.print
(Float.toString(sensors.gyro()));
+
System.out.println
(Float.toString(sensors.gyro()));
}
@Override
}
@Override