public void checkIfSharpCorner() { leftMotor.stop(); rightMotor.stop(); isSharpCorner = false; int performedRotation = 0; DifferentialPilot pilot = new DifferentialPilot(2, 10, leftMotor, rightMotor); if (getRealTimeValue() >= 0.1) { pilot.rotate(-4); isSharpCorner = true; tellLineBehaviorIsSharpCorner(); } else { for (int i = 0; i <= 40; i++) { pilot.rotate(1); performedRotation += 1; if (getRealTimeValue() >= 0.1) { isSharpCorner = true; tellLineBehaviorIsSharpCorner(); break; } if (Button.readButtons() != 0) { this.interrupt(); } } } if (!isSharpCorner) { align(pilot, performedRotation); line.setIsNoSharpCorner(); } }
public float getRealTimeValue() { // int samplesize = filter.sampleSize(); // float[] samples = new float[samplesize]; // System.out.println("Value:"+counter.getRealTimeValue()); // Button.waitForAnyPress(); // System.out.flush(); return line.getRealTimeValue(); // return samples[0]; }
private void tellLineBehaviorIsSharpCorner() { line.isSharpCorner(); }