mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
[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:
committed by
GitHub
parent
f3f86b8e78
commit
6812302ff9
@@ -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;
|
||||
};
|
||||
|
||||
@@ -18,6 +18,8 @@ public class ExampleSmartMotorController implements SpeedController {
|
||||
kMovementWitchcraft
|
||||
}
|
||||
|
||||
double m_value;
|
||||
|
||||
/**
|
||||
* Creates a new ExampleSmartMotorController.
|
||||
*
|
||||
@@ -73,11 +75,13 @@ public class ExampleSmartMotorController implements SpeedController {
|
||||
public void resetEncoder() {}
|
||||
|
||||
@Override
|
||||
public void set(double speed) {}
|
||||
public void set(double speed) {
|
||||
m_value = speed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double get() {
|
||||
return 0;
|
||||
return m_value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user