import edu.wpi.cscore.UsbCamera;
import edu.wpi.first.wpilibj.CameraServer;
+import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.command.Scheduler;
+import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
public class Robot extends IterativeRobot {
private static DriveTrain driveTrain;
@Override
public void teleopInit() {
-
}
@Override
public void teleopPeriodic() {
Scheduler.getInstance().run();
+ updateSmartDashboard();
+ }
+
+ public void updateSmartDashboard() {
+ SmartDashboard.putNumber("angle", driveTrain.getAngle());
+ SmartDashboard.putNumber("voltage",
+ DriverStation.getInstance().getBatteryVoltage());
+ SmartDashboard.putNumber("rpm", shooter.getShooterRPM());
+ SmartDashboard.putNumber("motor value", shooter.getCurrentShootingSpeed());
}
}
private double wheelI;
private double wheelD;
private double target;
+ private double shooterSpeed = 0;
public RunFlyWheel(double maxTimeOut) {
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
- double shooterSpeed = this.wheelController
+ double calculatedShooterIncrement = this.wheelController
.calcPID(this.shooter.getShooterRPM());
-
+ shooterSpeed += calculatedShooterIncrement;
this.shooter.setFlyWheelMotorVal(shooterSpeed);
}
private double wheelI;
private double wheelD;
private double target;
- double shooterSpeed = 0;
+ private double shooterSpeed = 0;
public RunFlyWheelContinuous() {
this.wheelP = this.shooter.wheelP;
this.wheelController.setDoneRange(10);
this.wheelController.setMaxOutput(1.0);
this.wheelController.setMinDoneCycles(3);
- this.target = 2700;
+ this.target = shooter.getCurrentShootingSpeed();
}
@Override
double calculatedShooterIncrement = this.wheelController
.calcPID(this.shooter.getShooterRPM());
shooterSpeed += calculatedShooterIncrement;
- if (shooterSpeed > 1.0)
- this.shooter.setFlyWheelMotorVal(1.0);
- else
- this.shooter.setFlyWheelMotorVal(shooterSpeed);
- // this.shooter.setFlyWheelMotorVal(this.shooter.CURRENT_SHOOTING_SPEED);
+ this.shooter.setFlyWheelMotorVal(shooterSpeed);
}
@Override
import edu.wpi.first.wpilibj.command.Subsystem;
public class Shooter extends Subsystem {
- public double wheelP = 0.0003, wheelI = 0, wheelD = -0.00004;
+ public double wheelP = 0.0001, wheelI = 0, wheelD = 0.0004;
private static Shooter shooter;
private static HallEffectSensor hallEffect;
private final CANTalon flyWheel1, flyWheel2, indexWheel;
- public static final double DEFAULT_INDEXING_SPEED = -1.0;
- public static final double DEFAULT_SHOOTING_SPEED = 0.75;
- public static double CURRENT_SHOOTING_SPEED = DEFAULT_SHOOTING_SPEED;
+ public static final double DEFAULT_INDEXING_SPEED = -0.75;
+ public static final double DEFAULT_SHOOTING_SPEED = 2700; // rpm
+ private static double CURRENT_SHOOTING_SPEED = DEFAULT_SHOOTING_SPEED;
- public static final double SHOOTING_SPEED_INCREMENT = 0.05;
+ public static final double SHOOTING_SPEED_INCREMENT = 25;
private Shooter() {
flyWheel1 = new CANTalon(Constants.Shooter.FLY_WHEEL1);