Exemplo n.º 1
0
  /**
   * Kills other robots
   *
   * @param programm Current program running
   */
  public void killThemAll(String program) {

    if (program == "") {
      drive.moveForward(drive.maxSpeed());
      Delay.msDelay(TIME_TO_DESTRUCT);
    }
  }
Exemplo n.º 2
0
 public Collision(
     boolean destructionMode,
     Drive drive,
     EV3TouchSensor leftSensor,
     EV3TouchSensor rightSensor,
     EV3UltrasonicSensor sonicSensor) {
   this.drive = drive;
   this.leftSensor = leftSensor;
   this.rightSensor = rightSensor;
   this.sonicSensor = sonicSensor;
   speed = drive.maxSpeed();
   collision = "none";
   terminateCollisionEstimation = false;
   this.destructionMode = destructionMode;
 }
Exemplo n.º 3
0
  private void elevatorCollision() {
    LCD.clear();
    LCD.drawString("Collision: " + collision, 0, 4);
    Delay.msDelay(3000);
    float[] dist = new float[sonicSensor.getDistanceMode().sampleSize()];
    sonicSensor.getDistanceMode().fetchSample(dist, 0);

    if ((dist[0] - DISTANCE_TO_WALL) > 0.005) {
      drive.turnRight(5, false);
    } else {
      drive.turnLeft(5, false);
    }
    if (collision == "Wall") {
      drive.stop();
    } else if (collision == "Left Wall") {
      drive.turnRight(5, false);
    } else if (collision == "Right Wall") {
      drive.moveDistance(drive.maxSpeed(), -2);
      drive.turnLeft(20, false);
    }
  }