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
1 package org.usfirst.frc.team3501.robot.subsystems;
2
3 import org.usfirst.frc.team3501.robot.Constants;
4
5 import edu.wpi.first.wpilibj.CANTalon;
6 import edu.wpi.first.wpilibj.DoubleSolenoid;
7 import edu.wpi.first.wpilibj.command.Subsystem;
8
9 public class Shooter extends Subsystem {
10 private CANTalon shooter;
11 private CANTalon angleAdjuster;
12 private DoubleSolenoid punch;
13
14 public Shooter() {
15 shooter = new CANTalon(Constants.Shooter.PORT);
16 punch = new DoubleSolenoid(Constants.Shooter.FORWARD_PORT,
17 Constants.Shooter.REVERSE_PORT);
18 }
19
20 public double getCurrentSetPoint() {
21 return shooter.get();
22 }
23
24 public void setSpeed(double speed) {
25 if (speed > 1.0)
26 shooter.set(1.0);
27 else if (speed < -1.0)
28 shooter.set(-1.0);
29 else
30 shooter.set(speed);
31 }
32
33 public void stop() {
34 this.setSpeed(0.0);
35 }
36
37 // Use negative # for decrement. Positive for increment.
38 public void changeSpeed(double change) {
39 double newSpeed = getCurrentSetPoint() + change;
40 if (newSpeed > 1.0)
41 shooter.set(1.0);
42 else if (newSpeed < -1.0)
43 shooter.set(-1.0);
44 else {
45 setSpeed(newSpeed);
46 }
47 }
48
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
58 @Override
59 protected void initDefaultCommand() {
60 }
61 }