Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ public static class ShooterConstants
public static final Current FEEDER_CURRENT_LIMIT = Amps.of(60);
public static final Voltage FEEDER_VOLTAGE = Volts.of(6);
public static final Current ROTOR_CURRENT_LIMIT = Amps.of(80);
public static final Voltage ROTOR_FAST_VOLTAGE = Volts.of(3.0);
public static final Voltage ROTOR_MID_VOLTAGE = Volts.of(1.5);
public static final Voltage ROTOR_RETRACTED_VOLTAGE = Volts.of(1.0);
public static final Voltage ROTOR_FAST_VOLTAGE = Volts.of(8.0);
public static final Voltage ROTOR_MID_VOLTAGE = Volts.of(8.0);
public static final Voltage ROTOR_RETRACTED_VOLTAGE = Volts.of(8.0);

// TODO: Tune these values with testing!
public static AngularVelocity getFlywheelSpeedForDistance(Distance distance)
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/frc/robot/NetParams.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package frc.robot;

public class NetParams
{
public NetParams()
{
turretAngle = 0;
flywheelSpeed = 70;
}

public double turretAngle;
public double flywheelSpeed;
}
18 changes: 7 additions & 11 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import edu.wpi.first.units.measure.AngularVelocity;
import edu.wpi.first.units.measure.Dimensionless;
import edu.wpi.first.units.measure.LinearVelocity;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.button.CommandJoystick;
Expand All @@ -24,6 +25,7 @@
import frc.robot.subsystems.intake.Intake;
import frc.robot.subsystems.shooter.Shooter;
import frc.robot.util.MeasureUtil;
import frc.robot.NetParams;

@Logged
public class RobotContainer
Expand All @@ -39,7 +41,8 @@ public class RobotContainer
private final Shooter _shooter = new Shooter(_drive::getState, _intake::isExtended, _intake::isRetracted);
private final Autos _autos = new Autos(_drive, _shooter, _intake);
// private Dimensionless _driveMultiplier = DriveConstants.FULL_SPEED_SCALE;
private double _manualFlywheelRPM = MANUAL_FLYWHEEL_START_RPM;
private double _manualFlywheelRPM = MANUAL_FLYWHEEL_START_RPM;
private NetParams _params;

public RobotContainer()
{
Expand All @@ -66,12 +69,6 @@ private SwerveRequest.FieldCentric getFieldCentricRequest()
return _fieldCentric.withVelocityX(getDrive()).withVelocityY(getStrafe()).withRotationalRate(getRotate());
}

private void setManualFlywheelRPM(double rpm)
{
_manualFlywheelRPM = Math.max(0.0, rpm);
_shooter.setManualFlywheel(_manualFlywheelRPM);
}

private void configureBindings()
{
_drive.setDefaultCommand(_drive.applyRequest(this::getFieldCentricRequest));
Expand All @@ -82,7 +79,7 @@ private void configureBindings()
// _driver.button(1).whileTrue(Commands.parallel(_shooter.shoot(),
// Commands.startEnd(() -> _drive.disableVisionPoseCorrection(true), () ->
// _drive.disableVisionPoseCorrection(false))));
_driver.button(1).whileTrue(_shooter.manualShootCmd(() -> _manualFlywheelRPM));
_driver.button(1).whileTrue(_shooter.manualShootCmd(() -> _params.flywheelSpeed));
// _driver.button(2).whileTrue(Commands.startEnd(() -> _driveMultiplier =
// DriveConstants.SLOW_MODE_SCALE, () -> _driveMultiplier =
// DriveConstants.FULL_SPEED_SCALE));
Expand All @@ -104,13 +101,12 @@ private void configureBindings()
_operator.leftTrigger().whileTrue(_intake.runRollersForward());
_operator.leftBumper().whileTrue(_intake.runRollersReverse());
_operator.rightTrigger().whileTrue(_intake.jiggle());
_operator.y().onTrue(Commands.runOnce(() -> setManualFlywheelRPM(MANUAL_FLYWHEEL_START_RPM)));
_operator.x().onTrue(Commands.runOnce(() -> setManualFlywheelRPM(_manualFlywheelRPM - MANUAL_FLYWHEEL_STEP_RPM)));
_operator.b().onTrue(Commands.runOnce(() -> setManualFlywheelRPM(_manualFlywheelRPM + MANUAL_FLYWHEEL_STEP_RPM)));
_operator.a().onTrue(Commands.runOnce(_shooter::stopManualFlywheel));
_operator.rightBumper().whileTrue(_shooter.runManualFeeder());
_operator.povDown().onTrue(_intake.getRetractCmd());
_operator.povUp().onTrue(_intake.getExtendCmd());

SmartDashboard.putData(_shooter.setTurretAngleCmd(() -> _params.turretAngle));
}

public Command getAutonomousCommand()
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/frc/robot/subsystems/shooter/Shooter.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ public Command setManualTurretAngle(Angle angle)
return runOnce(() -> setManualTurretAngleCommand(angle));
}

public Command setTurretAngleCmd(DoubleSupplier angle)
{
return runOnce(() -> setManualTurretAngleCommand(Degrees.of(angle.getAsDouble())));
}

public Command manualShootCmd(DoubleSupplier speed)
{
// @formatter:off
Expand Down