Exemplo n.º 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
  }
Exemplo n.º 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);
   }
 }
Exemplo n.º 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");
  }
Exemplo n.º 4
0
 public double getIndexPosition() {
   return indexPosition.get();
 }
Exemplo n.º 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();
 }
Exemplo n.º 8
0
 public boolean isIntakeClose() {
   return intakePot.get() <= (double) config.get("intake_Pot_LowThresh");
 }
Exemplo n.º 9
0
 public boolean isIntakeOpen() {
   return intakePot.get() >= (double) config.get("intake_Pot_HighThresh");
 }