> 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`](https://yall.yassrobotics.com/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`](https://yall.yassrobotics.com/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](https://yall.yassrobotics.com/api-reference/java-reference/networktables/pose-estimate.md)
* [LimelightSettings#withRobotOrientation](https://yall.yassrobotics.com/api-reference/java-reference/networktables/limelight-settings.md)
* [Limelight](https://yall.yassrobotics.com/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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
