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
;
12 * The Shooter consists of a platform and wheel, each controlled by
13 * separate motors. The motor controlling the platform pushes the ball onto the
14 * wheel. The wheel is controlled by a motor, which runs once the ball is pushed
15 * onto the wheel. The spinning wheel propels the ball.
21 public class Shooter
extends Subsystem
{
22 private CANTalon shooter
;
23 private CANTalon angleAdjuster
;
24 private DoubleSolenoid punch
;
25 private Encoder encoder
;
28 shooter
= new CANTalon(Constants
.Shooter
.PORT
);
29 angleAdjuster
= new CANTalon(Constants
.Shooter
.ANGLE_ADJUSTER_PORT
);
30 punch
= new DoubleSolenoid(Constants
.Shooter
.PUNCH_FORWARD_PORT
,
31 Constants
.Shooter
.PUNCH_REVERSE_PORT
);
33 encoder
= new Encoder(Constants
.Shooter
.ENCODER_PORT_A
,
34 Constants
.Shooter
.ENCODER_PORT_B
, false, EncodingType
.k4X
);
37 public double getCurrentSetPoint() {
42 * This method checks to see if the ball has successfully passed through the
43 * intake rollers and is inside.
45 * @return whether the presence of the ball is true or false and returns the
46 * state of the condition (true or false).
49 public boolean isBallInside() {
53 public void setSpeed(double speed
) {
56 else if (speed
< -1.0)
66 public double getSpeed() {
67 return encoder
.getRate();
70 // Use negative # for decrement. Positive for increment.
72 public void changeSpeed(double change
) {
73 double newSpeed
= getCurrentSetPoint() + change
;
76 else if (newSpeed
< -1.0)
85 punch
.set(Constants
.Shooter
.punch
);
88 public void resetPunch() {
89 punch
.set(Constants
.Shooter
.retract
);
93 protected void initDefaultCommand() {