case WaffleHouse: // AKA Betabot
turret = new Turret();
- shooter = new Shooter();
- hood = new Hood();
+ //shooter = new Shooter();
+ //hood = new Hood();
case SwerveCompetition: // AKA "Vantage"
FieldConstants.getHubTranslation().minus(new Translation3d(drivepose.getTranslation())),
8.0); // Random initial goalState to prevent it being null
- addRequirements(turret, hood, shooter);
+ addRequirements(turret);
}
public void updateSetpoints(Pose2d drivepose) {
Translation3d target3d = new Translation3d(target.getX(), target.getY(), FieldConstants.getHubTranslation().getZ()); // Add if statement so that it's only when it's shooting
goalState = ShooterPhysics.getShotParams(
target3d.minus(lookahead3d),
- 8.0);
+ 2.0);
timeOfFlight = goalState.timeOfFlight();
double offsetX = turretVelocityX * timeOfFlight;
public void execute() {
updateDrivePose();
updateSetpoints(drivepose);
- //turret.setFieldRelativeTarget(new Rotation2d(Units.degreesToRadians(turretSetpoint)), turretVelocity - drivetrain.getAngularRate(2));
+ turret.setFieldRelativeTarget(new Rotation2d(Units.degreesToRadians(turretSetpoint)), turretVelocity - drivetrain.getAngularRate(2));
//hood.setFieldRelativeTarget(new Rotation2d(Units.degreesToRadians(hoodSetpoint)), hoodVelocity);
//shooter.setShooter(goalState.exitVel());
SmartDashboard.putNumber("Turret Calculated Setpoint", turretSetpoint);
SmartDashboard.putNumber("Hood Calculate Setpoint", hoodSetpoint);
+ SmartDashboard.putNumber("Shooter Calculate Velocity", goalState.exitVel());
System.out.println("COMMAND IS WORKINNGGG");
/** Spindexer Stuff!! */
public void end(boolean interrupted) {
// Set the turret to a safe position when the command ends
turret.setFieldRelativeTarget(new Rotation2d(0.0), 0.0);
- hood.setFieldRelativeTarget(new Rotation2d(Units.degreesToRadians(HoodConstants.MAX_ANGLE)), 0.0);
+ //shooter.setShooter(0.0);
+ //hood.setFieldRelativeTarget(new Rotation2d(Units.degreesToRadians(HoodConstants.MAX_ANGLE)), 0.0);
if(spindexer != null){
spindexer.stopSpindexer();
}
/** Location of hub target */
public static final Translation3d HUB_BLUE =
- new Translation3d(Units.inchesToMeters(156.8 + 20), 4.035 + .67, Units.inchesToMeters(72));
+ new Translation3d(Units.inchesToMeters(156.8 + 20), 4.035, Units.inchesToMeters(72));
public static final Translation3d HUB_RED =
new Translation3d(FIELD_LENGTH - Units.inchesToMeters(156.8 + 20), 4.035 + .67, Units.inchesToMeters(72));
import frc.robot.constants.Constants;
import frc.robot.subsystems.drivetrain.Drivetrain;
import frc.robot.subsystems.shooter.Shooter;
+import frc.robot.subsystems.shooter.ShooterConstants;
import frc.robot.subsystems.spindexer.Spindexer;
import frc.robot.subsystems.turret.Turret;
import frc.robot.subsystems.hood.Hood;
}
// Auto shoot
- if(turret != null && hood != null){
+ if(turret != null){
driver.get(PS5Button.SQUARE).onTrue(
new InstantCommand(()->{
if (autoShoot != null && autoShoot.isScheduled()){
CommandScheduler.getInstance().schedule(autoShoot);
}
})
- );
+ );
}
+
}
@Override
public Shooter(){
TalonFXConfiguration config = new TalonFXConfiguration();
- config.Slot0.kP = 0.15;
+ config.Slot0.kP = 2.0;
config.Slot0.kI = 0;
config.Slot0.kD = 0.03;
config.Slot0.kV = 0.20;
public void updateInputs() {
inputs.leftShooterVelocity = Units.rotationsToRadians(motorLeft.getVelocity().getValueAsDouble()) * ShooterConstants.SHOOTER_LAUNCH_DIAMETER/2;
- inputs.rightShooterVelocity =Units.rotationsToRadians(motorRight.getVelocity().getValueAsDouble()) * ShooterConstants.SHOOTER_LAUNCH_DIAMETER/2;
+ inputs.rightShooterVelocity = Units.rotationsToRadians(motorRight.getVelocity().getValueAsDouble()) * ShooterConstants.SHOOTER_LAUNCH_DIAMETER/2;
inputs.leftShooterCurrent = motorLeft.getStatorCurrent().getValueAsDouble();
inputs.rightShooterCurrent = motorRight.getStatorCurrent().getValueAsDouble();
}
private static final double MIN_ANGLE_RAD = Units.degreesToRadians(-180); // Change this later to the actual values
private static final double MAX_ANGLE_RAD = Units.degreesToRadians(180);
- private static final double MAX_VEL_RAD_PER_SEC = 25;
+ private static final double MAX_VEL_RAD_PER_SEC = 15;
//private static final double MAX_VEL_RAD_PER_SEC = 3.0; // Starting super duper slow for now
- private static final double MAX_ACCEL_RAD_PER_SEC2 = 160.0;
+ // private static final double MAX_ACCEL_RAD_PER_SEC2 = 160.0;
+ private static final double MAX_ACCEL_RAD_PER_SEC2 = 60.0;
private static final double GEAR_RATIO = TurretConstants.TURRET_GEAR_RATIO;