Skip to Content
VectorLib

ExpoDriveCurve

vectorlib::ExpoDriveCurve — fields, methods, parameters and return types.


pub struct ExpoDriveCurve

LemLib's exponential drive curve. See <https://www.desmos.com/calculator/umicbymbnl>.


// deadband 3, minimum output 10, expo gain 1.019 — LemLib's example settings
let mut throttle = ExpoDriveCurve::new(3.0, 10.0, 1.019);
assert_eq!(throttle.curve(2.0), 0.0); // inside the deadband
assert!((throttle.curve(127.0) - 127.0).abs() < 1e-4);

View source

Methods

Prop

Type

new

pub const fn new(deadband: f32, min_output: f32, curve: f32) -> Self

Construct a new expo drive curve.

  • deadband — range where input is considered to be 0
  • min_output — the minimum output that can be returned (outside the deadband)
  • curve — how "curved" the graph is

Parameters

Prop

Type

Returns

Self

View source

On this page