> 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/documentation/how-to-guides/how-do-i-choose-megatag1-vs-megatag2.md).

# How do I choose between MegaTag1 and MegaTag2?

## Short answer

Use **MegaTag2** unless you have a specific reason not to. It's smoother, more accurate at range and oblique angles, and is what `LimelightPoseEstimator.getPoseEstimate()` and `BotPose.BLUE`/`RED` recommend over their non-`_MEGATAG2` counterparts.

## The tradeoff

|                                               | MegaTag1                      | MegaTag2                                                                   |
| --------------------------------------------- | ----------------------------- | -------------------------------------------------------------------------- |
| Data required                                 | Visual only (single AprilTag) | AprilTag + robot heading, submitted every loop                             |
| Accuracy at range / oblique angles            | Lower                         | Higher                                                                     |
| Setup complexity                              | None beyond camera offset     | Must call `withRobotOrientation` every periodic loop before reading a pose |
| Fails silently if orientation isn't submitted | N/A                           | **Yes** — stale/inaccurate poses with no error                             |

## Using MegaTag1

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

No per-loop orientation submission needed.

## Using MegaTag2

```java
LimelightPoseEstimator estimator = limelight.createPoseEstimator(EstimationMode.MEGATAG2);

// Every periodic loop, BEFORE reading a pose estimate:
limelight.getSettings()
         .withRobotOrientation(new Orientation3d(gyro.getRotation3d(),
                                                  new AngularVelocity3d(DegreesPerSecond.of(0),
                                                                        DegreesPerSecond.of(0),
                                                                        DegreesPerSecond.of(0))))
         .save();

Optional<PoseEstimate> estimate = estimator.getPoseEstimate();
```

If your gyro doesn't report angular velocity per-axis, passing zeros for pitch/roll rate is fine — only yaw rate meaningfully affects MegaTag2's fusion, and even that is optional in most drivetrains.

## See Also

* [AprilTag Pose Estimation tutorial](/documentation/tutorials/apriltag-pose-estimation.md)
* [Pose Estimation & Ambiguity](/documentation/understanding/pose-estimation-and-ambiguity.md)
* [AprilTag & MegaTag2 Localization Tuning](/documentation/tuning/apriltag-and-megatag2-tuning.md) — the full `ImuMode` breakdown and assist alpha tuning.
* LimelightSettings.ImuMode — for Limelight 4's internal IMU fusion options.


---

# 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/documentation/how-to-guides/how-do-i-choose-megatag1-vs-megatag2.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.
