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;
// 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;
--- /dev/null
+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() {
+
+ }
+
+}
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());
+ }
}
@Override
protected void end() {
+ Robot.shooter.stop();
}
@Override
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);
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() {
}