Pose2d

Pose2d represents a full robot pose: a Translation2d (x, y position) and a Rotation2d (orientation).

Why It's Useful

Pose2d provides a unified way to describe the robot's location and heading. It's essential for localization, motion planning, and integrating sensor data.

Common Use Cases

  • Odometry: Track robot's position on the field using encoder and gyro data

  • Vision fusion: Combine camera-based measurements (e.g., AprilTags) with wheel-based estimates using RobotState

  • Trajectory following: Compare robot's real-time Pose2d with planned trajectory states to generate correction commands

Useful Methods

circle-exclamation

For the following methods Pose represents an instance of the Pose2d class, Rot represent an instance of Rotation2d, Trans represents an instance of Translation2d

  • Pose.transformBy(otherPose) - means first translating by otherPose.translation and then rotating by otherPose.rotation

  • Pose.getTranslation() - Returns associated Translation2d

  • Pose.getRotation() - Returns associated Rotation2d

  • Pose.withRotation(Rot) - Returns a pose with the same translation as Pose but with the rotation of Rot

  • Pose.withTranslation(Trans) - Returns a pose with the same rotation as Pose but the the Translation of Trans

triangle-exclamation

Last updated