2023-Robot
Robot code for 2023 FRC season by Argos, FRC team #1756
Loading...
Searching...
No Matches
argos_lib::swerve Namespace Reference

Classes

class  NetworkTablesHomingStorage
 Saves and loads swerve module homes to networkTables. More...
 
struct  SwerveModulePositions
 Representation of the absolute encoder position of each module at home position. More...
 
struct  TranslationSpeeds
 Translation speeds as percent max output. More...
 

Functions

frc::SwerveModuleState Optimize (frc::SwerveModuleState desiredState, units::degree_t currentModuleAngle, units::degrees_per_second_t currentModuleAngularRate, units::feet_per_second_t currentModuleDriveVel, units::feet_per_second_t maxVelocity)
 Optimize swerve module to minimize rotations and drive direction changes.
 
template<class T , int size, class V >
constexpr TranslationSpeeds CircularInterpolate (const TranslationSpeeds rawSpeeds, const argos_lib::InterpolationMap< T, size, V > interpMap)
 Use argos_lib::InterpolationMap to apply mapping according to joystick vector magnitude.
 

Function Documentation

◆ CircularInterpolate()

template<class T , int size, class V >
constexpr TranslationSpeeds argos_lib::swerve::CircularInterpolate ( const TranslationSpeeds  rawSpeeds,
const argos_lib::InterpolationMap< T, size, V >  interpMap 
)
constexpr

Use argos_lib::InterpolationMap to apply mapping according to joystick vector magnitude.

Template Parameters
TType of interpolated input
sizeNumber of elements in interpolation map
VType of interpolated output
Parameters
rawSpeedsJoystick inputs as percentages
interpMapInterpolation map to apply to magnitudes
Returns
Remapped joystick percentages. Angle of vector will match rawSpeeds, but magnitude will scale according to interpMap. This results in circular deadband and other mapping results.

◆ Optimize()

frc::SwerveModuleState argos_lib::swerve::Optimize ( frc::SwerveModuleState  desiredState,
units::degree_t  currentModuleAngle,
units::degrees_per_second_t  currentModuleAngularRate,
units::feet_per_second_t  currentModuleDriveVel,
units::feet_per_second_t  maxVelocity 
)

Optimize swerve module to minimize rotations and drive direction changes.

Parameters
desiredStateRequested state. Output must result in same motion
currentModuleAngleModule rotation angle in relative or absolute position
currentModuleAngularRateCurrent module rotation speed. To prevent rapid changes in rotation direction.
currentModuleDriveVelCurrent module drive velocity. To prevent rapid changes in drive motor velocity.
maxVelocityMax velocity for determining max transition change thresholds
Returns
Optimized swerve module state that results in same motion as desiredState