Skip to content

Commit

Permalink
feature(intake): operator right trigger overrides spike logic
Browse files Browse the repository at this point in the history
  • Loading branch information
AntarcticaByToto authored and mray190 committed Mar 3, 2023
1 parent 49625c2 commit b9d5a9c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/main/cpp/subsystems/Intake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ void Intake::init()
state.coneCacheSize = CONE_CACHE_SIZE;
state.cubeCacheSize = CUBE_CACHE_SIZE;

state.intakeOp = false;

prevState = state;

currentSensor.setSpikeSetpoint(state.coneSpikeCurrent);
Expand Down Expand Up @@ -93,7 +95,7 @@ void Intake::assessInputs()
} else if (state.intakeState != SPIKED) {

// Driver or operator ground pickup
if (driverGamepad->GetLeftBumper() || driverGamepad->GetRightBumper() || operatorGamepad->leftTriggerActive() ||
if (driverGamepad->GetLeftBumper() || driverGamepad->GetRightBumper() ||
// Operator human player pickup
operatorGamepad->GetXButton() || operatorGamepad->DPadLeft()) {
if (driverGamepad->GetYButton()){
Expand All @@ -116,6 +118,12 @@ void Intake::assessInputs()
} else {
state.intakeState = DISABLED;
}

if(operatorGamepad->leftTriggerActive()){
state.intakeOp = true;
} else{
state.intakeOp = false;
}
}

void Intake::analyzeDashboard()
Expand All @@ -137,6 +145,12 @@ void Intake::assignOutputs()
{
if (state.intakeState == DISABLED) {
intakeMotor.setPower(0);
} else if (state.intakeOp){
if (state.pieceState == CONE){
intakeMotor.setPower(state.intakeConeSpeed);
} else{
intakeMotor.setPower(state.intakeCubeSpeed);
}
} else if (state.intakeState == SPIKED) {
if (state.pieceState == CONE){
intakeMotor.setPower(state.coneHoldSpeed);
Expand Down
2 changes: 2 additions & 0 deletions src/main/include/subsystems/Intake.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class Intake : public ValorSubsystem
double coneCacheSize;
double cubeCacheSize;

bool intakeOp;

}state, prevState;

std::unordered_map<std::string, IntakeStates> stringToStateMap = {
Expand Down

0 comments on commit b9d5a9c

Please sign in to comment.