public void autonomousPeriodic() { relay.set(Relay.Value.kOn); smart.putNumber("distance", ultrasonic.getVoltage()); drive.setRun(false); loadAndShoot.setRun(false); // relay.set(Relay.Value.kOn); if (autoTimer.get() < autoMoveForwardTime) { System.out.println( "Moving forward, Timer at " + autoTimer.get() + ", Ultrasonic at " + ultrasonic.getAverageVoltage()); } if (autoTimer.get() >= autoMoveForwardTime && ultrasonic.getAverageVoltage() <= AUTO_DISTANCE) { stop(); if (!autonomousStopped) { autonomousStopped = true; autoTimeAtStop = autoTimer.get(); } System.out.println("Stopped, Ultrasonic at " + ultrasonic.getAverageVoltage()); } if (autoTimer.get() >= autoTimeAtStop + 1 && ultrasonic.getAverageVoltage() <= AUTO_DISTANCE) { autoStop = true; shoot(); System.out.println("Shooting, Ultrasonic at " + ultrasonic.getAverageVoltage()); } }
public boolean isDetensioned() { double curr_volts = sensor.getAverageVoltage(); boolean on_target = ((curr_volts > (slack_tension_volts - threshold_volts)) && (curr_volts < (slack_tension_volts + threshold_volts))); boolean at_min = leftMin.get(); return (on_target || at_min); }
public double getTensionLevel() { return sensor.getAverageVoltage(); }
protected double returnPIDInput() { return sensor.getAverageVoltage(); }
// The absolute returns a voltage, 0 - 5, thus, any voltage *72 will = deg. public double getAbsoluteCurrentPosition() { return analogInputAbsolute.getAverageVoltage() * 72; }
public double getAbsoluteVoltage() { return analogInputAbsolute.getAverageVoltage(); }
/** * Read the battery voltage from the specified AnalogChannel. * * <p>This accessor assumes that the battery voltage is being measured through the voltage divider * on an analog breakout. * * @return The battery voltage. */ public double getBatteryVoltage() { // The Analog bumper has a voltage divider on the battery source. // Vbatt *--/\/\/\--* Vsample *--/\/\/\--* Gnd // 680 Ohms 1000 Ohms return m_batteryChannel.getAverageVoltage() * (1680.0 / 1000.0); }