package org.usfirst.frc.team3501.robot;
import org.usfirst.frc.team3501.robot.commands.climber.ToggleWinch;
-import org.usfirst.frc.team3501.robot.commands.driving.ToggleDrivePiston;
import org.usfirst.frc.team3501.robot.commands.driving.ToggleGear;
import org.usfirst.frc.team3501.robot.commands.intake.ReverseIntakeContinuous;
import org.usfirst.frc.team3501.robot.commands.intake.RunIntakeContinuous;
import org.usfirst.frc.team3501.robot.commands.shooter.RunFlyWheelContinuous;
import org.usfirst.frc.team3501.robot.commands.shooter.RunIndexWheelContinuous;
import org.usfirst.frc.team3501.robot.commands.shooter.ToggleIndexerPiston;
+import org.usfirst.frc.team3501.robot.utils.ChangeCameraView;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.buttons.Button;
Constants.OI.DECREASE_SHOOTER_SPEED_PORT);
decreaseShooterSpeed.whenPressed(new DecreaseShootingSpeed());
- /*
- * changeCam = new JoystickButton(rightJoystick,
- * Constants.OI.CHANGE_CAMERA_VIEW); changeCam.toggleWhenPressed(new
- * ChangeCameraView());
- */
+ changeCam = new JoystickButton(rightJoystick,
+ Constants.OI.CHANGE_CAMERA_VIEW);
+ changeCam.toggleWhenPressed(new ChangeCameraView());
togglePiston = new JoystickButton(rightJoystick,
Constants.Shooter.TOGGLE_INDEXER);
toggleDriveTrainPiston = new JoystickButton(rightJoystick,
Constants.DriveTrain.TOGGLE_DRIVE_PISTON);
- toggleDriveTrainPiston.whenPressed(new ToggleDrivePiston());
+ toggleDriveTrainPiston.whenPressed(new ToggleGear());
}
public static OI getOI() {
// both set to high gear
@Override
public void autonomousInit() {
- driveTrain.setHighGear();
+ driveTrain.setHighGear(driveTrain.getRightPiston());
+ driveTrain.setHighGear(driveTrain.getLeftPiston());
}
@Override
+++ /dev/null
-package org.usfirst.frc.team3501.robot.commands.driving;
-
-import org.usfirst.frc.team3501.robot.Constants;
-import org.usfirst.frc.team3501.robot.Robot;
-import org.usfirst.frc.team3501.robot.subsystems.DriveTrain;
-import edu.wpi.first.wpilibj.command.Command;
-
-public class ToggleDrivePiston extends Command {
- private DriveTrain driveTrain = Robot.getDriveTrain();
-
- /**
- * See JavaDoc comment in class for details
- *
- * @param motorVal
- * value range from -1 to 1
- */
- public ToggleDrivePiston() {
- requires(driveTrain);
- }
-
- // Called just before this Command runs the first time
- @Override
- protected void initialize() {
- }
-
- // Called repeatedly when this Command is scheduled to run
- @Override
- protected void execute() {
- if (DriveTrain.getDriveTrain()
- .getLeftGearPistonValue() == Constants.DriveTrain.HIGH_GEAR) {
- DriveTrain.getDriveTrain().setLowGear();
- } else {
- DriveTrain.getDriveTrain().setHighGear();
- }
-
- // check to make sure that both pistons are set to the same gear. Otherwise,
- // the code must be changed
- }
-
- // Called once after isFinished returns true
- @Override
- protected void end() {
- }
-
- // Called when another command which requires one or more of the same
- // subsystems is scheduled to run
- @Override
- protected void interrupted() {
- end();
- }
-
- @Override
- protected boolean isFinished() {
- return false;
-
- }
-
-}
protected void execute() {
Value leftGearPistonValue = driveTrain.getLeftGearPistonValue();
Value rightGearPistonValue = driveTrain.getRightGearPistonValue();
+
if (leftGearPistonValue == Constants.DriveTrain.LOW_GEAR) {
- driveTrain.setHighGear();
+ driveTrain.setHighGear(driveTrain.getLeftPiston());
+ } else {
+ driveTrain.setLowGear(driveTrain.getLeftPiston());
+ }
+
+ if (rightGearPistonValue == Constants.DriveTrain.LOW_GEAR) {
+ driveTrain.setHighGear(driveTrain.getRightPiston());
} else {
- driveTrain.setLowGear();
+ driveTrain.setLowGear(driveTrain.getRightPiston());
}
}
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
- if (Shooter.getShooter().getPistonValue() == Constants.Shooter.LOW_GEAR) {
- Shooter.getShooter().setHighGear();
+ if (shooter.getPistonValue() == Constants.Shooter.LOW_GEAR) {
+ shooter.setHighGear();
} else {
- Shooter.getShooter().setLowGear();
+ shooter.setLowGear();
}
}
return rightGearPiston.get();
}
+ public DoubleSolenoid getLeftPiston() {
+ return this.leftGearPiston;
+ }
+
+ public DoubleSolenoid getRightPiston() {
+ return this.rightGearPiston;
+ }
+
/*
* Changes the ball shift gear assembly to high
*/
- public void setHighGear() {
- changeGear(Constants.DriveTrain.HIGH_GEAR);
+ public void setHighGear(DoubleSolenoid p) {
+ changeGear(Constants.DriveTrain.HIGH_GEAR, p);
}
/*
* Changes the ball shift gear assembly to low
*/
- public void setLowGear() {
- changeGear(Constants.DriveTrain.LOW_GEAR);
+ public void setLowGear(DoubleSolenoid p) {
+ changeGear(Constants.DriveTrain.LOW_GEAR, p);
}
/*
* Changes the gear to a DoubleSolenoid.Value
*/
- private void changeGear(DoubleSolenoid.Value gear) {
- leftGearPiston.set(gear);
- rightGearPiston.set(gear);
+ private void changeGear(DoubleSolenoid.Value gear, DoubleSolenoid piston) {
+ piston.set(gear);
}
@Override
private double currentShootingSpeed = DEFAULT_SHOOTING_SPEED;
- private DoubleSolenoid piston;
+ private final DoubleSolenoid piston;
private Shooter() {
flyWheel1 = new CANTalon(Constants.Shooter.FLY_WHEEL1);