}
public static class DriveTrain {
- public static final int TANK = 0;
- public static final int ARCADE = 1;
- public static final int DRIVE_TYPE = TANK;
-
// Limits changes in speed during joystick driving
public static final double kADJUST = 8;
public final static int ENCODER_RIGHT_A = 3;
public final static int ENCODER_RIGHT_B = 4;
- public static final double INCHES_PER_PULSE = ((3.66 / 5.14) * 6 * Math.PI)
- / 256;
+ public static final double INCHES_PER_PULSE = ((3.66 / 5.14) * 6 * Math.PI) / 256;
public static double kp = 0.013, ki = 0.000015, kd = -0.002;
public static double encoderTolerance = 8.0;
package org.usfirst.frc.team3501.robot;
-import org.usfirst.frc.team3501.robot.Constants.Auton;
import org.usfirst.frc.team3501.robot.Constants.Defense;
import org.usfirst.frc.team3501.robot.commands.auton.ChooseStrategy;
import org.usfirst.frc.team3501.robot.commands.driving.SetLowGear;
driveTrain = new DriveTrain();
shooter = new Shooter();
intakeArm = new IntakeArm();
+ photogate = new Photogate();
oi = new OI();
- photogate = new Photogate();
defenseChooser = new SendableChooser();
addDefenseOptions(defenseChooser);
private void addDefenseOptions(SendableChooser chooser) {
chooser.addDefault("Portcullis", Defense.PORTCULLIS);
chooser.addObject("Sally Port", Defense.SALLY_PORT);
- chooser.addObject("Rough Terrain" + Auton.ROUGH_TERRAIN_SPEED + " "
- + Auton.ROUGH_TERRAIN_TIME, Defense.ROUGH_TERRAIN);
- chooser.addObject("Low Bar" + " Will probably work...", Defense.LOW_BAR);
+ chooser.addObject("Rough Terrain", Defense.ROUGH_TERRAIN);
+ chooser.addObject("Low Bar", Defense.LOW_BAR);
chooser.addObject("Chival De Frise", Defense.CHIVAL_DE_FRISE);
chooser.addObject("Drawbridge", Defense.DRAWBRIDGE);
- chooser.addObject("Moat" + Auton.MOAT_SPEED + " " + Auton.MOAT_TIME,
- Defense.MOAT);
- chooser.addObject(
- "Rock Wall" + Auton.ROCK_WALL_SPEED + " " + Auton.ROCK_WALL_TIME,
- Defense.ROCK_WALL);
+ chooser.addObject("Moat", Defense.MOAT);
+ chooser.addObject("Rock Wall", Defense.ROCK_WALL);
chooser.addObject("No Auton", Defense.NONE);
}
@Override
protected boolean isFinished() {
- return time >= time;
+ return timer.get() >= time;
}
@Override
* reflective method to sense the presence of the boulder within the robot's
* shooting chamber. This class specifically checks for the ball's presence
* using a threshold of voltages outputted from the phototransistor.
- *
+ *
* @author niyatisriram
*/
public class Photogate extends AnalogInput {
/***
* The constructor inputs the channel of the transistor and the threshold
- * value.
- * The threshold is a specific value, representing the outputted voltage of
- * the phototransistor. This value will be somewhere within the range [0,
- * 4095] Find the value by testing and finding an average value for which the
- * ball is present when the output is greater, and absent when the output is
- * less.
+ * value. The threshold is a specific value, representing the outputted
+ * voltage of the phototransistor. This value will be somewhere within the
+ * range [0, 4095] Find the value by testing and finding an average value for
+ * which the ball is present when the output is greater, and absent when the
+ * output is less.
*/
public Photogate() {
super(0);
- this.threshold = threshold;
-
}
/***
- * @return whether the ball is present or not
- * USE TO DECIDE WHEN OUTTAKE NEEDS TO HAPPEN FOR BALL TO BE SECURE
+ * @return whether the ball is present or not USE TO DECIDE WHEN OUTTAKE NEEDS
+ * TO HAPPEN FOR BALL TO BE SECURE
*/
public boolean isBallPresent() {
if (this.getVoltage() > threshold) {
}
public void joystickDrive(double left, double right) {
- int type = Constants.DriveTrain.DRIVE_TYPE;
-
// Handle flipping of the "front" of the robot
double k = (isFlipped() ? -1 : 1);
- robotDrive.tankDrive(-left, -right);
-
- // if (type == Constants.DriveTrain.TANK) {
- // // TODO Test this for negation and for voltage vs. [-1,1] outputs
- // double leftSpeed = (-frontLeft.get() + -rearLeft.get()) / 2;
- // double rightSpeed = (-frontRight.get() + -rearRight.get()) / 2;
- // left = ((Constants.DriveTrain.kADJUST - 1) * leftSpeed + left)
- // / Constants.DriveTrain.kADJUST;
- // right = ((Constants.DriveTrain.kADJUST - 1) * rightSpeed + right)
- // / Constants.DriveTrain.kADJUST;
- // robotDrive.tankDrive(-left * k, -right * k);
- // } else if (type == Constants.DriveTrain.ARCADE) {
- // double speed = (-frontLeft.get() + -rearLeft.get() + -frontRight.get() +
- // -rearRight
- // .get()) / 2;
- // left = ((Constants.DriveTrain.kADJUST - 1) * speed + left)
- // / Constants.DriveTrain.kADJUST;
- // robotDrive.arcadeDrive(left * k, right);
- // }
+ robotDrive.tankDrive(-left * k, -right * k);
}
public void setMotorSpeeds(double left, double right) {
double k = (isFlipped() ? -1 : 1);
- robotDrive.tankDrive(-left, -right);
+ robotDrive.tankDrive(-left * k, -right * k);
}
/**