Package com.studica.frc

## Class Lidar

- java.lang.Object
- - com.studica.frc.Lidar

    public class Lidar
    extends java.lang.Object

Lidar class Java documentation

### Nested Class Summary

Nested Classes
`static class` `Lidar.Filter` kCLUSTER - Cluster Filter
`static class` `Lidar.Port` kUSB1 - Top USB2.0 port
`static class` `Lidar.ScanData` Class to receive Lidar data.

### Constructor Summary

Constructors
`Lidar​(Lidar.Port port)` Constructor for Lidar

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `clusterConfig​(float distanceThreshold, int minClusterSize)` Configure the Cluster Filter
`void` `enableFilter​(Lidar.Filter filter, boolean enable)` Enables the cluster filter on distance in ScanData
`Lidar.ScanData` `getData()` Gets angle and distance output of Lidar sensor
`void` `jitterConfig​(float jitterThreshold)` Configure the jitter filter
`void` `kalmanConfig​(float q, float r, float p)` Configure the Kalman Filter
`void` `medianConfig​(int windowSize)` Configure the median filter
`void` `movingAverageConfig​(int windowSize)` Configure the moving average Filter
`void` `start()` Starts the Lidar sensor The constructor by default starts the Lidar sensor
`void` `stop()` Stops the Lidar sensor

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### Lidar

    public Lidar​(Lidar.Port port)

Constructor for Lidar

Parameters:
  `port` - - Location of USB2.0 port

### Method Detail

#### start

    public void start()

Starts the Lidar sensor The constructor by default starts the Lidar sensor

#### stop

    public void stop()

Stops the Lidar sensor

#### getData

    public Lidar.ScanData getData()

Gets angle and distance output of Lidar sensor

Returns:
  Data struct that holds angle and distance

#### enableFilter

    public void enableFilter​(Lidar.Filter filter,
                             boolean enable)

Enables the cluster filter on distance in ScanData

Parameters:
  `filter` - filter to enable, 0 = cluster, 1 = kalman
  `enable` - flag to enable or disable filter

#### clusterConfig

    public void clusterConfig​(float distanceThreshold,
                              int minClusterSize)

Configure the Cluster Filter

Parameters:
  `distanceThreshold` - The threshold of the distances in the cluster in mm
  `minClusterSize` - the minimum number of elements in the cluster

  defaults: 50.0mm, 5

#### kalmanConfig

    public void kalmanConfig​(float q,
                             float r,
                             float p)

Configure the Kalman Filter

Parameters:
  `q` - - Process Noise
  `r` - - Measurement Noise
  `p` - - Initial Estimate Error

  defaults: 1e-5, 1e-1, 1.0

#### movingAverageConfig

    public void movingAverageConfig​(int windowSize)

Configure the moving average Filter

Parameters:
  `windowSize` - range 1 - 10

  Default = 5

#### medianConfig

    public void medianConfig​(int windowSize)

Configure the median filter

Parameters:
  `windowSize` - range 1 - 10

  Default = 5

#### jitterConfig

    public void jitterConfig​(float jitterThreshold)

Configure the jitter filter

Parameters:
  `jitterThreshold` - - threshold in mm to test for jitter

  Default = 50mm