RIT VEXU Core API
Loading...
Searching...
No Matches
FeedForward Class Reference

#include <feedforward.h>

Classes

struct  ff_config_t
 

Public Member Functions

 FeedForward (ff_config_t &cfg)
 
double calculate (double v, double a, double pid_ref=0.0)
 Perform the feedforward calculation.
 

Detailed Description

FeedForward

Stores the feedfoward constants, and allows for quick computation. Feedfoward should be used in systems that require smooth precise movements and have high inertia, such as drivetrains and lifts.

This is best used alongside a PID loop, with the form: output = pid.get() + feedforward.calculate(v, a);

In this case, the feedforward does the majority of the heavy lifting, and the pid loop only corrects for inconsistencies

For information about tuning feedforward, I reccommend looking at this post: https://www.chiefdelphi.com/t/paper-frc-drivetrain-characterization/160915 (yes I know it's for FRC but trust me, it's useful)

Author
Ryan McGee
Date
6/13/2022

Constructor & Destructor Documentation

◆ FeedForward()

FeedForward::FeedForward ( ff_config_t & cfg)
inline

Creates a FeedForward object.

Parameters
cfgConfiguration Struct for tuning

Member Function Documentation

◆ calculate()

double FeedForward::calculate ( double v,
double a,
double pid_ref = 0.0 )
inline

Perform the feedforward calculation.

This calculation is the equation: F = kG + kS*sgn(v) + kV*v + kA*a

Parameters
vRequested velocity of system
aRequested acceleration of system
Returns
A feedforward that should closely represent the system if tuned correctly

The documentation for this class was generated from the following file: