core / com.acmerobotics.roadrunner.tuning / RampRegression

RampRegression

class RampRegression (source)

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

Feedforward parameter estimates from the ramp regression and additional summary statistics

data class RampResult

Constructors

<init>

Container for ramp feedforward regression data.

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

Functions

add

Add a sample to the regression.

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

fit

Fit data from a "ramp" test.

fun fit(fitStatic: Boolean = false): RampResult

save

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

fun save(file: File): Unit