28 :
public Kinematics<DifferentialDriveWheelSpeeds,
29 DifferentialDriveWheelPositions> {
40 : trackWidth(trackWidth) {
54 return {(wheelSpeeds.
left + wheelSpeeds.
right) / 2.0, 0_mps,
55 (wheelSpeeds.
right - wheelSpeeds.
left) / trackWidth * 1_rad};
68 return {chassisSpeeds.
vx - trackWidth / 2 * chassisSpeeds.
omega / 1_rad,
69 chassisSpeeds.
vx + trackWidth / 2 * chassisSpeeds.
omega / 1_rad};
81 const units::meter_t rightDistance)
const {
82 return {(leftDistance + rightDistance) / 2, 0_m,
83 (rightDistance - leftDistance) / trackWidth * 1_rad};
88 return ToTwist2d(wheelDeltas.
left, wheelDeltas.
right);
#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:29
constexpr DifferentialDriveWheelSpeeds ToWheelSpeeds(const ChassisSpeeds &chassisSpeeds) const override
Returns left and right component velocities from a chassis speed using inverse kinematics.
Definition: DifferentialDriveKinematics.h:66
units::meter_t trackWidth
Definition: DifferentialDriveKinematics.h:91
constexpr ChassisSpeeds ToChassisSpeeds(const DifferentialDriveWheelSpeeds &wheelSpeeds) const override
Returns a chassis speed from left and right component velocities using forward kinematics.
Definition: DifferentialDriveKinematics.h:52
DifferentialDriveKinematics(units::meter_t trackWidth)
Constructs a differential drive kinematics object.
Definition: DifferentialDriveKinematics.h:39
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:80
Twist2d ToTwist2d(const DifferentialDriveWheelPositions &wheelDeltas) const override
Performs forward kinematics to return the resulting Twist2d from the given wheel deltas.
Definition: DifferentialDriveKinematics.h:86
Helper class that converts a chassis velocity (dx, dy, and dtheta components) into individual wheel s...
Definition: Kinematics.h:23
static void ReportUsage(MathUsageId id, int count)
Definition: MathShared.h:73
Definition: AprilTagPoseEstimator.h:15
@ 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 positions for a differential drive drivetrain.
Definition: DifferentialDriveWheelPositions.h:16
units::meter_t left
Distance driven by the left side.
Definition: DifferentialDriveWheelPositions.h:20
units::meter_t right
Distance driven by the right side.
Definition: DifferentialDriveWheelPositions.h:25
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