diff --git a/buttonbox-lib/src/main/java/io/github/roboblazers7617/buttonbox/controls/TestControl.java b/buttonbox-lib/src/main/java/io/github/roboblazers7617/buttonbox/controls/TestControl.java index e81a728..601131d 100644 --- a/buttonbox-lib/src/main/java/io/github/roboblazers7617/buttonbox/controls/TestControl.java +++ b/buttonbox-lib/src/main/java/io/github/roboblazers7617/buttonbox/controls/TestControl.java @@ -7,6 +7,9 @@ import edu.wpi.first.networktables.DoubleSubscriber; import edu.wpi.first.networktables.NetworkTable; +import edu.wpi.first.hal.SimDevice; +import edu.wpi.first.hal.SimDouble; + /** * A test {@link io.github.roboblazers7617.buttonbox.Control} that outputs a float that is increased every time feedback is updated. */ @@ -16,6 +19,9 @@ public class TestControl extends Control { private DoubleSubscriber valueSub; private double value = 0; + private SimDevice simDevice; + private SimDouble valueSim; + /** * Creates a new TestControl. * @@ -27,6 +33,12 @@ public TestControl(String id) { super(id); } + @Override + public void setupSimulation() { + simDevice = SimDevice.create(getId()); + valueSim = simDevice.createDouble("Value", SimDevice.Direction.kOutput, value); + } + @Override public void setupNetworkTables(NetworkTable table) { valueTopic = table.getDoubleTopic("value"); @@ -38,6 +50,7 @@ public void setupNetworkTables(NetworkTable table) { public void updateServer() { value += 0.01; valuePub.set(value); + valueSim.set(value); } @Override