diff --git a/wpilibc/src/main/native/include/frc/kinematics/DifferentialDriveOdometry.h b/wpilibc/src/main/native/include/frc/kinematics/DifferentialDriveOdometry.h index 7e463426e1..91aeef1632 100644 --- a/wpilibc/src/main/native/include/frc/kinematics/DifferentialDriveOdometry.h +++ b/wpilibc/src/main/native/include/frc/kinematics/DifferentialDriveOdometry.h @@ -47,6 +47,12 @@ class DifferentialDriveOdometry { m_previousAngle = pose.Rotation(); } + /** + * Returns the position of the robot on the field. + * @return The pose of the robot. + */ + const Pose2d& GetPose() const { return m_pose; } + /** * Updates the robot's position on the field using forward kinematics and * integration of the pose over time. This method takes in the current time as diff --git a/wpilibc/src/main/native/include/frc/kinematics/MecanumDriveOdometry.h b/wpilibc/src/main/native/include/frc/kinematics/MecanumDriveOdometry.h index 58bdc6cfc7..098b7ff121 100644 --- a/wpilibc/src/main/native/include/frc/kinematics/MecanumDriveOdometry.h +++ b/wpilibc/src/main/native/include/frc/kinematics/MecanumDriveOdometry.h @@ -45,6 +45,12 @@ class MecanumDriveOdometry { m_previousAngle = pose.Rotation(); } + /** + * Returns the position of the robot on the field. + * @return The pose of the robot. + */ + const Pose2d& GetPose() const { return m_pose; } + /** * Updates the robot's position on the field using forward kinematics and * integration of the pose over time. This method takes in the current time as diff --git a/wpilibc/src/main/native/include/frc/kinematics/SwerveDriveOdometry.h b/wpilibc/src/main/native/include/frc/kinematics/SwerveDriveOdometry.h index 168c7c4cea..2d7af7f70d 100644 --- a/wpilibc/src/main/native/include/frc/kinematics/SwerveDriveOdometry.h +++ b/wpilibc/src/main/native/include/frc/kinematics/SwerveDriveOdometry.h @@ -50,6 +50,12 @@ class SwerveDriveOdometry { m_previousAngle = pose.Rotation(); } + /** + * Returns the position of the robot on the field. + * @return The pose of the robot. + */ + const Pose2d& GetPose() const { return m_pose; } + /** * Updates the robot's position on the field using forward kinematics and * integration of the pose over time. This method takes in the current time as diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/kinematics/DifferentialDriveOdometry.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/kinematics/DifferentialDriveOdometry.java index 53eeff2c01..b63f7265f0 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/kinematics/DifferentialDriveOdometry.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/kinematics/DifferentialDriveOdometry.java @@ -64,6 +64,14 @@ public class DifferentialDriveOdometry { m_previousAngle = poseMeters.getRotation(); } + /** + * Returns the position of the robot on the field. + * @return The pose of the robot (x and y are in meters). + */ + public Pose2d getPoseMeters() { + return m_poseMeters; + } + /** * Updates the robot's position on the field using forward kinematics and * integration of the pose over time. This method takes in the current time as diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/kinematics/MecanumDriveOdometry.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/kinematics/MecanumDriveOdometry.java index f43e59094f..890cb9a0af 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/kinematics/MecanumDriveOdometry.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/kinematics/MecanumDriveOdometry.java @@ -58,6 +58,14 @@ public class MecanumDriveOdometry { m_previousAngle = poseMeters.getRotation(); } + /** + * Returns the position of the robot on the field. + * @return The pose of the robot (x and y are in meters). + */ + public Pose2d getPoseMeters() { + return m_poseMeters; + } + /** * Updates the robot's position on the field using forward kinematics and * integration of the pose over time. This method takes in the current time as diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/kinematics/SwerveDriveOdometry.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/kinematics/SwerveDriveOdometry.java index ac28c209f1..e33c7f532d 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/kinematics/SwerveDriveOdometry.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/kinematics/SwerveDriveOdometry.java @@ -58,6 +58,14 @@ public class SwerveDriveOdometry { m_previousAngle = pose.getRotation(); } + /** + * Returns the position of the robot on the field. + * @return The pose of the robot (x and y are in meters). + */ + public Pose2d getPoseMeters() { + return m_poseMeters; + } + /** * Updates the robot's position on the field using forward kinematics and * integration of the pose over time. This method takes in the current time as