Class MecanumDriveOdometry

java.lang.Object
edu.wpi.first.math.kinematics.MecanumDriveOdometry

public class MecanumDriveOdometry
extends Object
Class for mecanum drive odometry. Odometry allows you to track the robot's position on the field over a course of a match using readings from your mecanum wheel encoders.

Teams can use odometry during the autonomous period for complex tasks like path following. Furthermore, odometry can be used for latency compensation when using computer-vision systems.

  • Constructor Details

  • Method Details

    • resetPosition

      public void resetPosition​(Rotation2d gyroAngle, MecanumDriveWheelPositions wheelPositions, Pose2d poseMeters)
      Resets the robot's position on the field.

      The gyroscope angle does not need to be reset here on the user's robot code. The library automatically takes care of offsetting the gyro angle.

      Parameters:
      gyroAngle - The angle reported by the gyroscope.
      wheelPositions - The distances driven by each wheel.
      poseMeters - The position on the field that your robot is at.
    • getPoseMeters

      Returns the position of the robot on the field.
      Returns:
      The pose of the robot (x and y are in meters).
    • update

      public Pose2d update​(Rotation2d gyroAngle, MecanumDriveWheelPositions wheelPositions)
      Updates the robot's position on the field using forward kinematics and integration of the pose over time. This method takes in an angle parameter which is used instead of the angular rate that is calculated from forward kinematics, in addition to the current distance measurement at each wheel.
      Parameters:
      gyroAngle - The angle reported by the gyroscope.
      wheelPositions - The distances driven by each wheel.
      Returns:
      The new pose of the robot.