Пример #1
0
  public void drive(String name, double power, double targetEncoderValue, Direction driveDirection)
      throws InterruptedException {

    Direction motorDirection = Direction.MOTOR_FORWARD;
    if (driveDirection == Direction.DRIVE_BACKWARD || driveDirection == Direction.DRIVE_LEFT) {
      motorDirection = Direction.MOTOR_BACKWARD;
    }
    leftMotorTask.startMotor(name + ": A - Left Motor", power, targetEncoderValue, motorDirection);

    motorDirection = Direction.MOTOR_FORWARD;
    if (driveDirection == Direction.DRIVE_BACKWARD || driveDirection == Direction.DRIVE_RIGHT) {
      motorDirection = Direction.MOTOR_BACKWARD;
    }
    rightMotorTask.startMotor(
        name + ": A - Right Motor", power, targetEncoderValue, motorDirection);
  }
Пример #2
0
  public boolean targetReached() {

    return leftMotorTask.targetReached() || rightMotorTask.targetReached();
  }
Пример #3
0
  public void stop() throws InterruptedException {

    leftMotorTask.stop();
    rightMotorTask.stop();
  }
Пример #4
0
 public boolean isDriving() {
   return leftMotorTask.isRunning() || rightMotorTask.isRunning();
 }