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