Package frclib.sensor

Class FrcAnalogSensor

java.lang.Object
edu.wpi.first.wpilibj.AnalogInput
frclib.sensor.FrcAnalogSensor
All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable, AutoCloseable

public class FrcAnalogSensor extends edu.wpi.first.wpilibj.AnalogInput
This class implements an analog sensor that provides method to read the sensor and scale to proper unit.
  • Constructor Summary

    Constructors
    Constructor
    Description
    FrcAnalogSensor(String instanceName, int analogChannel, double sensorScale, double sensorBias)
    Constructor: Create an instance of the object.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    This method reads the sensor value and converts it to the scaled unit.
    This method returns the instance name.

    Methods inherited from class edu.wpi.first.wpilibj.AnalogInput

    close, getAccumulatorCount, getAccumulatorOutput, getAccumulatorValue, getAverageBits, getAverageValue, getAverageVoltage, getChannel, getGlobalSampleRate, getLSBWeight, getOffset, getOversampleBits, getValue, getVoltage, initAccumulator, initSendable, isAccumulatorChannel, resetAccumulator, setAccumulatorCenter, setAccumulatorDeadband, setAccumulatorInitialValue, setAverageBits, setGlobalSampleRate, setOversampleBits, setSimDevice

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • FrcAnalogSensor

      public FrcAnalogSensor(String instanceName, int analogChannel, double sensorScale, double sensorBias)
      Constructor: Create an instance of the object.
      Parameters:
      instanceName - specifies the instance name.
      analogChannel - specifies the analog channel the pressure sensor is on.
      sensorScale - specifies the scale factor to convert voltage into proper unit.
      sensorBias - specifies the sensor voltage bias.
  • Method Details

    • toString

      public String toString()
      This method returns the instance name.
      Overrides:
      toString in class Object
      Returns:
      instance name.
    • getScaledValue

      public double getScaledValue()
      This method reads the sensor value and converts it to the scaled unit.
      Returns:
      scaled sensor value.