From 071ab31546b9c3cf13bca472a4ac76b1480aeb6a Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Mon, 15 Feb 2016 12:08:01 -0800 Subject: [PATCH] Resurrect dead commits deletd by merge conflict with hersh --- .../usfirst/frc/team3501/robot/Constants.java | 9 +++-- .../robot/commands/shooter/Punch.java | 34 ++++++++++++++++++ .../robot/commands/shooter/Shoot.java | 35 ++++++------------- .../robot/commands/shooter/runShooter.java | 1 + .../team3501/robot/subsystems/Shooter.java | 22 +++++++++--- 5 files changed, 70 insertions(+), 31 deletions(-) create mode 100644 src/org/usfirst/frc/team3501/robot/commands/shooter/Punch.java diff --git a/src/org/usfirst/frc/team3501/robot/Constants.java b/src/org/usfirst/frc/team3501/robot/Constants.java index 9c666016..8176e5df 100644 --- a/src/org/usfirst/frc/team3501/robot/Constants.java +++ b/src/org/usfirst/frc/team3501/robot/Constants.java @@ -93,8 +93,8 @@ public class Constants { public static class Shooter { public static final int PORT = 0; - public static final int PUNCH_FORWARD_PORT = 0; - public static final int PUNCH_REVERSE_PORT = 1; + public static final int PUNCH_FORWARD = 0; + public static final int PUNCH_REVERSE = 1; public static final int ANGLE_ADJUSTER_PORT = 0; public static final DoubleSolenoid.Value punch = DoubleSolenoid.Value.kForward; @@ -103,6 +103,11 @@ public class Constants { // Encoder port public static final int ENCODER_PORT_A = 0; public static final int ENCODER_PORT_B = 0; + public static final int HOOD_FORWARD = 2; + public static final int HOOD_REVERSE = 3; + + public static final Value open = Value.kForward; + public static final Value closed = Value.kReverse; public static enum State { RUNNING, STOPPED; diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/Punch.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/Punch.java new file mode 100644 index 00000000..deb2c04b --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/Punch.java @@ -0,0 +1,34 @@ +package org.usfirst.frc.team3501.robot.commands.shooter; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +public class Punch extends Command { + + @Override + protected void initialize() { + Robot.shooter.punch(); + } + + @Override + protected void execute() { + + } + + @Override + protected boolean isFinished() { + return true; + } + + @Override + protected void end() { + Robot.shooter.retractPunch(); + } + + @Override + protected void interrupted() { + + } + +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/Shoot.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/Shoot.java index ec5a11d5..e136c739 100755 --- a/src/org/usfirst/frc/team3501/robot/commands/shooter/Shoot.java +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/Shoot.java @@ -1,30 +1,17 @@ package org.usfirst.frc.team3501.robot.commands.shooter; -import edu.wpi.first.wpilibj.command.Command; +import org.usfirst.frc.team3501.robot.commands.auton.AimAndAlign; -public class Shoot extends Command { +import edu.wpi.first.wpilibj.command.CommandGroup; +import edu.wpi.first.wpilibj.command.WaitCommand; - public Shoot() { - } +public class Shoot extends CommandGroup { - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } + public Shoot() { + addSequential(new AimAndAlign()); + addSequential(new WaitCommand(3.0)); + addSequential(new runShooter()); + addSequential(new WaitCommand(3.0)); + addSequential(new Punch()); + } } diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/runShooter.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/runShooter.java index b69ae167..4315ae19 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/shooter/runShooter.java +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/runShooter.java @@ -29,6 +29,7 @@ public class runShooter extends Command { @Override protected void end() { + Robot.shooter.stop(); } @Override diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java index ee2742d2..40581afe 100755 --- a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java @@ -22,15 +22,15 @@ import edu.wpi.first.wpilibj.command.Subsystem; public class Shooter extends Subsystem { private CANTalon shooter; - private CANTalon angleAdjuster; - private DoubleSolenoid punch; + private DoubleSolenoid hood, punch; private Encoder encoder; public Shooter() { shooter = new CANTalon(Constants.Shooter.PORT); - angleAdjuster = new CANTalon(Constants.Shooter.ANGLE_ADJUSTER_PORT); - punch = new DoubleSolenoid(Constants.Shooter.PUNCH_FORWARD_PORT, - Constants.Shooter.PUNCH_REVERSE_PORT); + hood = new DoubleSolenoid(Constants.Shooter.HOOD_FORWARD, + Constants.Shooter.HOOD_REVERSE); + punch = new DoubleSolenoid(Constants.Shooter.PUNCH_FORWARD, + Constants.Shooter.PUNCH_REVERSE); encoder = new Encoder(Constants.Shooter.ENCODER_PORT_A, Constants.Shooter.ENCODER_PORT_B, false, EncodingType.k4X); @@ -77,6 +77,18 @@ public class Shooter extends Subsystem { punch.set(Constants.Shooter.retract); } + public boolean isHoodOpen() { + return hood.get() == Constants.Shooter.open; + } + + public void openHood() { + hood.set(Constants.Shooter.open); + } + + public void closeHood() { + hood.set(Constants.Shooter.closed); + } + @Override protected void initDefaultCommand() { } -- 2.30.2