Class WsLidarSensor


public class WsLidarSensor extends WsContinuousI2CInput
Reads a LIDAR sensor.
  • Constructor Details

    • WsLidarSensor

      public WsLidarSensor(String name, edu.wpi.first.wpilibj.I2C.Port port, int p_address, int updateInterval)
      Construct the sensor.
      Parameters:
      name - Descriptive name of the axis.
      port - I2C port the sensor is connected to.
      p_address - I2C address of the sensor.
      updateInterval - Interval at which to fetch a value from the sensor.
  • Method Details

    • getIntValue

      public int getIntValue()
      Returns a single integer value.
      Overrides:
      getIntValue in class WsContinuousI2CInput
      Returns:
      Int representation of latest sensor reading.
    • getDistance

      public int getDistance()
      Returns 0.
      Returns:
      0.
    • getSmoothedDistance

      public int getSmoothedDistance()
      Returns the average of the last 5 readings.
      Returns:
      The rolling (5) average of the read distance.
    • updateSensor

      public void updateSensor()
      Reads and calculates the distance.