libstp
Robotics library for Botball
Loading...
Searching...
No Matches
libstp::drive::VelocityController Class Reference

#include <velocity_controller.hpp>

Public Member Functions

 VelocityController (foundation::PidGains g, foundation::Feedforward ff)
void setGains (const foundation::PidGains &g)
void setFF (const foundation::Feedforward &ff)
const foundation::PidGains & gains () const
const foundation::Feedforward & ff () const
double compute (double w_ref, double a_ref, double w_meas, double dt, double u_max, bool *out_saturated=nullptr)
void reset ()

Detailed Description

PID plus feedforward helper used for chassis velocity control.

The controller uses measured-derivative filtering and a simple back-calculation style anti-windup term when clamping is active.

Definition at line 16 of file velocity_controller.hpp.

Constructor & Destructor Documentation

◆ VelocityController()

libstp::drive::VelocityController::VelocityController ( foundation::PidGains g,
foundation::Feedforward ff )

Construct a controller with the supplied PID and feedforward terms.

Member Function Documentation

◆ compute()

double libstp::drive::VelocityController::compute ( double w_ref,
double a_ref,
double w_meas,
double dt,
double u_max,
bool * out_saturated = nullptr )

Compute the next controller output.

Parameters
w_refReference velocity.
a_refReference acceleration for the feedforward term.
w_measMeasured velocity.
dtSample time in seconds.
u_maxSymmetric output clamp magnitude.
out_saturatedOptional flag set when clamping occurs.

◆ ff()

const foundation::Feedforward & libstp::drive::VelocityController::ff ( ) const
inline

Definition at line 29 of file velocity_controller.hpp.

◆ gains()

const foundation::PidGains & libstp::drive::VelocityController::gains ( ) const
inline

Definition at line 28 of file velocity_controller.hpp.

◆ reset()

void libstp::drive::VelocityController::reset ( )

Clear integrator, derivative filter, and measurement history.

◆ setFF()

void libstp::drive::VelocityController::setFF ( const foundation::Feedforward & ff)

Replace the feedforward terms used by subsequent compute() calls.

◆ setGains()

void libstp::drive::VelocityController::setGains ( const foundation::PidGains & g)

Replace the PID gains used by subsequent compute() calls.


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