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); }
public boolean targetReached() { return leftMotorTask.targetReached() || rightMotorTask.targetReached(); }
public void stop() throws InterruptedException { leftMotorTask.stop(); rightMotorTask.stop(); }
public boolean isDriving() { return leftMotorTask.isRunning() || rightMotorTask.isRunning(); }