Normalization constructor

const Normalization({
  1. bool autocompensates = true,
  2. Duration delay = const Duration(milliseconds: 1000),
  3. List<double> compensation = Compensation.none,
  4. List<double> scalar = const [1.0, 1.0, 1.0],
  5. Duration samplingRate = const Duration(milliseconds: 10),
  6. double sensitivity = 0.9,
})

A parameter class that primarily pertain to XLayers for customizing the intake of SensorEvent data.

  • autocompensates, a flag for toggling autocompensation after steady sensor samples for some time
  • delay, how long to wait before kicking in autocompensation, considering sensitivity to past samples in a buffer
  • compensation, an amount to shear from raw AccelerometerEvent data (x or y axis, as gyroscope is used for z data)
  • scalar, an amount to multiply by the calculated sensor parallax factor
  • samplingRate, how frequently sensor data samples are propagated
  • sensitivity, a double clamped between 0..1, that influences the maximum List length for a sensors data samples buffer.
    • A larger sensitivity and thus smaller samples buffer means new, strong outlier accelerometer data stands out more easily from the average of the past samples in the buffer

NOTE:

There is a fine balance between sensitivity and samplingRate. It is recommended to keep them default and modify delay as necessary.

Implementation

const Normalization({
  this.autocompensates = true,
  this.delay = const Duration(milliseconds: 1000),
  this.compensation = Compensation.none,
  this.scalar = const [1.0, 1.0, 1.0],
  this.samplingRate = const Duration(milliseconds: 10),
  this.sensitivity = 0.9,
}) : assert(sensitivity >= 0 && sensitivity <= 1);