After a stressful day of competition, our auton only drives for about 1 second before stopping, or maybe even less than a second. I’m using a chooser to determine which auton logic to use, and it should activate from there. Here is the code
@Override
public void autonomous() {
ds = DriverStation.getInstance().getAlliance();
String selectedPosition = position.getSelected();
/*
* Initialize settings for used subsystems
*/
if (reset < 1) {
drive.setMaxOutput(0.75);
gyro.reset();
reset++;
}
this.updateDashboard();
/*
* Blue Alliance
*/
if (ds == DriverStation.Alliance.Blue) {
this.auton(selectedPosition, 1, 1);
} else if (ds == DriverStation.Alliance.Red) {
this.auton(selectedPosition, -1, -1);
} else {
DriverStation.reportError("DriverStation is invalid", true);
}
}
public void auton(String position, double side, double turn) {
/*
* Note: positive = backwards & left negative = forwards & right
*/
/*
* Position 1
*/
if (position == RobotMap.POS_1) {
drive.mecanumDrive_Cartesian(1, 0, angle, 0);
Timer.delay(3);
drive.stopMotor();
this.lineUp();
}
/*
* Position 2
*/
else if (position == RobotMap.POS_2) {
shooter.set(this.getShooterSpeed());
drive.mecanumDrive_Cartesian(0.5, side, angle, 0);
Timer.delay(3);
drive.mecanumDrive_Cartesian(0, 0, turn, 0);
Timer.delay(0.1);
drive.stopMotor();
Timer.delay(0.5);
this.lineUp();
}
/*
* Position 3
*/
else {
}
}
Position refers to a SendableChooser with options “Position1”, "Position2, and “Position3”.