10 #include <units/units.h>
146 units::radian_t
Radians()
const {
return m_value; }
153 units::degree_t
Degrees()
const {
return m_value; }
160 double Cos()
const {
return m_cos; }
167 double Sin()
const {
return m_sin; }
174 double Tan()
const {
return m_sin / m_cos; }
177 units::radian_t m_value = 0_deg;
182 void to_json(
wpi::json& json,
const Rotation2d& rotation);
184 void from_json(
const wpi::json& json, Rotation2d& rotation);
a class to store JSON values
Definition: json.h:2655
Rotation2d operator+(const Rotation2d &other) const
Adds two rotations together, with the result being bounded between -pi and pi.
Rotation2d operator*(double scalar) const
Multiplies the current rotation by a scalar.
bool operator==(const Rotation2d &other) const
Checks equality between this Rotation2d and another object.
Rotation2d & operator-=(const Rotation2d &other)
Subtracts the new rotation from the current rotation.
units::degree_t Degrees() const
Returns the degree value of the rotation.
Definition: Rotation2d.h:153
double Tan() const
Returns the tangent of the rotation.
Definition: Rotation2d.h:174
double Cos() const
Returns the cosine of the rotation.
Definition: Rotation2d.h:160
bool operator!=(const Rotation2d &other) const
Checks inequality between this Rotation2d and another object.
A rotation in a 2d coordinate frame represented a point on the unit circle (cosine and sine).
Definition: Rotation2d.h:22
constexpr Rotation2d()=default
Constructs a Rotation2d with a default angle of 0 degrees.
WPILib C++ utilities (wpiutil) namespace.
Definition: EventLoopRunner.h:17
Rotation2d RotateBy(const Rotation2d &other) const
Adds the new rotation to the current rotation using a rotation matrix.
double Sin() const
Returns the sine of the rotation.
Definition: Rotation2d.h:167
units::radian_t Radians() const
Returns the radian value of the rotation.
Definition: Rotation2d.h:146
A class that enforces constraints on the differential drive kinematics.
Definition: SPIAccelerometerSim.h:16
Rotation2d operator-() const
Takes the inverse of the current rotation.
Rotation2d & operator+=(const Rotation2d &other)
Adds a rotation to the current rotation.