public static final int PUNCH_FORWARD_PORT = 0;
public static final int PUNCH_REVERSE_PORT = 1;
public static final int ANGLE_ADJUSTER_PORT = 0;
+
public static final DoubleSolenoid.Value punch = DoubleSolenoid.Value.kForward;
public static final DoubleSolenoid.Value retract = DoubleSolenoid.Value.kReverse;
+ // Encoder port
+ public static final int ENCODER_PORT_A = 0;
+ public static final int ENCODER_PORT_B = 0;
+
public static enum State {
RUNNING, STOPPED;
}
import org.usfirst.frc.team3501.robot.Constants;
import edu.wpi.first.wpilibj.CANTalon;
+import edu.wpi.first.wpilibj.CounterBase.EncodingType;
import edu.wpi.first.wpilibj.DoubleSolenoid;
+import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.command.Subsystem;
public class Shooter extends Subsystem {
private CANTalon shooter;
private CANTalon angleAdjuster;
private DoubleSolenoid punch;
+ private Encoder encoder;
public Shooter() {
shooter = new CANTalon(Constants.Shooter.PORT);
angleAdjuster = new CANTalon(Constants.Shooter.ANGLE_ADJUSTER_PORT);
punch = new DoubleSolenoid(Constants.Shooter.PUNCH_FORWARD_PORT,
Constants.Shooter.PUNCH_REVERSE_PORT);
+
+ encoder = new Encoder(Constants.Shooter.ENCODER_PORT_A,
+ Constants.Shooter.ENCODER_PORT_B, false, EncodingType.k4X);
}
public double getCurrentSetPoint() {
this.setSpeed(0.0);
}
+ public double getSpeed() {
+ return encoder.getRate();
+ }
+
// Use negative # for decrement. Positive for increment.
public void changeSpeed(double change) {
double newSpeed = getCurrentSetPoint() + change;