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 piston controlling the platform pushes the ball onto the
14 * wheel. The wheel is controlled by a motor, which is running before the ball
16 * onto the wheel. The spinning wheel propels the ball.
22 public class Shooter
extends Subsystem
{
23 private CANTalon shooter
;
24 private CANTalon angleAdjuster
;
25 private DoubleSolenoid punch
;
26 private Encoder encoder
;
29 shooter
= new CANTalon(Constants
.Shooter
.PORT
);
30 angleAdjuster
= new CANTalon(Constants
.Shooter
.ANGLE_ADJUSTER_PORT
);
31 punch
= new DoubleSolenoid(Constants
.Shooter
.PUNCH_FORWARD_PORT
,
32 Constants
.Shooter
.PUNCH_REVERSE_PORT
);
34 encoder
= new Encoder(Constants
.Shooter
.ENCODER_PORT_A
,
35 Constants
.Shooter
.ENCODER_PORT_B
, false, EncodingType
.k4X
);
39 * This method checks to see if the ball has successfully passed through the
40 * intake rollers and is inside.
42 * @return whether the presence of the ball is true or false and returns the
43 * state of the condition (true or false).
46 public boolean isBallInside() {
50 public void setSpeed(double speed
) {
53 else if (speed
< -1.0)
63 public double getSpeed() {
64 return encoder
.getRate();
67 // Use negative # for decrement. Positive for increment.
69 public void changeSpeed(double change
) {
70 double newSpeed
= getCurrentSetPoint() + change
;
75 public void extendPunch() {
76 punch
.set(Constants
.Shooter
.punch
);
79 public void retractPunch() {
80 punch
.set(Constants
.Shooter
.retract
);
84 protected void initDefaultCommand() {