Skip to content

Commit

Permalink
Draft PR for the Outtake Position to master branch (#26)
Browse files Browse the repository at this point in the history
* Create outtake position configuration for amp scoring

Authored by Alex and tested by Harsh
  • Loading branch information
nick-mcgill authored Feb 28, 2024
1 parent cc3508b commit ed13753
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/cpp/subsystems/SmartIntake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ void SmartIntake::HandleInput(RobotControlData& input){
case 0:
{
input.launcherInput.goToStowPos = true;
input.intakeInput.goToGroundPos = true;
input.intakeInput.goToOutakePos = true;
++m_OutTakeState;
}
break;
case 1:
{
input.launcherInput.goToStowPos = false;
input.intakeInput.goToGroundPos = false;
if (input.intakeOutput.intakePos == IntakePos::GROUND)
input.intakeInput.goToOutakePos = false;
if (input.intakeOutput.intakePos == IntakePos::OUTAKE)
{
++m_OutTakeState;
}
Expand All @@ -149,7 +149,7 @@ void SmartIntake::HandleInput(RobotControlData& input){
}
case 3:
{
if (m_timer.Get() > units::second_t(0.45))
if (m_timer.Get() > units::second_t(0.04))
{
m_SmartOutTakeFlag = false;
m_OutTakeState = 0;
Expand Down
24 changes: 24 additions & 0 deletions src/main/cpp/subsystems/subsystemManagers/IntakeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace
const double GROUND_POS = 132.056;
const double STOW_POS = 68.144;
const double PSEUDO_STOW_POS = 104.671;
const double OUTAKE_POS = 113.4; //change later
}

void IntakeManager::ResetIntake()
Expand All @@ -15,6 +16,7 @@ void IntakeManager::ResetIntake()
m_goToStowPos = false;
m_goToAmpPos = false;
m_goToPseudoStowPos = false;
m_goToOutakePos = false;
}

void IntakeManager::HandleInput(IntakeInput &input, IntakeOutput &output)
Expand All @@ -40,6 +42,7 @@ void IntakeManager::HandleInput(IntakeInput &input, IntakeOutput &output)
m_goToGroundPos = false;
m_goToStowPos = false;
m_goToPseudoStowPos = false;
m_goToOutakePos = false;
}
else if (input.goToStowPos)
{
Expand All @@ -48,6 +51,7 @@ void IntakeManager::HandleInput(IntakeInput &input, IntakeOutput &output)
m_goToGroundPos = false;
m_goToStowPos = true;
m_goToPseudoStowPos = false;
m_goToOutakePos = false;
}
else if (input.goToGroundPos)
{
Expand All @@ -56,6 +60,7 @@ void IntakeManager::HandleInput(IntakeInput &input, IntakeOutput &output)
m_goToGroundPos = true;
m_goToStowPos = false;
m_goToPseudoStowPos = false;
m_goToOutakePos = false;
}
else if (input.goToAmpPos)
{
Expand All @@ -64,6 +69,7 @@ void IntakeManager::HandleInput(IntakeInput &input, IntakeOutput &output)
m_goToGroundPos = false;
m_goToStowPos = false;
m_goToPseudoStowPos = false;
m_goToOutakePos = false;
}
else if (input.goToPseudoStowPos)
{
Expand All @@ -72,6 +78,16 @@ void IntakeManager::HandleInput(IntakeInput &input, IntakeOutput &output)
m_goToGroundPos = false;
m_goToStowPos = false;
m_goToPseudoStowPos = true;
m_goToOutakePos = false;
}
else if (input.goToOutakePos)
{
m_intake.ResetProfiledMoveState();
m_goToAmpPos = false;
m_goToGroundPos = false;
m_goToStowPos = false;
m_goToPseudoStowPos = false;
m_goToOutakePos = true;
}

if (m_goToAmpPos)
Expand All @@ -90,6 +106,10 @@ void IntakeManager::HandleInput(IntakeInput &input, IntakeOutput &output)
{
m_intake.ProfiledMoveToAngle(PSEUDO_STOW_POS);
}
if (m_goToOutakePos)
{
m_intake.ProfiledMoveToAngle(OUTAKE_POS);
}

output.intakePos = IntakePos::UNKNOWN;
double tolerance = 0.5;
Expand All @@ -109,4 +129,8 @@ void IntakeManager::HandleInput(IntakeInput &input, IntakeOutput &output)
{
output.intakePos = IntakePos::STOW;
}
else if (std::fabs(m_intake.GetAngle() - OUTAKE_POS) < tolerance)
{
output.intakePos = IntakePos::OUTAKE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ struct IntakeInput
bool goToStowPos;
bool goToAmpPos;
bool goToPseudoStowPos;
bool goToOutakePos;
double manualMove;
};

Expand All @@ -19,6 +20,7 @@ enum class IntakePos
GROUND,
STOW,
PSEUDO_STOW,
OUTAKE,
UNKNOWN
};

Expand All @@ -40,4 +42,5 @@ class IntakeManager
bool m_goToStowPos;
bool m_goToAmpPos;
bool m_goToPseudoStowPos;
bool m_goToOutakePos;
};

0 comments on commit ed13753

Please sign in to comment.