1 package org
.usfirst
.frc
.team3501
.robot
.subsystems
;
3 import org
.usfirst
.frc
.team3501
.robot
.Constants
;
5 import edu
.wpi
.first
.wpilibj
.CANTalon
;
6 import edu
.wpi
.first
.wpilibj
.CounterBase
.EncodingType
;
7 import edu
.wpi
.first
.wpilibj
.DoubleSolenoid
;
8 import edu
.wpi
.first
.wpilibj
.Encoder
;
9 import edu
.wpi
.first
.wpilibj
.command
.Subsystem
;
11 public class Shooter
extends Subsystem
{
12 private CANTalon shooter
;
13 private CANTalon angleAdjuster
;
14 private DoubleSolenoid punch
;
15 private Encoder encoder
;
18 shooter
= new CANTalon(Constants
.Shooter
.PORT
);
19 angleAdjuster
= new CANTalon(Constants
.Shooter
.ANGLE_ADJUSTER_PORT
);
20 punch
= new DoubleSolenoid(Constants
.Shooter
.PUNCH_FORWARD_PORT
,
21 Constants
.Shooter
.PUNCH_REVERSE_PORT
);
23 encoder
= new Encoder(Constants
.Shooter
.ENCODER_PORT_A
,
24 Constants
.Shooter
.ENCODER_PORT_B
, false, EncodingType
.k4X
);
27 public double getCurrentSetPoint() {
32 * This method checks to see if the ball has successfully passed through the
33 * intake rollers and is inside.
35 * @return whether the presence of the ball is true or false and returns the
36 * state of the condition (true or false).
39 public boolean isBallInside() {
43 public void setSpeed(double speed
) {
46 else if (speed
< -1.0)
56 public double getSpeed() {
57 return encoder
.getRate();
60 // Use negative # for decrement. Positive for increment.
61 public void changeSpeed(double change
) {
62 double newSpeed
= getCurrentSetPoint() + change
;
65 else if (newSpeed
< -1.0)
74 punch
.set(Constants
.Shooter
.punch
);
77 public void resetPunch() {
78 punch
.set(Constants
.Shooter
.retract
);
82 protected void initDefaultCommand() {