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
-
public class WsLidarSensor extends WsContinuousI2CInput
Reads a LIDAR sensor.
-
-
Field Summary
-
Fields inherited from class org.wildstang.hardware.roborio.inputs.WsContinuousI2CInput
currentValue
-
Fields inherited from class org.wildstang.hardware.roborio.inputs.WsI2CInput
i2c
-
-
Constructor Summary
Constructors Constructor Description WsLidarSensor(java.lang.String name, edu.wpi.first.wpilibj.I2C.Port port, int p_address, int updateInterval)
Construct the sensor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getDistance()
Returns 0.int
getIntValue()
Returns a single integer value.int
getSmoothedDistance()
Returns the average of the last 5 readings.void
updateSensor()
Reads and calculates the distance.-
Methods inherited from class org.wildstang.hardware.roborio.inputs.WsContinuousI2CInput
readRawValue, start, stop
-
Methods inherited from class org.wildstang.framework.io.inputs.I2CInput
getValue, readDataFromInput, setValue
-
Methods inherited from class org.wildstang.framework.io.inputs.Input
addInputListener, disable, enable, getInputListeners, getName, hasValueChanged, isEnabled, notifyListeners, removeAllListeners, removeInputListener, setValueChanged, update
-
-
-
-
Constructor Detail
-
WsLidarSensor
public WsLidarSensor(java.lang.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 Detail
-
getIntValue
public int getIntValue()
Returns a single integer value.- Overrides:
getIntValue
in 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.
-
-