Sensors
YAMS Supports simulation really well, but my sensors don't.
What is a Sensor?
Sensor?How do I create a Sensor?
Sensor?private DigitalInput dio = new DigitalInput(0); // Standard DIO
private final Sensor coralSensor = new SensorConfig("CoralDetectorBeamBreak") // Name of the sensor
.withField("Beam", dio::get, false) // Add a Field to the sensor named "Beam" whose value is dio.get() and defaults to false
.withSimulatedValue("Beam", Seconds.of(3), Seconds.of(4), true) // Change the "Beam" field to true between 3s and 4s into a match
.withSimulatedValue("Beam",()->arm.isNear(Degrees.of(40), Degrees.of(2)), true) // Change "Beam" field to true when the arm is near 40deg +- 2deg
.getSensor(); // Get the sensor.How do I add simulated values to a sensor?
What does this look like?

How do I use the value from a Sensor?
Sensor?How do I simulate the sensor value?
Last updated