public abstract class BasicBehaviour implements Behavior{
protected boolean suppressed;
- protected EV3LargeRegulatedMotor leftMotor, rightMotor;
+ protected EV3LargeRegulatedMotor leftMotor, rightMotor, measMotor;
protected SensorCollector sensors;
protected long time;
public BasicBehaviour(SensorCollector sensors, EV3LargeRegulatedMotor leftMotor,
- EV3LargeRegulatedMotor rightMotor){
+ EV3LargeRegulatedMotor rightMotor, EV3LargeRegulatedMotor measMotor){
this.leftMotor = leftMotor;
this.rightMotor = rightMotor;
+ this.measMotor = measMotor;
this.sensors = sensors;
}
rightMotor.stop(true);
leftMotor.stop(true);
}
+
+ protected void rockMeasure(){
+
+ }
+
+ protected void lakeMeasure(){
+
+ }
@Override
public void action() {
var root = resource.allContents.head as Robot;
if(root != null){
fsa.generateFile("nl/ru/des/Constants.java", makeConstants(root));
- //fsa.generateFile("nl/ru/des/Behaviours.java", makeBehaviours(root.behaviour));
+ fsa.generateFile("nl/ru/des/Behaviours.java", makeBehaviours(root.behaviour));
//fsa.generateFile("nl/ru/des/Missions.java", makeMissions(root.mission));
}
}
package nl.ru.des;
import lejos.hardware.motor.EV3LargeRegulatedMotor;
+import nl.ru.des.sensors.SensorCollector;
public class Behaviours{
«FOR b : list»
public static class «b.name»Behaviour extends BasicBehaviour {
public «b.name»Behaviour(SensorCollector sensors, EV3LargeRegulatedMotor rightMotor,
- EV3LargeRegulatedMotor leftMotor, ColorMemory colors){
- super(sensors, rightMotor, leftMotor, colors);
+ EV3LargeRegulatedMotor leftMotor, EV3LargeRegulatedMotor measMotor){
+ super(sensors, rightMotor, leftMotor, measMotor);
}
«IF b.tc != null»
@Override public boolean takeControl(){
«a.whichMotor.d.toString()»Motor.setSpeed(«a.spd»);
«ENDIF»
«a.whichMotor.d.toString()»Motor.«a.dir.d.toString()»();
+ «ELSEIF a.measureWhat != null»
+ «a.measureWhat.d.toString()»Measure();
«ELSE»
time = System.currentTimeMillis();
while(!suppressed«IF a.time.time > 0» && System.currentTimeMillis()-time>«a.time.time»«ENDIF»){