case WaffleHouse: // AKA Betabot
turret = new Turret();
- //shooter = new Shooter();
+ shooter = new Shooter();
//hood = new Hood();
case SwerveCompetition: // AKA "Vantage"
lastHoodAngle = hoodAngle;
if (Math.abs(lastTurretAngle.getDegrees() - turretSetpoint) > 90) {
- velocityAdjustment = -drivetrain.getAngularRate(2) * 1.4;
+ velocityAdjustment = -drivetrain.getAngularRate(2) * 1.0;
}
}
turret.setFieldRelativeTarget(new Rotation2d(Units.degreesToRadians(turretSetpoint)), turretVelocity - drivetrain.getAngularRate(2));
//hood.setFieldRelativeTarget(new Rotation2d(Units.degreesToRadians(hoodSetpoint)), hoodVelocity);
- //shooter.setShooter(goalState.exitVel());
+ shooter.setShooter(goalState.exitVel());
SmartDashboard.putNumber("Turret Calculated Setpoint", turretSetpoint);
SmartDashboard.putNumber("Hood Calculate Setpoint", hoodSetpoint);
public void end(boolean interrupted) {
// Set the turret to a safe position when the command ends
turret.setFieldRelativeTarget(new Rotation2d(0.0), 0.0);
- //shooter.setShooter(0.0);
+ shooter.setShooter(0.0);
//hood.setFieldRelativeTarget(new Rotation2d(Units.degreesToRadians(HoodConstants.MAX_ANGLE)), 0.0);
if(spindexer != null){
spindexer.stopSpindexer();
-package frc.robot.subsystems.Shooter;
+package frc.robot.subsystems.shooter;
import org.littletonrobotics.junction.AutoLogOutput;
import org.littletonrobotics.junction.Logger;
import edu.wpi.first.math.util.Units;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
+import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.constants.Constants;
import frc.robot.constants.IdConstants;
shooterMotorRight.getConfigurator().apply(
new MotorOutputConfigs().withNeutralMode(NeutralModeValue.Coast)
);
+
+ SmartDashboard.putData("Turn on shooter", new InstantCommand(()-> setShooter(20.0)));
}
@Override
public void periodic(){
+ shooterMotorRight.set(1.0);
+ shooterMotorLeft.set(1.0);
updateInputs();
powerModifier = SmartDashboard.getNumber("shooter power modifier", powerModifier);
SmartDashboard.putNumber("shooter power modifier", powerModifier);
- shooterMotorLeft.setControl(voltageRequest.withVelocity(shooterTargetSpeed * powerModifier));
- shooterMotorRight.setControl(voltageRequest.withVelocity(shooterTargetSpeed * powerModifier));
+ //shooterMotorLeft.setControl(voltageRequest.withVelocity(shooterTargetSpeed * powerModifier));
+ //shooterMotorRight.setControl(voltageRequest.withVelocity(shooterTargetSpeed * powerModifier));
}
public void deactivateShooterAndFeeder() {
double motorRotations = turretRotations * TurretConstants.TURRET_GEAR_RATIO;
motor.setPosition(motorRotations);
+ motor.setPosition(0.0); //TODO: remove after hardcrt works
+
SmartDashboard.putData("Turret Mech", mech);
SmartDashboard.putData("Turret to 90", new InstantCommand(()-> setFieldRelativeTarget(new Rotation2d(Math.PI/2), 0.0)));
Logger.recordOutput("Turret/Voltage", motor.getMotorVoltage().getValue());
Logger.recordOutput("Turret/velocitySetpoint", targetVelocity / GEAR_RATIO);
+ Logger.recordOutput("Turret/setpointDeg", Units.radiansToDegrees(setpoint.position));
// --- Visualization ---
ligament.setAngle(Units.radiansToDegrees(getPositionRad()));
- SmartDashboard.putNumber("Turret SetpointDeg",
- Units.radiansToDegrees(setpoint.position));
- SmartDashboard.putNumber("Turret motorVelRotPerSec",
- Units.radiansToDegrees(motorVelRotPerSec));
- SmartDashboard.putNumber("Turret targetVelocity",
- Units.radiansToDegrees(targetVelocity));
- SmartDashboard.putNumber("Turret Position Deg",
- Units.rotationsToDegrees(motor.getPosition().getValueAsDouble()) / GEAR_RATIO);
-
updateInputs();
Logger.processInputs("Turret", inputs);