29 units::meters_per_second_t vx = 0_mps;
34 units::meters_per_second_t vy = 0_mps;
39 units::radians_per_second_t omega = 0_rad_per_s;
49 return Twist2d{vx * dt, vy * dt, omega * dt};
74 Pose2d desiredDeltaPose{vx * dt, vy * dt, omega * dt};
78 auto twist =
Pose2d{}.
Log(desiredDeltaPose);
81 return {twist.dx / dt, twist.dy / dt, twist.dtheta / dt};
98 Translation2d{units::meter_t{vx.value()}, units::meter_t{vy.value()}}
100 return {units::meters_per_second_t{rotated.X().value()},
101 units::meters_per_second_t{rotated.Y().value()}, omega};
118 Translation2d{units::meter_t{vx.value()}, units::meter_t{vy.value()}}
120 return {units::meters_per_second_t{rotated.X().value()},
121 units::meters_per_second_t{rotated.Y().value()}, omega};
135 return {vx + other.vx, vy + other.vy, omega + other.omega};
150 return *
this + -other;
186 return operator*(1.0 /
scalar);
#define WPILIB_DLLEXPORT
Definition SymbolExports.h:36
Represents a 2D pose containing translational and rotational elements.
Definition Pose2d.h:28
constexpr Twist2d Log(const Pose2d &end) const
Returns a Twist2d that maps this pose to the end pose.
Definition Pose2d.h:354
A rotation in a 2D coordinate frame represented by a point on the unit circle (cosine and sine).
Definition Rotation2d.h:26
Represents a translation in 2D space.
Definition Translation2d.h:29
constexpr Translation2d RotateBy(const Rotation2d &other) const
Applies a rotation to the translation in 2D space.
Definition Translation2d.h:135
Definition SystemServer.h:9
Represents the speed of a robot chassis.
Definition ChassisSpeeds.h:25
constexpr ChassisSpeeds Discretize(units::second_t dt) const
Discretizes a continuous-time chassis speed.
Definition ChassisSpeeds.h:71
constexpr Twist2d ToTwist2d(units::second_t dt) const
Creates a Twist2d from ChassisSpeeds.
Definition ChassisSpeeds.h:48
constexpr ChassisSpeeds ToFieldRelative(const Rotation2d &robotAngle) const
Converts this robot-relative set of speeds into a field-relative ChassisSpeeds object.
Definition ChassisSpeeds.h:115
constexpr ChassisSpeeds operator+(const ChassisSpeeds &other) const
Adds two ChassisSpeeds and returns the sum.
Definition ChassisSpeeds.h:134
constexpr ChassisSpeeds ToRobotRelative(const Rotation2d &robotAngle) const
Converts this field-relative set of speeds into a robot-relative ChassisSpeeds object.
Definition ChassisSpeeds.h:95
constexpr ChassisSpeeds operator-(const ChassisSpeeds &other) const
Subtracts the other ChassisSpeeds from the current ChassisSpeeds and returns the difference.
Definition ChassisSpeeds.h:149
constexpr ChassisSpeeds operator*(double scalar) const
Multiplies the ChassisSpeeds by a scalar and returns the new ChassisSpeeds.
Definition ChassisSpeeds.h:171
constexpr ChassisSpeeds operator/(double scalar) const
Divides the ChassisSpeeds by a scalar and returns the new ChassisSpeeds.
Definition ChassisSpeeds.h:185
constexpr ChassisSpeeds operator-() const
Returns the inverse of the current ChassisSpeeds.
Definition ChassisSpeeds.h:159
constexpr bool operator==(const ChassisSpeeds &other) const =default
Compares the ChassisSpeeds with another ChassisSpeed.
A change in distance along a 2D arc since the last pose update.
Definition Twist2d.h:22
Type representing an arbitrary unit.
Definition base.h:888