Class MecanumDriveKinematics

java.lang.Object
edu.wpi.first.math.kinematics.MecanumDriveKinematics
All Implemented Interfaces:
Kinematics<MecanumDriveWheelSpeeds,​MecanumDriveWheelPositions>

public class MecanumDriveKinematics
extends Object
implements Kinematics<MecanumDriveWheelSpeeds,​MecanumDriveWheelPositions>
Helper class that converts a chassis velocity (dx, dy, and dtheta components) into individual wheel speeds.

The inverse kinematics (converting from a desired chassis velocity to individual wheel speeds) uses the relative locations of the wheels with respect to the center of rotation. The center of rotation for inverse kinematics is also variable. This means that you can set your center of rotation in a corner of the robot to perform special evasion maneuvers.

Forward kinematics (converting an array of wheel speeds into the overall chassis motion) is performs the exact opposite of what inverse kinematics does. Since this is an overdetermined system (more equations than variables), we use a least-squares approximation.

The inverse kinematics: [wheelSpeeds] = [wheelLocations] * [chassisSpeeds] We take the Moore-Penrose pseudoinverse of [wheelLocations] and then multiply by [wheelSpeeds] to get our chassis speeds.

Forward kinematics is also used for odometry -- determining the position of the robot on the field using encoders and a gyro.

  • Constructor Details

    • MecanumDriveKinematics

      public MecanumDriveKinematics​(Translation2d frontLeftWheelMeters, Translation2d frontRightWheelMeters, Translation2d rearLeftWheelMeters, Translation2d rearRightWheelMeters)
      Constructs a mecanum drive kinematics object.
      Parameters:
      frontLeftWheelMeters - The location of the front-left wheel relative to the physical center of the robot.
      frontRightWheelMeters - The location of the front-right wheel relative to the physical center of the robot.
      rearLeftWheelMeters - The location of the rear-left wheel relative to the physical center of the robot.
      rearRightWheelMeters - The location of the rear-right wheel relative to the physical center of the robot.
  • Method Details