... | ... | @@ -126,15 +126,16 @@ The legocar has same physical design as in the experiments described above. |
|
|
|
|
|
A simple solution would be to use a sequantial loop if we know the position of the obstacle. Such a solution could be like this where we use a predetermined route[PilotAvoid]:
|
|
|
|
|
|
public void go()
|
|
|
|
|
|
public void go()
|
|
|
{
|
|
|
LCD.clear();
|
|
|
Sound.beep();
|
|
|
while ( ! Button.ENTER.isDown()) Thread.yield();
|
|
|
Sound.twoBeeps();
|
|
|
LCD.drawInt(sonar.getDistance(), 2, 2);
|
|
|
|
|
|
pilot.travel(50, true);
|
|
|
|
|
|
while(pilot.isMoving()){
|
|
|
|
|
|
if(sonar.getDistance() < 10){
|
... | ... | |