HoloLib
High-performance holonomic (X-Drive) control library for VEX V5
Loading...
Searching...
No Matches
GainScheduler Class Reference

A scheduler that interpolates and selects PID gains based on the current error. More...

#include <gain_scheduler.h>

Public Member Functions

void addStep (float threshold, float kP, float kI, float kD, float slew=0.0f)
 Add a scheduling step.
 
PIDGains getGains (float error) const
 Compute the correct gains based on the current error distance.
 
void clear ()
 Clears the current schedules.
 

Detailed Description

A scheduler that interpolates and selects PID gains based on the current error.

Definition at line 19 of file gain_scheduler.h.

Member Function Documentation

◆ addStep()

void GainScheduler::addStep ( float  threshold,
float  kP,
float  kI,
float  kD,
float  slew = 0.0f 
)

Add a scheduling step.

Parameters
thresholdMax error for this step.
kPProportional gain.
kIIntegral gain.
kDDerivative gain.
slewSlew rate.

◆ getGains()

PIDGains GainScheduler::getGains ( float  error) const

Compute the correct gains based on the current error distance.

Parameters
errorThe current positional or rotational error.
Returns
PIDGains Interpolated gains for this specific error level.

◆ clear()

void GainScheduler::clear ( )

Clears the current schedules.