Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/FRC830/2024Robot
Browse files Browse the repository at this point in the history
  • Loading branch information
NottheIRS committed Feb 21, 2024
2 parents 224e00e + 48560f8 commit ba4f518
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 44 deletions.
3 changes: 3 additions & 0 deletions src/main/cpp/subsystems/IntakeHAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ IntakeHAL::IntakeHAL(){
m_RGTActMotor.RestoreFactoryDefaults();
m_RGTPvtMotor.RestoreFactoryDefaults();

m_LFTActMotor.SetInverted(INVERT_INTAKE_ACT);

m_RGTActMotor.Follow(m_LFTActMotor, true);
m_RGTPvtMotor.Follow(m_LFTPvtMotor, false);

Expand All @@ -33,6 +35,7 @@ IntakeHAL::IntakeHAL(){

m_LFTPvtAbsEncoder.SetInverted(LFT_PVT_ABS_ENC_INVERTED);
m_LFTPvtAbsEncoder.SetPositionConversionFactor(LFT_PVT_ABS_ENC_CONVERSION_FACTOR);
m_LFTPvtAbsEncoder.SetZeroOffset(INTAKE_ZERO_OFFSET);

m_LFTPvtMotor.SetInverted(LFT_PVT_MTR_INVERTED);

Expand Down
2 changes: 1 addition & 1 deletion src/main/cpp/subsystems/LauncherHAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ LauncherHAL::LauncherHAL()

m_PvtAbsEncoder.SetInverted(true);
m_PvtAbsEncoder.SetPositionConversionFactor(LAUNCHER_PVT_ABS_ENC_CONVERSION_FACTOR);
m_PvtAbsEncoder.SetZeroOffset(ZERO_OFFSET);
m_PvtAbsEncoder.SetZeroOffset(LAUNCHER_ZERO_OFFSET);

m_PvtPID.SetFeedbackDevice(m_PvtAbsEncoder);

Expand Down
54 changes: 16 additions & 38 deletions src/main/cpp/subsystems/SmartIntake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ SmartIntake::SmartIntake()
m_SwitchModeFlag = false;
m_prevSwitchMode = false;

m_IntakeState = 0;
m_OutTakeState = 0;
m_IntakeState = 10000;
m_OutTakeState = 10000;
}

void SmartIntake::HandleInput(RobotControlData& input){
Expand Down Expand Up @@ -62,20 +62,10 @@ void SmartIntake::HandleInput(RobotControlData& input){
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)
if (input.smartIntakeInput.laser)
{
++m_IntakeState;
m_SmartIntakeFlag = false;
m_IntakeState = 0;
}
}
break;
Expand All @@ -89,10 +79,9 @@ void SmartIntake::HandleInput(RobotControlData& input){
{
case 0:
{
/* code */
input.intakeInput.runIntakeIn = false;
input.intakeInput.goToPseudoStowPos = true;
++m_IntakeState;
input.intakeInput.runIntakeIn = false;
input.intakeInput.goToPseudoStowPos = true;
++m_IntakeState;
}
break;
case 1:
Expand Down Expand Up @@ -133,20 +122,10 @@ void SmartIntake::HandleInput(RobotControlData& input){
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)
if (input.smartIntakeInput.laser)
{
++m_OutTakeState;
m_SmartOutTakeFlag = false;
m_OutTakeState = 0;
}
}
break;
Expand All @@ -160,11 +139,10 @@ void SmartIntake::HandleInput(RobotControlData& input){
switch (m_OutTakeState)
{
case 0:
{
/* code */
input.intakeInput.runIntakeOut = false;
input.intakeInput.goToPseudoStowPos = true;
++m_OutTakeState;
{
input.intakeInput.runIntakeOut = false;
input.intakeInput.goToPseudoStowPos = true;
++m_OutTakeState;
}
break;
case 1:
Expand All @@ -181,7 +159,7 @@ void SmartIntake::HandleInput(RobotControlData& input){
}
}

// needs to go at the bottom
// needs to go at the bottom
m_prevSmartIntake = input.smartIntakeInput.smartIntake;
m_prevSmartOutTake = input.smartIntakeInput.smartOutTake;
m_prevSwitchMode = input.smartIntakeInput.switchMode;
Expand Down
8 changes: 4 additions & 4 deletions src/main/cpp/subsystems/subsystemManagers/IntakeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace
{
const double NORMAL_INTAKE_SPEED = 0.95;
const double AMP_POS = 72.686;
const double GROUND_POS = 182.953;
const double STOW_POS = 119.375;
const double PSEUDO_STOW_POS = 153.105;
const double AMP_POS = 19.361;
const double GROUND_POS = 132.056;
const double STOW_POS = 68.144;
const double PSEUDO_STOW_POS = 104.671;
}

void IntakeManager::ResetIntake()
Expand Down
5 changes: 4 additions & 1 deletion src/main/include/subsystems/SubSystemConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ const int INTAKE_ACT_CURRENT_LIMIT = 40;

const double INTAKE_MAX_VEL = 60.0;
const double INTAKE_ACCEL = 30.0;
const double INTAKE_ZERO_OFFSET = 299.92;

const bool LFT_PVT_ABS_ENC_INVERTED = false;
const double LFT_PVT_ABS_ENC_CONVERSION_FACTOR = 360.0;
const bool LFT_PVT_MTR_INVERTED = true;

const bool INVERT_INTAKE_ACT = true;

// ###########################################################
// # LAUNCHER #
// ###########################################################
Expand All @@ -64,7 +67,7 @@ const int LAUNCHER_IND_CURRENT_LIMIT = 28;
const bool INVERT_FLYWHEEL = true;

const double LAUNCHER_PVT_ABS_ENC_CONVERSION_FACTOR = 80.0;
const double ZERO_OFFSET = 13.501;
const double LAUNCHER_ZERO_OFFSET = 13.501;

const double MAX_PIVOT_ANGLE = 75.0;
const double MIN_PIVOT_ANGLE = 5.0;
Expand Down

0 comments on commit ba4f518

Please sign in to comment.