libstp
Robotics library for Botball
Loading...
Searching...
No Matches
libstp::motion::ProfiledPIDController Class Reference

#include <profiled_pid_controller.hpp>

Classes

struct  Config

Public Types

using State = TrapezoidalProfile::State
using Constraints = TrapezoidalProfile::Constraints

Public Member Functions

 ProfiledPIDController (Config config, Constraints profile_constraints)
void setGoal (double position)
void setGoal (State goal)
State getGoal () const
State getSetpoint () const
const Constraints & getConstraints () const
void setConstraints (Constraints constraints)
void enableContinuousInput (double min_input, double max_input)
void disableContinuousInput ()
void reset (double position, double velocity=0.0)
void reset (State state)
double calculate (double measurement, double dt)
bool profileComplete () const

Detailed Description

PID controller whose setpoint is constrained by a trapezoidal motion profile.

Each update cycle:

  1. The profile advances the setpoint toward the goal
  2. PID computes tracking error (setpoint - measurement)
  3. Output = velocity_ff * setpoint.velocity + PID(tracking_error)

Definition at line 20 of file profiled_pid_controller.hpp.

Member Typedef Documentation

◆ Constraints

◆ State

Constructor & Destructor Documentation

◆ ProfiledPIDController()

libstp::motion::ProfiledPIDController::ProfiledPIDController ( Config config,
Constraints profile_constraints )
inline

Definition at line 32 of file profiled_pid_controller.hpp.

Member Function Documentation

◆ calculate()

double libstp::motion::ProfiledPIDController::calculate ( double measurement,
double dt )
inline

Compute the next control output.

Parameters
measurementCurrent measured position
dtTime step (seconds)
Returns
Velocity command = velocity_ff * setpoint.velocity + PID(tracking_error)

Definition at line 71 of file profiled_pid_controller.hpp.

◆ disableContinuousInput()

void libstp::motion::ProfiledPIDController::disableContinuousInput ( )
inline

Definition at line 54 of file profiled_pid_controller.hpp.

◆ enableContinuousInput()

void libstp::motion::ProfiledPIDController::enableContinuousInput ( double min_input,
double max_input )
inline

Definition at line 47 of file profiled_pid_controller.hpp.

◆ getConstraints()

const Constraints & libstp::motion::ProfiledPIDController::getConstraints ( ) const
inlinenodiscard

Definition at line 43 of file profiled_pid_controller.hpp.

◆ getGoal()

State libstp::motion::ProfiledPIDController::getGoal ( ) const
inlinenodiscard

Definition at line 41 of file profiled_pid_controller.hpp.

◆ getSetpoint()

State libstp::motion::ProfiledPIDController::getSetpoint ( ) const
inlinenodiscard

Definition at line 42 of file profiled_pid_controller.hpp.

◆ profileComplete()

bool libstp::motion::ProfiledPIDController::profileComplete ( ) const
inlinenodiscard

Check if the profile's setpoint has reached the goal.

Definition at line 110 of file profiled_pid_controller.hpp.

◆ reset() [1/2]

void libstp::motion::ProfiledPIDController::reset ( double position,
double velocity = 0.0 )
inline

Definition at line 56 of file profiled_pid_controller.hpp.

◆ reset() [2/2]

void libstp::motion::ProfiledPIDController::reset ( State state)
inline

Definition at line 62 of file profiled_pid_controller.hpp.

◆ setConstraints()

void libstp::motion::ProfiledPIDController::setConstraints ( Constraints constraints)
inline

Definition at line 45 of file profiled_pid_controller.hpp.

◆ setGoal() [1/2]

void libstp::motion::ProfiledPIDController::setGoal ( double position)
inline

Definition at line 39 of file profiled_pid_controller.hpp.

◆ setGoal() [2/2]

void libstp::motion::ProfiledPIDController::setGoal ( State goal)
inline

Definition at line 40 of file profiled_pid_controller.hpp.


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