Skip to main content

PoseEstimate methods

These methods return a PoseEstimate object that bundles the 2D pose with a latency-adjusted timestamp, tag metadata, and per-fiducial details. They are the recommended way to feed vision measurements into WPILib’s SwerveDrivePoseEstimator or DifferentialDrivePoseEstimator.
Always call SetRobotOrientation before reading MegaTag2 estimates. MegaTag2 requires your robot’s current yaw to constrain the pose solve.

getBotPoseEstimate_wpiBlue

Returns a MegaTag1 pose estimate in the WPILib Blue Alliance coordinate system.
LimelightHelpers.PoseEstimate estimate =
    LimelightHelpers.getBotPoseEstimate_wpiBlue("limelight");

if (LimelightHelpers.validPoseEstimate(estimate)) {
    swervePoseEstimator.addVisionMeasurement(
        estimate.pose,
        estimate.timestampSeconds
    );
}
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
PoseEstimate
MegaTag1 pose estimate in the WPILib Blue Alliance origin. Fields: pose (Pose2d), timestampSeconds (latency-adjusted), latency (ms), tagCount, tagSpan (m), avgTagDist (m), avgTagArea (%), rawFiducials (RawFiducial[]), isMegaTag2 (false).

getBotPoseEstimate_wpiRed

Returns a MegaTag1 pose estimate in the WPILib Red Alliance coordinate system.
LimelightHelpers.PoseEstimate estimate =
    LimelightHelpers.getBotPoseEstimate_wpiRed("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
PoseEstimate
MegaTag1 pose estimate in the WPILib Red Alliance origin. isMegaTag2 is false.

getBotPoseEstimate_wpiBlue_MegaTag2

Returns a MegaTag2 pose estimate in the WPILib Blue Alliance coordinate system. MegaTag2 uses your robot’s reported yaw to constrain the pose solve, producing lower rotational ambiguity at the cost of requiring an accurate gyro input.
// Must be called every loop before reading MegaTag2
LimelightHelpers.SetRobotOrientation("limelight",
    gyro.getYaw(), 0, 0, 0, 0, 0);

LimelightHelpers.PoseEstimate mt2 =
    LimelightHelpers.getBotPoseEstimate_wpiBlue_MegaTag2("limelight");

if (LimelightHelpers.validPoseEstimate(mt2)) {
    swervePoseEstimator.addVisionMeasurement(
        mt2.pose,
        mt2.timestampSeconds
    );
}
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
PoseEstimate
MegaTag2 pose estimate in the WPILib Blue Alliance origin. isMegaTag2 is true.

getBotPoseEstimate_wpiRed_MegaTag2

Returns a MegaTag2 pose estimate in the WPILib Red Alliance coordinate system.
LimelightHelpers.SetRobotOrientation("limelight",
    gyro.getYaw(), 0, 0, 0, 0, 0);

LimelightHelpers.PoseEstimate mt2 =
    LimelightHelpers.getBotPoseEstimate_wpiRed_MegaTag2("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
PoseEstimate
MegaTag2 pose estimate in the WPILib Red Alliance origin. isMegaTag2 is true.

3D pose methods

These methods return a Pose3d object. They are useful for 3D visualization and for computing spatial relationships between the robot, camera, and target.

getBotPose3d

Returns the robot’s 3D pose in the field-centric coordinate system used internally by the Limelight. This is not the WPILib standard origin.
Pose3d pose = LimelightHelpers.getBotPose3d("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
Pose3d
Robot pose in Limelight field-centric space. Use getBotPose3d_wpiBlue for WPILib-compatible coordinates.

getBotPose3d_wpiBlue

(Recommended) Returns the robot’s 3D pose in the WPILib Blue Alliance coordinate system.
Pose3d pose = LimelightHelpers.getBotPose3d_wpiBlue("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
Pose3d
Robot pose in the WPILib Blue Alliance origin. Origin is the Blue Alliance corner of the field.

getBotPose3d_wpiRed

(Not recommended) Returns the robot’s 3D pose in the WPILib Red Alliance coordinate system.
Pose3d pose = LimelightHelpers.getBotPose3d_wpiRed("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
Pose3d
Robot pose in the WPILib Red Alliance origin. Prefer getBotPose3d_wpiBlue for most use cases.

getBotPose3d_TargetSpace

Returns the robot’s 3D pose relative to the currently tracked target’s coordinate system.
Pose3d robotRelativeToTarget = LimelightHelpers.getBotPose3d_TargetSpace("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
Pose3d
Robot pose expressed in the target’s coordinate frame.

getCameraPose3d_TargetSpace

Returns the camera’s 3D pose relative to the currently tracked target’s coordinate system.
Pose3d cameraRelativeToTarget = LimelightHelpers.getCameraPose3d_TargetSpace("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
Pose3d
Camera pose expressed in the target’s coordinate frame.

getTargetPose3d_CameraSpace

Returns the primary target’s 3D pose in the camera’s coordinate system.
Pose3d targetInCameraSpace = LimelightHelpers.getTargetPose3d_CameraSpace("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
Pose3d
Target pose expressed in the camera’s coordinate frame.

getTargetPose3d_RobotSpace

Returns the primary target’s 3D pose in the robot’s coordinate system.
Pose3d targetInRobotSpace = LimelightHelpers.getTargetPose3d_RobotSpace("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
Pose3d
Target pose expressed in the robot’s coordinate frame.

getCameraPose3d_RobotSpace

Returns the camera’s 3D pose in the robot’s coordinate system.
Pose3d cameraInRobotSpace = LimelightHelpers.getCameraPose3d_RobotSpace("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
Pose3d
Camera pose expressed in the robot’s coordinate frame.

2D pose methods

These methods return a Pose2d derived from the raw 6-element pose array. They use x, y, and yaw only; z, roll, and pitch are discarded.

getBotPose2d

Returns the robot’s 2D pose in the Limelight field-centric coordinate system (not WPILib-standard).
Pose2d pose = LimelightHelpers.getBotPose2d("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
Pose2d
Robot 2D pose in Limelight field-centric space.

getBotPose2d_wpiBlue

Returns the robot’s 2D pose in the WPILib Blue Alliance coordinate system.
Pose2d pose = LimelightHelpers.getBotPose2d_wpiBlue("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
Pose2d
Robot 2D pose in the WPILib Blue Alliance origin.

getBotPose2d_wpiRed

Returns the robot’s 2D pose in the WPILib Red Alliance coordinate system.
Pose2d pose = LimelightHelpers.getBotPose2d_wpiRed("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
Pose2d
Robot 2D pose in the WPILib Red Alliance origin.

Raw pose array methods

These methods return a 6-element double[] in the format [x, y, z, roll, pitch, yaw] where translations are in meters and angles are in degrees. They are lower-level than the Pose3d/Pose2d variants. Use toPose3D or toPose2D to convert them.
The deprecated lowercase variants (getBotpose, getBotpose_wpiBlue, getBotpose_wpiRed) are aliases for these methods. Use the capitalized versions shown below.

getBotPose

double[] pose = LimelightHelpers.getBotPose("limelight");
// [x, y, z, roll, pitch, yaw]
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
double[]
6-element array [x, y, z, roll, pitch, yaw] in Limelight field-centric space.

getBotPose_wpiBlue

double[] pose = LimelightHelpers.getBotPose_wpiBlue("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
double[]
6-element array [x, y, z, roll, pitch, yaw] in the WPILib Blue Alliance origin.

getBotPose_wpiRed

double[] pose = LimelightHelpers.getBotPose_wpiRed("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
double[]
6-element array [x, y, z, roll, pitch, yaw] in the WPILib Red Alliance origin.

getBotPose_TargetSpace

double[] pose = LimelightHelpers.getBotPose_TargetSpace("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
double[]
6-element array representing the robot pose in the target’s coordinate frame.

getCameraPose_TargetSpace

double[] pose = LimelightHelpers.getCameraPose_TargetSpace("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
double[]
6-element array representing the camera pose in the target’s coordinate frame.

getTargetPose_CameraSpace

double[] pose = LimelightHelpers.getTargetPose_CameraSpace("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
double[]
6-element array representing the target pose in the camera’s coordinate frame.

getTargetPose_RobotSpace

double[] pose = LimelightHelpers.getTargetPose_RobotSpace("limelight");
limelightName
string
required
Name of the Limelight NetworkTables table.
returns
double[]
6-element array representing the target pose in the robot’s coordinate frame.

Deprecated methods

These lowercase variants are @Deprecated. Replace them with the capitalized equivalents.
DeprecatedReplacement
getBotpose(String)getBotPose(String)
getBotpose_wpiBlue(String)getBotPose_wpiBlue(String)
getBotpose_wpiRed(String)getBotPose_wpiRed(String)

Build docs developers (and LLMs) love