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;
58 units::meters_per_second_t vx, units::meters_per_second_t vy,
59 units::radians_per_second_t omega,
const Rotation2d& robotAngle) {
60 return {vx * robotAngle.
Cos() + vy * robotAngle.
Sin(),
61 -vx * robotAngle.
Sin() + vy * robotAngle.
Cos(), omega};
80 return FromFieldRelativeSpeeds(fieldRelativeSpeeds.
vx,
81 fieldRelativeSpeeds.
vy,
82 fieldRelativeSpeeds.
omega, robotAngle);
#define WPILIB_DLLEXPORT
Definition: SymbolExports.h:36
A rotation in a 2D coordinate frame represented by a point on the unit circle (cosine and sine).
Definition: Rotation2d.h:26
constexpr double Cos() const
Returns the cosine of the rotation.
Definition: Rotation2d.h:152
constexpr double Sin() const
Returns the sine of the rotation.
Definition: Rotation2d.h:159
Definition: AprilTagFieldLayout.h:22
Represents the speed of a robot chassis.
Definition: ChassisSpeeds.h:25
units::meters_per_second_t vx
Represents forward velocity w.r.t the robot frame of reference.
Definition: ChassisSpeeds.h:29
units::meters_per_second_t vy
Represents strafe velocity w.r.t the robot frame of reference.
Definition: ChassisSpeeds.h:34
static ChassisSpeeds FromFieldRelativeSpeeds(const ChassisSpeeds &fieldRelativeSpeeds, const Rotation2d &robotAngle)
Converts a user provided field-relative ChassisSpeeds object into a robot-relative ChassisSpeeds obje...
Definition: ChassisSpeeds.h:78
units::radians_per_second_t omega
Represents the angular velocity of the robot frame.
Definition: ChassisSpeeds.h:39
static ChassisSpeeds FromFieldRelativeSpeeds(units::meters_per_second_t vx, units::meters_per_second_t vy, units::radians_per_second_t omega, const Rotation2d &robotAngle)
Converts a user provided field-relative set of speeds into a robot-relative ChassisSpeeds object.
Definition: ChassisSpeeds.h:57