8#include "wpi/units/acceleration.hpp"
9#include "wpi/units/math.hpp"
53 auto sumX = thisX + otherX;
54 auto sumY = thisY + otherY;
56 auto resultAcceleration = units::math::hypot(sumX, sumY);
57 auto resultAngle =
Rotation2d{sumX.value(), sumY.value()};
59 return {resultAcceleration, resultAngle};
71 return *
this + (-other);
#define WPILIB_DLLEXPORT
Definition SymbolExports.hpp:36
A rotation in a 2D coordinate frame represented by a point on the unit circle (cosine and sine).
Definition Rotation2d.hpp:26
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
Definition LinearSystem.hpp:20
Represents the accelerations of one swerve module.
Definition SwerveModuleAcceleration.hpp:16
units::meters_per_second_squared_t acceleration
Acceleration of the wheel of the module.
Definition SwerveModuleAcceleration.hpp:20
constexpr SwerveModuleAcceleration operator-() const
Returns the inverse of the current SwerveModuleAccelerations.
Definition SwerveModuleAcceleration.hpp:80
constexpr bool operator==(const SwerveModuleAcceleration &other) const
Checks equality between this SwerveModuleAccelerations and another object.
Definition SwerveModuleAcceleration.hpp:33
constexpr SwerveModuleAcceleration operator*(double scalar) const
Multiplies the SwerveModuleAccelerations by a scalar and returns the new SwerveModuleAccelerations.
Definition SwerveModuleAcceleration.hpp:91
SwerveModuleAcceleration operator+(const SwerveModuleAcceleration &other) const
Adds two SwerveModuleAccelerations and returns the sum.
Definition SwerveModuleAcceleration.hpp:45
constexpr SwerveModuleAcceleration operator/(double scalar) const
Divides the SwerveModuleAccelerations by a scalar and returns the new SwerveModuleAccelerations.
Definition SwerveModuleAcceleration.hpp:105
Rotation2d angle
Angle of the acceleration vector.
Definition SwerveModuleAcceleration.hpp:25
SwerveModuleAcceleration operator-(const SwerveModuleAcceleration &other) const
Subtracts the other SwerveModuleAccelerations from the current SwerveModuleAccelerations and returns ...
Definition SwerveModuleAcceleration.hpp:69