36 : trackWidth(trackWidth) {
50 return {(wheelSpeeds.
left + wheelSpeeds.
right) / 2.0, 0_mps,
51 (wheelSpeeds.
right - wheelSpeeds.
left) / trackWidth * 1_rad};
64 return {chassisSpeeds.
vx - trackWidth / 2 * chassisSpeeds.
omega / 1_rad,
65 chassisSpeeds.
vx + trackWidth / 2 * chassisSpeeds.
omega / 1_rad};
77 const units::meter_t rightDistance)
const {
78 return {(leftDistance + rightDistance) / 2, 0_m,
79 (rightDistance - leftDistance) / trackWidth * 1_rad};
#define WPILIB_DLLEXPORT
Definition: SymbolExports.h:36
Helper class that converts a chassis velocity (dx and dtheta components) to left and right wheel velo...
Definition: DifferentialDriveKinematics.h:25
units::meter_t trackWidth
Definition: DifferentialDriveKinematics.h:82
constexpr ChassisSpeeds ToChassisSpeeds(const DifferentialDriveWheelSpeeds &wheelSpeeds) const
Returns a chassis speed from left and right component velocities using forward kinematics.
Definition: DifferentialDriveKinematics.h:48
constexpr DifferentialDriveWheelSpeeds ToWheelSpeeds(const ChassisSpeeds &chassisSpeeds) const
Returns left and right component velocities from a chassis speed using inverse kinematics.
Definition: DifferentialDriveKinematics.h:62
DifferentialDriveKinematics(units::meter_t trackWidth)
Constructs a differential drive kinematics object.
Definition: DifferentialDriveKinematics.h:35
constexpr Twist2d ToTwist2d(const units::meter_t leftDistance, const units::meter_t rightDistance) const
Returns a twist from left and right distance deltas using forward kinematics.
Definition: DifferentialDriveKinematics.h:76
static void ReportUsage(MathUsageId id, int count)
Definition: MathShared.h:73
Definition: AprilTagFieldLayout.h:22
@ kKinematics_DifferentialDrive
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::radians_per_second_t omega
Represents the angular velocity of the robot frame.
Definition: ChassisSpeeds.h:39
Represents the wheel speeds for a differential drive drivetrain.
Definition: DifferentialDriveWheelSpeeds.h:15
units::meters_per_second_t left
Speed of the left side of the robot.
Definition: DifferentialDriveWheelSpeeds.h:19
units::meters_per_second_t right
Speed of the right side of the robot.
Definition: DifferentialDriveWheelSpeeds.h:24
A change in distance along a 2D arc since the last pose update.
Definition: Twist2d.h:21