diff --git a/2019robot/src/main/java/org/usfirst/frc4388/robot/OI.java b/2019robot/src/main/java/org/usfirst/frc4388/robot/OI.java index 91c431f..3c5a14a 100644 --- a/2019robot/src/main/java/org/usfirst/frc4388/robot/OI.java +++ b/2019robot/src/main/java/org/usfirst/frc4388/robot/OI.java @@ -57,15 +57,15 @@ public class OI JoystickButton liftBothIntake = new JoystickButton(m_operatorXbox.getJoyStick(), XboxController.X_BUTTON); - liftBothIntake.whenPressed(new HatchAndBallUp()); + liftBothIntake.whenPressed(new HatchAndBallSet(false, false)); JoystickButton liftHatchIntake = new JoystickButton(m_operatorXbox.getJoyStick(), XboxController.RIGHT_BUMPER_BUTTON); - liftHatchIntake.whenPressed(new LiftHatchDropBall()); + liftHatchIntake.whenPressed(new HatchAndBallSet(false, true)); JoystickButton liftBallIntake = new JoystickButton(m_operatorXbox.getJoyStick(), XboxController.LEFT_BUMPER_BUTTON); //liftBallIntake.whenPressed(new HatchFlip(false)); - liftBallIntake.whenPressed(new LiftBallDropHatch()); + liftBallIntake.whenPressed(new HatchAndBallSet(true, false)); JoystickButton climbUp = new JoystickButton(m_driverXbox.getJoyStick(), XboxController.RIGHT_TRIGGER_AXIS); diff --git a/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/HatchAndBallSet.java b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/HatchAndBallSet.java new file mode 100644 index 0000000..922413f --- /dev/null +++ b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/HatchAndBallSet.java @@ -0,0 +1,61 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2018 FIRST. All Rights Reserved. */ +/* Open Source Software - may be modified and shared by FRC teams. The code */ +/* must be accompanied by the FIRST BSD license file in the root directory of */ +/* the project. */ +/*----------------------------------------------------------------------------*/ + +package org.usfirst.frc4388.robot.commands; + +import org.usfirst.frc4388.robot.Robot; +import org.usfirst.frc4388.robot.subsystems.Pneumatics; + +import edu.wpi.first.wpilibj.command.Command; + +/** + * Sets the hatch intake and ball intake to the boolean values passed in. + * This will have no effect if called and both subsystems are already in the desired state. + * @param hatch true is deployed, false is undeployed + * @param ball true is deployed, false is undeployed + */ + +public class HatchAndBallSet extends Command { + + private boolean hatchposition; + private boolean ballposition; + + public HatchAndBallSet(boolean hatch, boolean ball) { + requires(Robot.pnumatics); + hatchposition = !hatch; + ballposition = ball; + } + + // Called just before this Command runs the first time + @Override + protected void initialize() { + Robot.pnumatics.setBallIntake(ballposition); + Robot.pnumatics.setHatchIntakeState(hatchposition); + } + + // Called repeatedly when this Command is scheduled to run + @Override + protected void execute() { + } + + // Make this return true when this Command no longer needs to run execute() + @Override + protected boolean isFinished() { + return false; + } + + // 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() { + } +} \ No newline at end of file diff --git a/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/HatchAndBallUp.java b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/HatchAndBallUp.java index 91e9b4f..15cdb27 100644 --- a/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/HatchAndBallUp.java +++ b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/HatchAndBallUp.java @@ -8,7 +8,9 @@ package org.usfirst.frc4388.robot.commands; import edu.wpi.first.wpilibj.command.CommandGroup; - +/** + * @deprecated use HatchAndBallSet insted for all setting of hatch and ball intakes + */ public class HatchAndBallUp extends CommandGroup { /** * Add your docs here. diff --git a/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/HatchFlip.java b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/HatchFlip.java index 4dfe82e..29c5a71 100644 --- a/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/HatchFlip.java +++ b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/HatchFlip.java @@ -3,7 +3,9 @@ package org.usfirst.frc4388.robot.commands; import org.usfirst.frc4388.robot.Robot; import edu.wpi.first.wpilibj.command.Command; - +/** + * @deprecated use HatchAndBallSet insted for all setting of hatch and ball intakes + */ public class HatchFlip extends Command { public boolean PickingUp; diff --git a/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/LiftBallDropHatch.java b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/LiftBallDropHatch.java index ac30f5a..26cd35b 100644 --- a/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/LiftBallDropHatch.java +++ b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/LiftBallDropHatch.java @@ -8,7 +8,9 @@ package org.usfirst.frc4388.robot.commands; import edu.wpi.first.wpilibj.command.CommandGroup; - +/** + * @deprecated use HatchAndBallSet insted for all setting of hatch and ball intakes + */ public class LiftBallDropHatch extends CommandGroup { /** * Add your docs here. diff --git a/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/LiftHatchDropBall.java b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/LiftHatchDropBall.java index 2818a05..6ec9a9b 100644 --- a/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/LiftHatchDropBall.java +++ b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/LiftHatchDropBall.java @@ -8,7 +8,9 @@ package org.usfirst.frc4388.robot.commands; import edu.wpi.first.wpilibj.command.CommandGroup; - +/** + * @deprecated use HatchAndBallSet insted for all setting of hatch and ball intakes + */ public class LiftHatchDropBall extends CommandGroup { /** * Add your docs here.