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

Changes to SmartIntake, need to be confirmed and pushed to master #18

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Changes from 1 commit
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
61 changes: 15 additions & 46 deletions src/main/cpp/subsystems/SmartIntake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,43 +59,28 @@ void SmartIntake::HandleInput(RobotControlData& input){
}
}
break;
case 2:
{
input.intakeInput.runIntakeIn = true;
if (input.smartIntakeInput.laser){
input.intakeInput.runIntakeIn = false;
input.intakeInput.goToPseudoStowPos = true;
++m_IntakeState;
}

}
break;
case 3:
{
input.intakeInput.goToPseudoStowPos = false;
if (input.intakeOutput.intakePos == IntakePos::PSEUDO_STOW)
{
++m_IntakeState;
}
}
break;

default:
m_SmartIntakeFlag = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be in the default case. Make an explicit case for switching over to false. We use the default case to do nothing

break;
}
}
else
{
switch (m_IntakeState)
{
case 0:
case 2:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should start at case 0.

{
/* code */
input.intakeInput.runIntakeIn = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checking if the laser hit should be in the true case. The if statement should conditionally transfer to the false case

if (input.smartIntakeInput.laser){
input.intakeInput.runIntakeIn = false;
input.intakeInput.goToPseudoStowPos = true;
++m_IntakeState;
}

}
break;
case 1:
case 3:
{
input.intakeInput.goToPseudoStowPos = false;
if (input.intakeOutput.intakePos == IntakePos::PSEUDO_STOW)
Expand Down Expand Up @@ -130,27 +115,8 @@ void SmartIntake::HandleInput(RobotControlData& input){
}
}
break;
case 2:
{
input.intakeInput.runIntakeOut = true;
if (input.smartIntakeInput.laser){
input.intakeInput.runIntakeOut = false;
input.intakeInput.goToPseudoStowPos = true;
++m_OutTakeState;
}

}
break;
case 3:
{
input.intakeInput.goToPseudoStowPos = false;
if (input.intakeOutput.intakePos == IntakePos::PSEUDO_STOW)
{
++m_OutTakeState;
}
}
break;
default:
m_SmartOutTakeFlag = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see associated comment for intake

break;
}
}
Expand All @@ -159,15 +125,18 @@ void SmartIntake::HandleInput(RobotControlData& input){

switch (m_OutTakeState)
{
case 0:
case 2:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see associated comment for intake

{
/* code */
input.intakeInput.runIntakeOut = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see associated comment for intake

if (input.smartIntakeInput.laser){
input.intakeInput.runIntakeOut = false;
input.intakeInput.goToPseudoStowPos = true;
++m_OutTakeState;
}

}
break;
case 1:
case 3:
{
input.intakeInput.goToPseudoStowPos = false;
if (input.intakeOutput.intakePos == IntakePos::PSEUDO_STOW)
Expand Down