WPILibC++ 2024.3.2
frc::DifferentialDriveAccelerationLimiter Class Reference

Filters the provided voltages to limit a differential drive's linear and angular acceleration. More...

#include <frc/controller/DifferentialDriveAccelerationLimiter.h>

Public Member Functions

 DifferentialDriveAccelerationLimiter (LinearSystem< 2, 2, 2 > system, units::meter_t trackwidth, units::meters_per_second_squared_t maxLinearAccel, units::radians_per_second_squared_t maxAngularAccel)
 Constructs a DifferentialDriveAccelerationLimiter. More...
 
 DifferentialDriveAccelerationLimiter (LinearSystem< 2, 2, 2 > system, units::meter_t trackwidth, units::meters_per_second_squared_t minLinearAccel, units::meters_per_second_squared_t maxLinearAccel, units::radians_per_second_squared_t maxAngularAccel)
 Constructs a DifferentialDriveAccelerationLimiter. More...
 
DifferentialDriveWheelVoltages Calculate (units::meters_per_second_t leftVelocity, units::meters_per_second_t rightVelocity, units::volt_t leftVoltage, units::volt_t rightVoltage)
 Returns the next voltage pair subject to acceleraiton constraints. More...
 

Detailed Description

Filters the provided voltages to limit a differential drive's linear and angular acceleration.

The differential drive model can be created via the functions in LinearSystemId.

Constructor & Destructor Documentation

◆ DifferentialDriveAccelerationLimiter() [1/2]

frc::DifferentialDriveAccelerationLimiter::DifferentialDriveAccelerationLimiter ( LinearSystem< 2, 2, 2 >  system,
units::meter_t  trackwidth,
units::meters_per_second_squared_t  maxLinearAccel,
units::radians_per_second_squared_t  maxAngularAccel 
)

Constructs a DifferentialDriveAccelerationLimiter.

Parameters
systemThe differential drive dynamics.
trackwidthThe distance between the differential drive's left and right wheels.
maxLinearAccelThe maximum linear acceleration.
maxAngularAccelThe maximum angular acceleration.

◆ DifferentialDriveAccelerationLimiter() [2/2]

frc::DifferentialDriveAccelerationLimiter::DifferentialDriveAccelerationLimiter ( LinearSystem< 2, 2, 2 >  system,
units::meter_t  trackwidth,
units::meters_per_second_squared_t  minLinearAccel,
units::meters_per_second_squared_t  maxLinearAccel,
units::radians_per_second_squared_t  maxAngularAccel 
)

Constructs a DifferentialDriveAccelerationLimiter.

Parameters
systemThe differential drive dynamics.
trackwidthThe distance between the differential drive's left and right wheels.
minLinearAccelThe minimum (most negative) linear acceleration.
maxLinearAccelThe maximum (most positive) linear acceleration.
maxAngularAccelThe maximum angular acceleration.
Exceptions
std::invalid_argumentif minimum linear acceleration is greater than maximum linear acceleration

Member Function Documentation

◆ Calculate()

DifferentialDriveWheelVoltages frc::DifferentialDriveAccelerationLimiter::Calculate ( units::meters_per_second_t  leftVelocity,
units::meters_per_second_t  rightVelocity,
units::volt_t  leftVoltage,
units::volt_t  rightVoltage 
)

Returns the next voltage pair subject to acceleraiton constraints.

Parameters
leftVelocityThe left wheel velocity.
rightVelocityThe right wheel velocity.
leftVoltageThe unconstrained left motor voltage.
rightVoltageThe unconstrained right motor voltage.
Returns
The constrained wheel voltages.

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