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

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

#include <GainScheduler.hpp>

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.
 
void setGains (std::vector< ScheduledGain > newSchedules)
 

Detailed Description

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

Definition at line 19 of file GainScheduler.hpp.

Member Function Documentation

◆ addStep()

void hololib::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 hololib::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 hololib::GainScheduler::clear ( )

Clears the current schedules.

◆ setGains()

void hololib::GainScheduler::setGains ( std::vector< ScheduledGain newSchedules)