10#include <units/angular_velocity.h>
11#include <units/velocity.h>
44 std::vector<Translation2d> m_moduleLocations;
46 struct KinematicsMatrices;
47 std::unique_ptr<KinematicsMatrices> m_matrices;
49 std::vector<Rotation2d> m_lastModuleHeading;
50 Translation2d m_lastCOR{};
84 for (
size_t i = 0; i < m_numModules && i < moduleHeadings.size(); ++i) {
85 m_lastModuleHeading[i] = moduleHeadings[i];
160 for (
size_t i = 0; i < m_numModules && i < std::min(start.size(), end.size()); ++i) {
161 result[i] = {end[i].distance - start[i].distance, end[i].angle};
178 for (
size_t i = 0; i < m_numModules && i < std::min(start.size(), end.size()); ++i) {
179 result[i] = start[i].Interpolate(end[i], t);
Class that converts a chassis velocity (dx, dy, and dtheta components) into individual module states ...
Definition SwerveDriveKinematics.hpp:42
SwerveDriveKinematics(std::vector< Translation2d > moduleLocations)
Constructs a swerve drive kinematics object.
Twist2d ToTwist2d(WheelPositions const &start, WheelPositions const &end) const
Performs forward kinematics to return the resulting Twist2d from the given change in wheel positions.
Definition SwerveDriveKinematics.hpp:157
std::vector< SwerveModulePosition > WheelPositions
Definition SwerveDriveKinematics.hpp:54
SwerveDriveKinematics(SwerveDriveKinematics &&)
SwerveDriveKinematics & operator=(SwerveDriveKinematics const &)
static void DesaturateWheelSpeeds(WheelSpeeds *moduleStates, units::meters_per_second_t attainableMaxSpeed)
Renormalizes the wheel speeds if any individual speed is above the specified maximum.
ChassisSpeeds ToChassisSpeeds(WheelSpeeds const &moduleStates) const
Performs forward kinematics to return the resulting chassis state from the given module states.
WheelPositions Interpolate(WheelPositions const &start, WheelPositions const &end, double t) const
Performs interpolation between two values.
Definition SwerveDriveKinematics.hpp:175
WheelSpeeds ToSwerveModuleStates(ChassisSpeeds const &chassisSpeeds, Translation2d const ¢erOfRotation=Translation2d{})
Performs inverse kinematics to return the module states from a desired chassis velocity.
SwerveDriveKinematics(SwerveDriveKinematics const &)
SwerveDriveKinematics & operator=(SwerveDriveKinematics &&)
void ResetHeadings(std::vector< Rotation2d > const &moduleHeadings)
Reset the internal swerve module headings.
Definition SwerveDriveKinematics.hpp:82
Twist2d ToTwist2d(WheelPositions const &moduleDeltas) const
Performs forward kinematics to return the resulting Twist2d from the given module position deltas.
std::vector< SwerveModuleState > WheelSpeeds
Definition SwerveDriveKinematics.hpp:53
Definition StatusCodes.h:18