20 units::meters_per_second_t
left = 0_mps;
25 units::meters_per_second_t
right = 0_mps;
39 constexpr void Desaturate(units::meters_per_second_t attainableMaxSpeed) {
43 if (realMaxSpeed > attainableMaxSpeed) {
44 left =
left / realMaxSpeed * attainableMaxSpeed;
45 right =
right / realMaxSpeed * attainableMaxSpeed;
62 return {
left + other.left,
right + other.right};
79 return *
this + -other;
120 return operator*(1.0 /
scalar);
#define WPILIB_DLLEXPORT
Definition SymbolExports.h:36
constexpr UnitType abs(const UnitType x) noexcept
Compute absolute value.
Definition math.h:726
constexpr UnitTypeLhs max(const UnitTypeLhs &lhs, const UnitTypeRhs &rhs)
Definition base.h:3422
Represents the wheel speeds for a differential drive drivetrain.
Definition DifferentialDriveWheelSpeeds.h:16
constexpr DifferentialDriveWheelSpeeds operator+(const DifferentialDriveWheelSpeeds &other) const
Adds two DifferentialDriveWheelSpeeds and returns the sum.
Definition DifferentialDriveWheelSpeeds.h:60
constexpr DifferentialDriveWheelSpeeds operator*(double scalar) const
Multiplies the DifferentialDriveWheelSpeeds by a scalar and returns the new DifferentialDriveWheelSpe...
Definition DifferentialDriveWheelSpeeds.h:104
constexpr DifferentialDriveWheelSpeeds operator/(double scalar) const
Divides the DifferentialDriveWheelSpeeds by a scalar and returns the new DifferentialDriveWheelSpeeds...
Definition DifferentialDriveWheelSpeeds.h:119
constexpr DifferentialDriveWheelSpeeds operator-() const
Returns the inverse of the current DifferentialDriveWheelSpeeds.
Definition DifferentialDriveWheelSpeeds.h:89
constexpr DifferentialDriveWheelSpeeds operator-(const DifferentialDriveWheelSpeeds &other) const
Subtracts the other DifferentialDriveWheelSpeeds from the current DifferentialDriveWheelSpeeds and re...
Definition DifferentialDriveWheelSpeeds.h:77
constexpr void Desaturate(units::meters_per_second_t attainableMaxSpeed)
Renormalizes the wheel speeds if either side is above the specified maximum.
Definition DifferentialDriveWheelSpeeds.h:39
Type representing an arbitrary unit.
Definition base.h:888