Skip to content

Commit

Permalink
Changed SetFlywheelSpeed().
Browse files Browse the repository at this point in the history
  • Loading branch information
NottheIRS committed Feb 17, 2024
1 parent a91ecb1 commit f7563af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions src/main/cpp/subsystems/LauncherHAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,17 @@ LauncherHAL::LauncherHAL()

void LauncherHAL::SetFlywheelSpeed(double speed)
{
units::angular_velocity::turns_per_second_t speed_tps = units::angular_velocity::turns_per_second_t(speed);
ctre::phoenix6::controls::VelocityVoltage m_request{speed_tps};
m_FlywheelActMotorA.SetControl(m_request.WithVelocity(speed_tps));
if (speed > 1.0)
{
units::angular_velocity::turns_per_second_t speed_tps = units::angular_velocity::turns_per_second_t(speed);
ctre::phoenix6::controls::VelocityVoltage m_request{speed_tps};
m_FlywheelActMotorA.SetControl(m_request.WithVelocity(speed_tps));
}
else
{
ctre::phoenix6::controls::DutyCycleOut m_request{0.0};
m_FlywheelActMotorA.SetControl(m_request.WithOutput(0.0));
}
}

void LauncherHAL::SetIndexerSpeed(double speed)
Expand Down
2 changes: 1 addition & 1 deletion src/main/include/subsystems/SubSystemConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const int LAUNCHER_IND_MTR_ID = 7;

const int LAUNCHER_PVT_ENCODER_ID = 9;

const double FLYWHEEL_P = 1.0;
const double FLYWHEEL_P = 0.25;
const double FLYWHEEL_I = 0.0;
const double FLYWHEEL_D = 0.0;

Expand Down

0 comments on commit f7563af

Please sign in to comment.