package org.usfirst.frc.team3501.robot.subsystems;
import org.usfirst.frc.team3501.robot.Constants;
-import org.usfirst.frc.team3501.robot.Lidar;
-import org.usfirst.frc.team3501.robot.MathLib;
+import org.usfirst.frc.team3501.robot.sensors.Lidar;
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.I2C;
import edu.wpi.first.wpilibj.command.Subsystem;
/***
encoder = new Encoder(Constants.Shooter.ENCODER_PORT_A,
Constants.Shooter.ENCODER_PORT_B, false, EncodingType.k4X);
-
- lidar = new Lidar(I2C.Port.kMXP);
}
/***
}
public void setSpeed(double speed) {
- speed = MathLib.constrain(speed, -1, 1);
- shooter.set(speed);
+ if (speed > 1.0)
+ shooter.set(1.0);
+ else if (speed < -1.0)
+ shooter.set(-1.0);
+ else
+ shooter.set(speed);
}
public void stop() {
return encoder.getRate();
}
+ /*
+ * We are going to map a lidar distance to a shooter speed that will be set to
+ * the shooter. This function does not yet exist so we will just use y=x but
+ * when testing commences we shall create the function
+ */
+ public double getShooterSpeed() {
+ double distanceToGoal = lidar.getDistance();
+ double shooterSpeed = distanceToGoal; // Function to be determined
+ return shooterSpeed;
+ }
+
// Use negative # for decrement. Positive for increment.
public void changeSpeed(double change) {
}
// Punch Commands
- public void punch() {
+ public void extendPunch() {
punch.set(Constants.Shooter.punch);
}
punch.set(Constants.Shooter.retract);
}
- public boolean isHoodOpen() {
- return hood.get() == Constants.Shooter.open;
- }
-
- public void openHood() {
+ public void raiseHood() {
hood.set(Constants.Shooter.open);
}
- public void closeHood() {
+ public void lowerHood() {
hood.set(Constants.Shooter.closed);
}