Package trclib.sensor

Interface TrcSensor.DataSource<D>

Type Parameters:
D - specifies the data type enum.
All Known Implementing Classes:
FtcI2cAdaFruitColorSensor, FtcMRI2cColorSensor, FtcMRI2cGyro, FtcMRI2cRangeSensor, FtcZXDistanceSensor
Enclosing class:
TrcSensor<D>

public static interface TrcSensor.DataSource<D>
This interface will be implemented by sensor classes that provide multiple data types. For example, a 3-axis gyro may provide "rotation rate" as well as "integrated heading" on each of its axes. Normally, sensor classes should extend this class and implement its abstract method which is the same thing. However, since Java supports only single inheritance and if the sensor class already extended another class, it cannot extend this class. In this case, it may just implement the DataSource interface instead.
  • Method Summary

    Modifier and Type
    Method
    Description
    getRawData(int index, D dataType)
    This method returns the selected raw sensor data.
  • Method Details

    • getRawData

      TrcSensor.SensorData<?> getRawData(int index, D dataType)
      This method returns the selected raw sensor data.
      Parameters:
      index - specifies the index if the sensor provides some sort of array data (e.g. the axis index of a 3-axis gyro).
      dataType - specifies the data type to return (e.g. rotation rate or heading of a gyro axis).
      Returns:
      selected sensor data.