Skip to content

Commit

Permalink
Set conversion factor, zero offest, inversion for launcher pvt abs en…
Browse files Browse the repository at this point in the history
…c; set max/min angles for launcher.
  • Loading branch information
NottheIRS committed Feb 18, 2024
1 parent 6d29ccb commit ac79bb3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/main/cpp/subsystems/LauncherHAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ LauncherHAL::LauncherHAL()

m_PvtPID.SetPositionPIDWrappingEnabled(false);

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

m_PvtPID.SetFeedbackDevice(m_PvtAbsEncoder);

m_PvtMotor.SetSmartCurrentLimit(LAUNCHER_PVT_CURRENT_LIMIT);
Expand Down Expand Up @@ -61,6 +65,15 @@ void LauncherHAL::SetIndexerSpeed(double speed)

void LauncherHAL::SetAngle(double angle)
{
if (angle > MAX_PIVOT_ANGLE)
{
angle = MAX_PIVOT_ANGLE;
}
else if (angle < MIN_PIVOT_ANGLE)
{
angle = MIN_PIVOT_ANGLE;
}

m_PvtPID.SetReference(angle, rev::CANSparkMax::ControlType::kPosition);
}

Expand Down
10 changes: 8 additions & 2 deletions src/main/include/subsystems/SubSystemConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const bool LFT_PVT_MTR_INVERTED = true;
// ###########################################################
const int FLYWHEEL_TOP_ID = 22;
const int FLYWHEEL_BOTTOM_ID = 23;
const int LAUNCHER_PVT_MTR_ID = 6;
const int LAUNCHER_PVT_MTR_ID = 21;
const int LAUNCHER_IND_MTR_ID = 7;

const int LAUNCHER_PVT_ENCODER_ID = 9;
Expand All @@ -63,4 +63,10 @@ const int LAUNCHER_PVT_CURRENT_LIMIT = 20;
const int FLYWHEEL_ACT_CURRENT_LIMIT = 20;
const int LAUNCHER_IND_CURRENT_LIMIT = 20;

const bool INVERT_FLYWHEEL = true;
const bool INVERT_FLYWHEEL = true;

const double LAUNCHER_PVT_ABS_ENC_CONVERSION_FACTOR = 80.0;
const double ZERO_OFFSET = 36.221;

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

0 comments on commit ac79bb3

Please sign in to comment.