Пример #1
0
  public double returnPIDInput() {
    // Return your input value for the PID loop
    // e.g. a sensor, like a potentiometer:
    // yourPot.getAverageVoltage() / kYourMaxVoltage;

    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=SOURCE
    return angle.get();

    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=SOURCE
  }
Пример #2
0
 public void setIndexWheels(double target) {
   System.out.println("index target is " + target);
   indexTarget = target;
   error = indexTarget - indexPosition.get();
   if (error > 0.04) {
     openIndexWheels.set(Relay.Value.kForward);
   } else if (error < -0.04) {
     openIndexWheels.set(Relay.Value.kReverse);
   } else {
     openIndexWheels.set(Relay.Value.kOff);
   }
 }
Пример #3
0
  public Hood() {
    // Actuators
    Robot.actuators.HoodActuators();

    hoodMotor = Robot.actuators.hoodMotor;
    addSpeedController(hoodMotor);

    // Sensors
    Robot.sensors.HoodSensors();

    hoodPot = Robot.sensors.hoodPot;
    potAverage =
        new MovingAverage(
            25,
            10,
            () -> {
              return hoodPot.get();
            });

    potOffset = (double) config.get("hood_Pot_Offset");
  }
Пример #4
0
 public double getIndexPosition() {
   return indexPosition.get();
 }
Пример #5
0
 public double getLevel() { // Converts raw potentiometer units to inches
   double zeroedPot =
       Constants.elevatorPotLOWLimit
           - elevatorPot.get(); // Maps the low limit to 0 and has a range from 0 to 0.984
   return zeroedPot * ((double) (Constants.elevatorHeight / Constants.elevatorRawLength));
 }
 /**
  * Reads and returns the current range (in inches) from the analog port. -1 is returned if range
  * is not being obtained form the analog port.
  */
 public double getAnalogRangeInches() {
   return null == analogPotentiometer ? -1 : analogPotentiometer.get() / cmPerInch;
 }
 /**
  * Reads and returns the current range (in cm) from the analog port. -1 is returned if range is
  * not being obtained form the analog port.
  */
 public double getAnalogRangeCm() {
   return null == analogPotentiometer ? -1 : analogPotentiometer.get();
 }
Пример #8
0
 /** Get the value to use when running the PID */
 protected double returnPIDInput() {
   return pot.pidGet();
 }
Пример #9
0
 public boolean isIntakeClose() {
   return intakePot.get() <= (double) config.get("intake_Pot_LowThresh");
 }
Пример #10
0
 public boolean isIntakeOpen() {
   return intakePot.get() >= (double) config.get("intake_Pot_HighThresh");
 }