@Override
 public double getRate() {
   // Units: (0-1023)/cycle / 1023 x (turns/volt) x (volts) x (degrees/turn) x (cycles/second) =
   // (degrees/second)
   return changeInVoltsPerCycle.getAsDouble()
       / analogRange
       * analogTurnsPerVolt
       * voltageRange
       * 360.0
       / cyclePeriodInSeconds.getAsDouble();
 }
 @Override
 public double getRate() {
   // Units: (edges/cycle) * (pulses/edge) x (degrees/pulse) x (cycles/second) = (degrees/second)
   return velocityInEdgesPerCycle.getAsDouble()
       / edgesPerPulse
       / pulsesPerDegree
       / cyclePeriodInSeconds.getAsDouble();
 }
  /*
   * BooleanSupplier. Supplier of boolean-valued results.
   * IntSupplier. Supplier of int-valued results.
   * LongSupplier. Supplier of long-valued results.
   * DoubleSupplier. Supplier of double-valued results.
   */
  public static void main(String[] args) {
    BooleanSupplier booleanSupplier = () -> Boolean.TRUE;
    IntSupplier intSupplier = () -> new Integer(0);
    LongSupplier longSupplier = () -> new Long(0);
    DoubleSupplier doubleSupplier = () -> new Double(0);

    System.out.println(booleanSupplier.getAsBoolean());
    System.out.println(intSupplier.getAsInt());
    System.out.println(longSupplier.getAsLong());
    System.out.println(doubleSupplier.getAsDouble());
  }
 @Override
 public Gyroscope zero() {
   zero = analogPosition.getAsDouble();
   return this;
 }
 @Override
 public double getAngle() {
   return angleInDegreesFromRawPosition(analogPosition.getAsDouble());
 }
 @Override
 public Gyroscope zero() {
   zero = positionInEdges.getAsDouble();
   return this;
 }
 @Override
 public double getAngle() {
   return angleInDegreesFromRawPosition(positionInEdges.getAsDouble());
 }
예제 #8
0
 public default void bindPosition(DoubleSupplier source) {
   Scheduler.addBind(() -> setPosition(source.getAsDouble()));
 }