Skip to content

Commit

Permalink
added tuning mode to shooter
Browse files Browse the repository at this point in the history
  • Loading branch information
r4stered committed Oct 18, 2024
1 parent 1f880d6 commit b6c91c9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/main/cpp/RobotContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ void RobotContainer::ConfigureBindings() {
operatorController.B().OnFalse(shooterSubsystem.RunShooter(
[] { return consts::shooter::PRESET_SPEEDS::OFF; }));

operatorController.Start().WhileTrue(shooterSubsystem.RunShooter([] { return consts::shooter::PRESET_SPEEDS::TUNING; }));
operatorController.Start().OnFalse(shooterSubsystem.RunShooter([] { return consts::shooter::PRESET_SPEEDS::OFF; }));

operatorController.Back().WhileTrue(
frc2::cmd::Parallel(intakeSubsystem.PoopNote(), feederSubsystem.Eject()));

Expand Down
5 changes: 5 additions & 0 deletions src/main/cpp/subsystems/ShooterSubsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ frc2::CommandPtr ShooterSubsystem::RunShooter(
consts::shooter::BOTTOM_SHOOTER_LUT[distance()];
neutralState = false;
break;
case consts::shooter::PRESET_SPEEDS::TUNING:
topWheelVelocitySetpoint = units::revolutions_per_minute_t{topWheelTuningSetpoint.Get()};
bottomWheelVelocitySetpoint = units::revolutions_per_minute_t{bottomWheelTuningSetpoint.Get()};
neutralState = false;
break;
case consts::shooter::PRESET_SPEEDS::OFF:
topWheelVelocitySetpoint = 0_rpm;
bottomWheelVelocitySetpoint = 0_rpm;
Expand Down
2 changes: 1 addition & 1 deletion src/main/deploy/commit.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
aefe2b0
1f880d6
2 changes: 1 addition & 1 deletion src/main/include/constants/ShooterConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ inline static wpi::interpolating_map<units::meter_t, units::turns_per_second_t>
inline static wpi::interpolating_map<units::meter_t, units::turns_per_second_t>
BOTTOM_SHOOTER_LUT{};

enum class PRESET_SPEEDS { OFF, AMP, SPEAKER_DIST, SUBWOOFER, PASS };
enum class PRESET_SPEEDS { OFF, AMP, SPEAKER_DIST, SUBWOOFER, PASS, TUNING };
} // namespace shooter
} // namespace consts
2 changes: 2 additions & 0 deletions src/main/include/subsystems/ShooterSubsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ class ShooterSubsystem : public frc2::SubsystemBase {
nt->GetDoubleTopic("BottomWheelSetpointRPM").Publish()};
nt::BooleanPublisher isUpToSpeedPub{
nt->GetBooleanTopic("IsUpToSpeed").Publish()};
nt::DoubleEntry topWheelTuningSetpoint{nt->GetDoubleTopic("TopWheelTuningSetpoint").GetEntry(0)};
nt::DoubleEntry bottomWheelTuningSetpoint{nt->GetDoubleTopic("BottomWheelTuningSetpoint").GetEntry(0)};

units::turns_per_second_t topWheelVelocitySetpoint{0_rpm};
units::turns_per_second_t bottomWheelVelocitySetpoint{0_rpm};
Expand Down

0 comments on commit b6c91c9

Please sign in to comment.