add motors for cheval de frise for intake arm and angle adjuster for shooter
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / subsystems / Shooter.java
CommitLineData
a0c3ca74
KZ
1package org.usfirst.frc.team3501.robot.subsystems;
2
3import org.usfirst.frc.team3501.robot.Constants;
a0c3ca74
KZ
4
5import edu.wpi.first.wpilibj.CANTalon;
9b10474d 6import edu.wpi.first.wpilibj.DoubleSolenoid;
a0c3ca74
KZ
7import edu.wpi.first.wpilibj.command.Subsystem;
8
9public class Shooter extends Subsystem {
a0c3ca74 10 private CANTalon shooter;
4f516a69 11 private CANTalon angleAdjuster;
9b10474d 12 private DoubleSolenoid punch;
a0c3ca74
KZ
13
14 public Shooter() {
15 shooter = new CANTalon(Constants.Shooter.PORT);
9b10474d
GK
16 punch = new DoubleSolenoid(Constants.Shooter.FORWARD_PORT,
17 Constants.Shooter.REVERSE_PORT);
a0c3ca74
KZ
18 }
19
20 public double getCurrentSetPoint() {
21 return shooter.get();
22 }
23
24 public void setSpeed(double speed) {
913142de 25 if (speed > 1.0)
a0c3ca74 26 shooter.set(1.0);
913142de 27 else if (speed < -1.0)
a0c3ca74
KZ
28 shooter.set(-1.0);
29 else
30 shooter.set(speed);
31 }
32
33 public void stop() {
34 this.setSpeed(0.0);
35 }
36
a0c3ca74
KZ
37 // Use negative # for decrement. Positive for increment.
38 public void changeSpeed(double change) {
913142de
KZ
39 double newSpeed = getCurrentSetPoint() + change;
40 if (newSpeed > 1.0)
a0c3ca74 41 shooter.set(1.0);
07ceaad8 42 else if (newSpeed < -1.0)
a0c3ca74
KZ
43 shooter.set(-1.0);
44 else {
a0c3ca74
KZ
45 setSpeed(newSpeed);
46 }
47 }
48
9b10474d
GK
49 // Punch Commands
50 public void punch() {
51 punch.set(Constants.Shooter.punch);
52 }
53
54 public void resetPunch() {
55 punch.set(Constants.Shooter.retract);
56 }
57
a0c3ca74
KZ
58 @Override
59 protected void initDefaultCommand() {
60 }
61}