java.lang.Object
org.firstinspires.ftc.teamcode.subsystems.roadrunner.util.RegressionUtil

public class RegressionUtil extends Object
Various regression utilities.
  • Constructor Details

    • RegressionUtil

      public RegressionUtil()
  • Method Details

    • fitRampData

      public static RegressionUtil.RampResult fitRampData(List<Double> timeSamples, List<Double> positionSamples, List<Double> powerSamples, boolean fitStatic, @Nullable File file)
      Run regression to compute velocity and static feedforward from ramp test data.

      Here's the general procedure for gathering the requisite data: 1. Slowly ramp the motor power/voltage and record encoder values along the way. 2. Run a linear regression on the encoder velocity vs. motor power plot to obtain a slope (kV) and an optional intercept (kStatic).

      Parameters:
      timeSamples - time samples
      positionSamples - position samples
      powerSamples - power samples
      fitStatic - fit kStatic
      file - log file
    • fitAccelData

      public static RegressionUtil.AccelResult fitAccelData(List<Double> timeSamples, List<Double> positionSamples, List<Double> powerSamples, RegressionUtil.RampResult rampResult, @Nullable File file)
      Run regression to compute acceleration feedforward.
      Parameters:
      timeSamples - time samples
      positionSamples - position samples
      powerSamples - power samples
      rampResult - ramp result
      file - log file