Valkyrie 2026
Loading...
Searching...
No Matches
valor::swerve::requests::ApplyStates Struct Reference

Request structure for commanding a swerve drivetrain using explicit module states. More...

#include <valkyrie/drivetrain/swerve/Requests.h>

Public Attributes

std::vector< frc::SwerveModuleState > states
 Desired states for each swerve module.
std::vector< BaseController::Output > feedforwards = {}
 Optional feedforward outputs for each swerve module.
BaseController::Output zeroOutput = 0
 Default output value used when no feedforward is provided.
OutputType outputType = OutputType::Velocity
 Output control mode used when applying drive requests.
bool optimizeModules = true
 Whether to optimize module states.
bool cosineScaling = true
bool desaturateWheelSpeeds = true
 Whether to desaturate wheel speeds.
units::meters_per_second_t deadband = 0_mps
 Minimum wheel speed required before motion is applied.

Detailed Description

Request structure for commanding a swerve drivetrain using explicit module states.

Contains desired swerve module states, optional feedforward outputs, and configuration flags controlling module optimization and speed limiting.

Member Data Documentation

◆ cosineScaling

bool valor::swerve::requests::ApplyStates::cosineScaling = true

@breif Whether to utilize cosine scaling for the module states

Cosine Scaling scales the magnitude of the drive motor to the cosine of the difference in angle between the azimuths target and current state.

◆ deadband

units::meters_per_second_t valor::swerve::requests::ApplyStates::deadband = 0_mps

Minimum wheel speed required before motion is applied.

Speeds below this threshold are treated as zero to prevent unintended module movement or jitter.

◆ desaturateWheelSpeeds

bool valor::swerve::requests::ApplyStates::desaturateWheelSpeeds = true

Whether to desaturate wheel speeds.

If enabled, wheel speeds are scaled proportionally to ensure no module exceeds the drivetrain's maximum achievable speed.

◆ feedforwards

std::vector<BaseController::Output> valor::swerve::requests::ApplyStates::feedforwards = {}

Optional feedforward outputs for each swerve module.

Used to apply additional controller output alongside the desired module states.

◆ optimizeModules

bool valor::swerve::requests::ApplyStates::optimizeModules = true

Whether to optimize module states.

Optimization minimizes unnecessary module rotation by potentially reversing wheel direction.

◆ outputType

OutputType valor::swerve::requests::ApplyStates::outputType = OutputType::Velocity

Output control mode used when applying drive requests.

Determines how wheel speed commands are interpreted by the drive motor controllers, such as closed-loop velocity, direct voltage, or normalized duty cycle control.

◆ states

std::vector<frc::SwerveModuleState> valor::swerve::requests::ApplyStates::states

Desired states for each swerve module.

Each state contains the target wheel speed and steering angle.


The documentation for this struct was generated from the following file:
  • src/main/include/valkyrie/drivetrain/swerve/Requests.h