1 package nl
.ru
.des
.behaviours
;
3 import lejos
.hardware
.motor
.EV3LargeRegulatedMotor
;
4 import lejos
.robotics
.SampleProvider
;
5 import lejos
.robotics
.subsumption
.Behavior
;
6 import nl
.ru
.des
.bluetooth
.ColorMemory
;
8 public class WandererBehaviour
extends ReactiveBehaviour
implements Behavior
{
9 private EV3LargeRegulatedMotor leftMotor
, rightMotor
;
10 private ColorMemory cm
;
12 public WandererBehaviour(SampleProvider color
, EV3LargeRegulatedMotor leftMotor
,
13 EV3LargeRegulatedMotor rightMotor
, ColorMemory cm
) {
15 this.leftMotor
= leftMotor
;
16 this.rightMotor
= rightMotor
;
21 public boolean takeControl() {
22 return !cm
.finished();
26 public void action() {
32 if (ColorMemory
.COLORSTOFIND
.contains((int)samples
[0])) {
33 cm
.addColor((int)samples
[0]);
38 rightMotor
.stop(true);