Package trclib.sensor

Class TrcAnalogSensor


public class TrcAnalogSensor extends TrcAnalogInput
This class implements a platform independent generic analog sensor. Anything that produces analog data can use this class to make itself an analog sensor that conforms to the TrcSensor class which can be used as an analog trigger. To make itself an analog sensor, it inherits from the AnalogInput class and thus must provide the getRawData abstract method required by TrcAnalogInput. In getRawData, it will call the AnalogDataSource provided in its constructor to get the raw data.
  • Field Details

  • Constructor Details

    • TrcAnalogSensor

      public TrcAnalogSensor(String instanceName, TrcAnalogSensor.AnalogDataSource dataSource)
      Constructor: Creates an instance of the object.
      Parameters:
      instanceName - specifies the instance name.
      dataSource - specifies the analog data provider.
  • Method Details

    • getRawData

      public TrcSensor.SensorData<Double> getRawData(int index, TrcAnalogInput.DataType dataType)
      This abstract method returns the raw data with the specified index and type.
      Specified by:
      getRawData in class TrcAnalogInput
      Parameters:
      index - specifies the data index (not used because AnalogSensor has only one axis).
      dataType - specifies the data type (not used because AnalogSensor only returns raw data).
      Returns:
      raw data from the analog data source.