Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added turret disable dashboard button #78

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
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