WPILibC++ 2024.3.2
frc::DifferentialDriveVoltageConstraint Class Reference

A class that enforces constraints on differential drive voltage expenditure based on the motor dynamics and the drive kinematics. More...

#include <frc/trajectory/constraint/DifferentialDriveVoltageConstraint.h>

Inheritance diagram for frc::DifferentialDriveVoltageConstraint:
frc::TrajectoryConstraint

Public Member Functions

 DifferentialDriveVoltageConstraint (const SimpleMotorFeedforward< units::meter > &feedforward, DifferentialDriveKinematics kinematics, units::volt_t maxVoltage)
 Creates a new DifferentialDriveVoltageConstraint. More...
 
units::meters_per_second_t MaxVelocity (const Pose2d &pose, units::curvature_t curvature, units::meters_per_second_t velocity) const override
 Returns the max velocity given the current pose and curvature. More...
 
MinMax MinMaxAcceleration (const Pose2d &pose, units::curvature_t curvature, units::meters_per_second_t speed) const override
 Returns the minimum and maximum allowable acceleration for the trajectory given pose, curvature, and speed. More...
 
- Public Member Functions inherited from frc::TrajectoryConstraint
 TrajectoryConstraint ()=default
 
 TrajectoryConstraint (const TrajectoryConstraint &)=default
 
TrajectoryConstraintoperator= (const TrajectoryConstraint &)=default
 
 TrajectoryConstraint (TrajectoryConstraint &&)=default
 
TrajectoryConstraintoperator= (TrajectoryConstraint &&)=default
 
virtual ~TrajectoryConstraint ()=default
 
virtual units::meters_per_second_t MaxVelocity (const Pose2d &pose, units::curvature_t curvature, units::meters_per_second_t velocity) const =0
 Returns the max velocity given the current pose and curvature. More...
 
virtual MinMax MinMaxAcceleration (const Pose2d &pose, units::curvature_t curvature, units::meters_per_second_t speed) const =0
 Returns the minimum and maximum allowable acceleration for the trajectory given pose, curvature, and speed. More...
 

Detailed Description

A class that enforces constraints on differential drive voltage expenditure based on the motor dynamics and the drive kinematics.

Ensures that the acceleration of any wheel of the robot while following the trajectory is never higher than what can be achieved with the given maximum voltage.

Constructor & Destructor Documentation

◆ DifferentialDriveVoltageConstraint()

frc::DifferentialDriveVoltageConstraint::DifferentialDriveVoltageConstraint ( const SimpleMotorFeedforward< units::meter > &  feedforward,
DifferentialDriveKinematics  kinematics,
units::volt_t  maxVoltage 
)

Creates a new DifferentialDriveVoltageConstraint.

Parameters
feedforwardA feedforward component describing the behavior of the drive.
kinematicsA kinematics component describing the drive geometry.
maxVoltageThe maximum voltage available to the motors while following the path. Should be somewhat less than the nominal battery voltage (12V) to account for "voltage sag" due to current draw.

Member Function Documentation

◆ MaxVelocity()

units::meters_per_second_t frc::DifferentialDriveVoltageConstraint::MaxVelocity ( const Pose2d pose,
units::curvature_t  curvature,
units::meters_per_second_t  velocity 
) const
overridevirtual

Returns the max velocity given the current pose and curvature.

Parameters
poseThe pose at the current point in the trajectory.
curvatureThe curvature at the current point in the trajectory.
velocityThe velocity at the current point in the trajectory before constraints are applied.
Returns
The absolute maximum velocity.

Implements frc::TrajectoryConstraint.

◆ MinMaxAcceleration()

MinMax frc::DifferentialDriveVoltageConstraint::MinMaxAcceleration ( const Pose2d pose,
units::curvature_t  curvature,
units::meters_per_second_t  speed 
) const
overridevirtual

Returns the minimum and maximum allowable acceleration for the trajectory given pose, curvature, and speed.

Parameters
poseThe pose at the current point in the trajectory.
curvatureThe curvature at the current point in the trajectory.
speedThe speed at the current point in the trajectory.
Returns
The min and max acceleration bounds.

Implements frc::TrajectoryConstraint.


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