[examples] Make DriveDistanceOffboard example work in sim (#3199)

Adds some basic functionality to the ExampleMotorController so that
controller inputs show up in LiveWindow widgets in simulation.
This commit is contained in:
Prateek Machiraju
2021-03-04 02:38:13 -05:00
committed by GitHub
parent f3f86b8e78
commit 6812302ff9
2 changed files with 11 additions and 4 deletions

View File

@@ -68,9 +68,9 @@ class ExampleSmartMotorController : public frc::SpeedController {
*/
void ResetEncoder() {}
void Set(double speed) override {}
void Set(double speed) override { m_value = speed; }
double Get() const override { return 0; }
double Get() const override { return m_value; }
void SetInverted(bool isInverted) override {}
@@ -81,4 +81,7 @@ class ExampleSmartMotorController : public frc::SpeedController {
void StopMotor() override {}
void PIDWrite(double output) override {}
private:
double m_value = 0.0;
};