Skip to content

Commit

Permalink
added turret disable dashboard button
Browse files Browse the repository at this point in the history
  • Loading branch information
AntarcticaByToto committed Sep 14, 2022
1 parent 85bebfd commit c66bb86
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Competition/src/main/cpp/subsystems/Shooter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ void Shooter::init()
table->PutNumber("Hood Y Int 1X", ShooterConstants::cHood_1x);
table->PutNumber("Power Y Int 1X", ShooterConstants::cPower_1x);

table->PutBoolean("Disable Turret", false);

// table->PutNumber("Hood Y Int 2X", ShooterConstants::cHood_2x);
// table->PutNumber("Power Y Int 2X", ShooterConstants::cPower_2x);

Expand Down Expand Up @@ -120,6 +122,8 @@ void Shooter::init()

state.pipeline = 0;
state.LoBFZoom = 1;

state.disableTurret = false;

resetState();
resetEncoder();
Expand Down Expand Up @@ -275,6 +279,8 @@ void Shooter::analyzeDashboard()
}
state.lastTurretState = state.turretState;

state.disableTurret = table->GetBoolean("Disable Turret", false);

table->PutNumber("Hood degrees", hoodEncoder.GetPosition());
table->PutNumber("Turret pos", turretEncoder.GetPosition());

Expand Down Expand Up @@ -320,7 +326,11 @@ void Shooter::assignOutputs()

//MANUAL
state.turretTarget = 0;
if (state.turretState == TurretState::TURRET_MANUAL) {
if (state.disableTurret) {
state.turretOutput = 0;
turret.Set(state.turretOutput);
}
else if (state.turretState == TurretState::TURRET_MANUAL) {
state.turretOutput = operatorController->leftStickX(3) * ShooterConstants::TURRET_SPEED_MULTIPLIER;
if( (turretEncoder.GetPosition() > 160 && state.turretOutput > ShooterConstants::pDeadband) ||
(turretEncoder.GetPosition() < 20 && state.turretOutput < -1 * ShooterConstants::pDeadband) ){
Expand Down
2 changes: 2 additions & 0 deletions Competition/src/main/include/subsystems/Shooter.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ class Shooter : public ValorSubsystem
double tv;
double tx;

bool disableTurret;

} state;

void limelightTrack(bool track);
Expand Down

0 comments on commit c66bb86

Please sign in to comment.