7#include <frc/kinematics/SwerveModuleState.h>
8#include <units/angle.h>
9#include <units/angular_velocity.h>
10#include <units/velocity.h>
29 frc::SwerveModuleState
Optimize(frc::SwerveModuleState desiredState,
30 units::degree_t currentModuleAngle,
31 units::degrees_per_second_t currentModuleAngularRate,
32 units::feet_per_second_t currentModuleDriveVel,
33 units::feet_per_second_t maxVelocity);
64 template <
class T,
int size,
class V>
69 const double mappedMagnitude = interpMap(magnitude);
70 return TranslationSpeeds{mappedMagnitude * std::cos(angle), mappedMagnitude * std::sin(angle)};
Performs linear interpolation of a value based on a set of input->output mapping points.
Definition interpolation.h:46
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.
Definition swerve_utils.h:65
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.
Definition swerve_utils.cpp:16
Definition swap_controllers_command.h:12
Representation of the absolute encoder position of each module at home position.
Definition swerve_utils.h:38
units::degree_t FrontRight
Definition swerve_utils.h:40
units::degree_t RearRight
Definition swerve_utils.h:41
units::degree_t FrontLeft
Definition swerve_utils.h:39
units::degree_t RearLeft
Definition swerve_utils.h:42
Translation speeds as percent max output.
Definition swerve_utils.h:48
double leftSpeedPct
Speed with positive left in range [-1, 1].
Definition swerve_utils.h:50
double forwardSpeedPct
Speed with positive forward in range [-1, 1].
Definition swerve_utils.h:49