Class WsLidarSensor
java.lang.Object
org.wildstang.framework.io.inputs.Input
org.wildstang.framework.io.inputs.I2CInput
org.wildstang.hardware.roborio.inputs.WsI2CInput
org.wildstang.hardware.roborio.inputs.WsContinuousI2CInput
org.wildstang.hardware.roborio.inputs.WsLidarSensor
Reads a LIDAR sensor.
-
Field Summary
Fields inherited from class org.wildstang.hardware.roborio.inputs.WsContinuousI2CInput
currentValueFields inherited from class org.wildstang.hardware.roborio.inputs.WsI2CInput
i2c -
Constructor Summary
ConstructorsConstructorDescriptionWsLidarSensor(String name, edu.wpi.first.wpilibj.I2C.Port port, int p_address, int updateInterval) Construct the sensor. -
Method Summary
Modifier and TypeMethodDescriptionintReturns 0.intReturns a single integer value.intReturns the average of the last 5 readings.voidReads and calculates the distance.Methods inherited from class org.wildstang.hardware.roborio.inputs.WsContinuousI2CInput
readRawValue, start, stopMethods inherited from class org.wildstang.framework.io.inputs.I2CInput
getValue, readDataFromInput, setValueMethods inherited from class org.wildstang.framework.io.inputs.Input
addInputListener, disable, enable, getInputListeners, getName, hasValueChanged, isEnabled, notifyListeners, removeAllListeners, removeInputListener, setValueChanged, update
-
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:
getIntValuein classWsContinuousI2CInput- 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.
-