> For the complete documentation index, see [llms.txt](https://yall.yassrobotics.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yall.yassrobotics.com/api-reference/java-reference/networktables/limelight-pose-estimator.md).

# LimelightPoseEstimator

**Package:** `limelight.networktables`

Fetches field-relative robot pose estimates from a [`Limelight`](/api-reference/java-reference/limelight.md), using either the MegaTag1 or MegaTag2 pipeline. Created via `limelight.createPoseEstimator(EstimationMode)`.

```java
LimelightPoseEstimator poseEstimator = limelight.createPoseEstimator(EstimationMode.MEGATAG2);
Optional<PoseEstimate> estimate = poseEstimator.getPoseEstimate();
```

***

## Constructor

```java
LimelightPoseEstimator(Limelight camera, EstimationMode estimationMode)
```

Prefer `limelight.createPoseEstimator(mode)` over calling this directly.

***

## Methods

| Method                        | Returns                  | Description                                                                                                           |
| ----------------------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------- |
| `getPoseEstimate()`           | `Optional<PoseEstimate>` | Blue-origin pose estimate, using MegaTag1 or MegaTag2 depending on the estimator's `EstimationMode`.                  |
| `getAlliancePoseEstimate()`   | `Optional<PoseEstimate>` | Pose estimate in the coordinate frame matching `DriverStation.getAlliance()`. Empty if alliance color is unavailable. |
| `getBotPose()` *(deprecated)* | `Pose3d`                 | Legacy MegaTag1 `botpose` entry, not alliance- or origin-aware. Prefer `getPoseEstimate()`.                           |

***

## EstimationMode

| Value      | Description                                                                                                                                                                                                                                                                                                |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `MEGATAG1` | Estimates pose from a single AprilTag using only visual data. No external state required.                                                                                                                                                                                                                  |
| `MEGATAG2` | Fuses AprilTag detections with robot heading for smoother, more accurate localization — especially at long range or oblique angles. Requires calling [`LimelightSettings.withRobotOrientation`](/api-reference/java-reference/networktables/limelight-settings.md) every loop before reading the estimate. |

***

## BotPose

Internal enum mapping each `EstimationMode`/alliance combination to its NetworkTables entry name. Exposed publicly for direct access without going through a `LimelightPoseEstimator`:

```java
Optional<PoseEstimate> estimate = BotPose.BLUE_MEGATAG2.get(limelight);
```

| Value                           | NT Entry              | MegaTag2 |
| ------------------------------- | --------------------- | -------- |
| `RED`                           | `botpose_wpired`      | No       |
| `RED_MEGATAG2`                  | `botpose_orb_wpired`  | Yes      |
| `BLUE` *(recommended)*          | `botpose_wpiblue`     | No       |
| `BLUE_MEGATAG2` *(recommended)* | `botpose_orb_wpiblue` | Yes      |

Each `BotPose` value caches one `PoseEstimate` per `Limelight` it's queried with, keyed by camera name + entry, so repeated calls don't allocate.

## See Also

* [PoseEstimate](/api-reference/java-reference/networktables/pose-estimate.md)
* [LimelightSettings#withRobotOrientation](/api-reference/java-reference/networktables/limelight-settings.md)
* [Limelight](/api-reference/java-reference/limelight.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://yall.yassrobotics.com/api-reference/java-reference/networktables/limelight-pose-estimator.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
