3#include <frc/controller/PIDController.h>
4#include <units/voltage.h>
14 units::revolutions_per_minute_t maxRpm);
16 inline void Set(
double percentage)
override {
17 m_currentRpm = m_maxRpm * percentage;
20 inline void Set(units::volt_t volts)
override {
21 m_currentRpm = m_maxRpm * (volts / 12.7).value();
25 m_pidController.SetTolerance(tolerance);
38 inline void ResetEncoder()
override { m_currentRelativePosition = 0; }
41 return m_currentRelativePosition * m_conversionFactor;
49 m_conversionFactor = factor;
59 m_settings = settings;
64 frc::PIDController m_pidController;
65 double m_currentRelativePosition = 0;
66 bool m_absolutePositionEnabled =
false;
67 double m_conversionFactor = 1.0;
68 double m_absoluteTarget = 0;
69 const units::revolutions_per_minute_t m_maxRpm;
70 units::revolutions_per_minute_t m_currentRpm = 0_rpm;
const PidSettings & GetPidSettings() override
SimPidMotorController(std::string name, PidSettings pidSettings, units::revolutions_per_minute_t maxRpm)
void Set(units::volt_t volts) override
void SetEncoderConversionFactor(double factor) override
double GetEncoderPosition() override
void RunWithVelocity(double percentage) override
void RunWithVelocity(units::revolutions_per_minute_t rpm) override
void SetPidTolerance(double tolerance) override
void SetAbsoluteEncoderConversionFactor(double factor) override
void UpdatePidSettings(PidSettings settings) override
void ResetEncoder() override
void Set(double percentage) override
void RunToPosition(double position) override
std::optional< double > GetAbsoluteEncoderPosition() override