From 62a75501a16e6bc05a0ea8531b9a12dcb5980b18 Mon Sep 17 00:00:00 2001 From: j a Date: Wed, 14 Sep 2022 18:48:18 -0500 Subject: [PATCH] added turret disable dashboard button --- Competition/src/main/cpp/subsystems/Shooter.cpp | 12 +++++++++++- Competition/src/main/include/subsystems/Shooter.h | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Competition/src/main/cpp/subsystems/Shooter.cpp b/Competition/src/main/cpp/subsystems/Shooter.cpp index ca80512..14217e0 100644 --- a/Competition/src/main/cpp/subsystems/Shooter.cpp +++ b/Competition/src/main/cpp/subsystems/Shooter.cpp @@ -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); @@ -120,6 +122,8 @@ void Shooter::init() state.pipeline = 0; state.LoBFZoom = 1; + + state.disableTurret = false; resetState(); resetEncoder(); @@ -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()); @@ -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) ){ diff --git a/Competition/src/main/include/subsystems/Shooter.h b/Competition/src/main/include/subsystems/Shooter.h index 6c6730f..4552ecb 100644 --- a/Competition/src/main/include/subsystems/Shooter.h +++ b/Competition/src/main/include/subsystems/Shooter.h @@ -123,6 +123,8 @@ class Shooter : public ValorSubsystem double tv; double tx; + bool disableTurret; + } state; void limelightTrack(bool track);