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.WsContinuousI2CInputcurrentValue
 - 
Fields inherited from class org.wildstang.hardware.roborio.inputs.WsI2CInputi2c
 
- 
 - 
Constructor SummaryConstructors Constructor Description WsLidarSensor(java.lang.String name, edu.wpi.first.wpilibj.I2C.Port port, int p_address, int updateInterval)Construct the sensor.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetDistance()Returns 0.intgetIntValue()Returns a single integer value.intgetSmoothedDistance()Returns the average of the last 5 readings.voidupdateSensor()Reads and calculates the distance.- 
Methods inherited from class org.wildstang.hardware.roborio.inputs.WsContinuousI2CInputreadRawValue, start, stop
 - 
Methods inherited from class org.wildstang.framework.io.inputs.I2CInputgetValue, readDataFromInput, setValue
 - 
Methods inherited from class org.wildstang.framework.io.inputs.InputaddInputListener, disable, enable, getInputListeners, getName, hasValueChanged, isEnabled, notifyListeners, removeAllListeners, removeInputListener, setValueChanged, update
 
- 
 
- 
- 
- 
Constructor Detail- 
WsLidarSensorpublic 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- 
getIntValuepublic int getIntValue() Returns a single integer value.- Overrides:
- getIntValuein class- WsContinuousI2CInput
- Returns:
- Int representation of latest sensor reading.
 
 - 
getDistancepublic int getDistance() Returns 0.- Returns:
- 0.
 
 - 
getSmoothedDistancepublic int getSmoothedDistance() Returns the average of the last 5 readings.- Returns:
- The rolling (5) average of the read distance.
 
 - 
updateSensorpublic void updateSensor() Reads and calculates the distance.
 
- 
 
-