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
);
39 * @return current sensor position??
41 public double getCurrentSetPoint() {
46 * This method checks to see if the ball has successfully passed through the
47 * intake rollers and is inside.
49 * @return whether the presence of the ball is true or false and returns the
50 * state of the condition (true or false).
53 public boolean isBallInside() {
57 public void setSpeed(double speed
) {
60 else if (speed
< -1.0)
70 public double getSpeed() {
71 return encoder
.getRate();
74 // Use negative # for decrement. Positive for increment.
76 public void changeSpeed(double change
) {
77 double newSpeed
= getCurrentSetPoint() + change
;
83 punch
.set(Constants
.Shooter
.punch
);
86 public void resetPunch() {
87 punch
.set(Constants
.Shooter
.retract
);
91 protected void initDefaultCommand() {