9#include "wpi/units/math.hpp"
10#include "wpi/units/velocity.hpp"
24 wpi::units::meters_per_second_t maxVelocity)
25 : m_kinematics(kinematics), m_maxVelocity(maxVelocity) {}
28 const Pose2d& pose, wpi::units::curvature_t curvature,
29 wpi::units::meters_per_second_t velocity)
const override {
32 auto wheelVelocities =
34 .ToWheelVelocities({xVelocity, yVelocity, velocity * curvature})
35 .Desaturate(m_maxVelocity);
37 auto normVelocities = m_kinematics.ToChassisVelocities(wheelVelocities);
39 return wpi::units::math::hypot(normVelocities.vx, normVelocities.vy);
43 const Pose2d& pose, wpi::units::curvature_t curvature,
44 wpi::units::meters_per_second_t velocity)
const override {
50 wpi::units::meters_per_second_t m_maxVelocity;
#define WPILIB_DLLEXPORT
Definition SymbolExports.hpp:36
wpi::units::meters_per_second_t MaxVelocity(const Pose2d &pose, wpi::units::curvature_t curvature, wpi::units::meters_per_second_t velocity) const override
Returns the max velocity given the current pose and curvature.
Definition MecanumDriveKinematicsConstraint.hpp:27
MinMax MinMaxAcceleration(const Pose2d &pose, wpi::units::curvature_t curvature, wpi::units::meters_per_second_t velocity) const override
Returns the minimum and maximum allowable acceleration for the trajectory given pose,...
Definition MecanumDriveKinematicsConstraint.hpp:42
MecanumDriveKinematicsConstraint(const MecanumDriveKinematics &kinematics, wpi::units::meters_per_second_t maxVelocity)
Definition MecanumDriveKinematicsConstraint.hpp:23
Helper class that converts a chassis velocity (dx, dy, and dtheta components) into individual wheel v...
Definition MecanumDriveKinematics.hpp:48
Represents a 2D pose containing translational and rotational elements.
Definition Pose2d.hpp:27
constexpr const Rotation2d & Rotation() const
Returns the underlying rotation.
Definition Pose2d.hpp:128
constexpr double Cos() const
Returns the cosine of the rotation.
Definition Rotation2d.hpp:235
constexpr double Sin() const
Returns the sine of the rotation.
Definition Rotation2d.hpp:242
constexpr TrajectoryConstraint()=default
Definition LinearSystem.hpp:20
Represents a minimum and maximum acceleration.
Definition TrajectoryConstraint.hpp:36