Class SensorConfig

java.lang.Object
yams.mechanisms.config.SensorConfig

public class SensorConfig extends Object
Sensor configuration for simulated and real sensors.
  • Constructor Details

    • SensorConfig

      public SensorConfig(String name)
      Sensor configuration.
      Parameters:
      name - Name of sensor to display in the simulation window.
  • Method Details

    • withField

      public SensorConfig withField(String name, DoubleSupplier supplier, double defaultVal)
      Add a field to the sensor.
      Parameters:
      name - Name of the field to add.
      supplier - Supplier of the real field value.
      defaultVal - Default value of the field.
      Returns:
      SensorConfig
    • withField

      public SensorConfig withField(String name, IntSupplier supplier, int defaultVal)
      Add a field to the sensor.
      Parameters:
      name - Name of the field to add.
      supplier - Supplier of the real field value.
      defaultVal - Default value of the field.
      Returns:
      SensorConfig
    • withField

      public SensorConfig withField(String name, BooleanSupplier supplier, boolean defaultVal)
      Add a field to the sensor.
      Parameters:
      name - Name of the field to add.
      supplier - Supplier of the real field value.
      defaultVal - Default value of the field.
      Returns:
      SensorConfig
    • withField

      public SensorConfig withField(String name, LongSupplier supplier, long defaultVal)
      Add a field to the sensor.
      Parameters:
      name - Name of the field to add.
      supplier - Supplier of the real field value.
      defaultVal - Default value of the field.
      Returns:
      SensorConfig
    • withSimulatedValue

      public SensorConfig withSimulatedValue(String fieldName, Time start, Time end, double value)
      Add a simulated value to the sensor at a given match time.
      Parameters:
      fieldName - Name of the field to change.
      start - Time at which to start the data simulation.
      end - Time at which to end the data simulation.
      value - Value to simulate.
      Returns:
      SensorConfig
    • withSimulatedValue

      public SensorConfig withSimulatedValue(String fieldName, Time start, Time end, int value)
      Add a simulated value to the sensor at a given match time.
      Parameters:
      fieldName - Name of the field to change.
      start - Time at which to start the data simulation.
      end - Time at which to end the data simulation.
      value - Value to simulate.
      Returns:
      SensorConfig
    • withSimulatedValue

      public SensorConfig withSimulatedValue(String fieldName, Time start, Time end, long value)
      Add a simulated value to the sensor at a given match time.
      Parameters:
      fieldName - Name of the field to change.
      start - Time at which to start the data simulation.
      end - Time at which to end the data simulation.
      value - Value to simulate.
      Returns:
      SensorConfig
    • withSimulatedValue

      public SensorConfig withSimulatedValue(String fieldName, Time start, Time end, boolean value)
      Add a simulated value to the sensor at a given match time.
      Parameters:
      fieldName - Name of the field to change.
      start - Time at which to start the data simulation.
      end - Time at which to end the data simulation.
      value - Value to simulate.
      Returns:
      SensorConfig
    • withSimulatedValue

      public SensorConfig withSimulatedValue(String fieldName, BooleanSupplier trigger, double value)
      Add a simulated value to the sensor at a given trigger.
      Parameters:
      fieldName - Name of the field to change.
      trigger - BooleanSupplier for when data should be simulated.
      value - Value to simulate.
      Returns:
      SensorConfig
    • withSimulatedValue

      public SensorConfig withSimulatedValue(String fieldName, BooleanSupplier trigger, int value)
      Add a simulated value to the sensor at a given trigger.
      Parameters:
      fieldName - Name of the field to change.
      trigger - BooleanSupplier for when data should be simulated.
      value - Value to simulate.
      Returns:
      SensorConfig
    • withSimulatedValue

      public SensorConfig withSimulatedValue(String fieldName, BooleanSupplier trigger, long value)
      Add a simulated value to the sensor at a given trigger.
      Parameters:
      fieldName - Name of the field to change.
      trigger - BooleanSupplier for when data should be simulated.
      value - Value to simulate.
      Returns:
      SensorConfig
    • withSimulatedValue

      public SensorConfig withSimulatedValue(String fieldName, BooleanSupplier trigger, boolean value)
      Add a simulated value to the sensor at a given trigger.
      Parameters:
      fieldName - Name of the field to change.
      trigger - BooleanSupplier for when data should be simulated.
      value - Value to simulate.
      Returns:
      SensorConfig
    • getSensor

      public Sensor getSensor()
      Get the Sensor for this sensor.
      Returns:
      Sensor for fetching real and simulated values.
    • getName

      public String getName()
      Get the name of the sensor.
      Returns:
      Name of the sensor.
    • getFields

      public List<SensorData> getFields()
      Get the list of Fields (SensorData) for this sensor.
      Returns:
      list of SensorData for this sensor