Class RegressionUtil
java.lang.Object
org.firstinspires.ftc.teamcode.subsystems.roadrunner.util.RegressionUtil
Various regression utilities.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Feedforward parameter estimates from the ramp regression and additional summary statisticsstatic class
Feedforward parameter estimates from the ramp regression and additional summary statistics -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic RegressionUtil.AccelResult
fitAccelData
(List<Double> timeSamples, List<Double> positionSamples, List<Double> powerSamples, RegressionUtil.RampResult rampResult, File file) Run regression to compute acceleration feedforward.static RegressionUtil.RampResult
fitRampData
(List<Double> timeSamples, List<Double> positionSamples, List<Double> powerSamples, boolean fitStatic, File file) Run regression to compute velocity and static feedforward from ramp test data.
-
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 samplespositionSamples
- position samplespowerSamples
- power samplesfitStatic
- fit kStaticfile
- 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 samplespositionSamples
- position samplespowerSamples
- power samplesrampResult
- ramp resultfile
- log file
-