core / com.acmerobotics.roadrunner.tuning / RampRegression

RampRegression

class RampRegression

Container for ramp feedforward regression 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 (scaled voltage) samples

Types

RampResult

data class RampResult

Feedforward parameter estimates from the ramp regression and additional summary statistics

Constructors

<init>

RampRegression(timeSamples: MutableList<Double> = mutableListOf(), positionSamples: MutableList<Double> = mutableListOf(), powerSamples: MutableList<Double> = mutableListOf())

Container for ramp feedforward regression data.

Functions

add

fun add(time: Double, position: Double, power: Double): Unit

Add a sample to the regression.

fit

fun fit(fitStatic: Boolean = false): RampRegression.RampResult

Fit data from a "ramp" test.

save

fun save(file: File): Unit

Save the data to a CSV file for debugging or additional analysis.