> 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/tutorials/basic-setup.md).

# Basic Setup

This tutorial creates a `Limelight`, configures it, and reads its 2D target data — the minimum setup for any pipeline type.

## 1. Install YALL

See [How do I install YALL?](/documentation/how-to-guides/how-do-i-install-yall.md) if you haven't added the vendordep yet.

## 2. Create the Limelight object

Create one `Limelight` per physical camera, named after its NetworkTables table (the name shown in the Limelight web UI, usually `limelight`):

```java
import limelight.Limelight;

Limelight limelight = new Limelight("limelight");
```

{% hint style="info" %}
Construction checks that the camera's NT table exists (skipped in simulation) and raises a WPILib `Alert` if it doesn't. Do this once, in your subsystem constructor — not in `periodic()`.
{% endhint %}

## 3. Configure it

`getSettings()` returns a chainable configuration object. Every `.withXXXX()` call applies immediately and returns `this`:

```java
import limelight.networktables.LimelightSettings.LEDMode;
import edu.wpi.first.math.geometry.Pose3d;

limelight.getSettings()
         .withLimelightLEDMode(LEDMode.PipelineControl)
         .withCameraOffset(Pose3d.kZero)
         .save();
```

`withCameraOffset` sets where the camera physically sits relative to robot center — get this right, since MegaTag pose estimation is only as accurate as this offset. See [LimelightSettings & Pipelines](/documentation/understanding/limelight-settings-and-pipelines.md) for the full option list.

## 4. Read 2D target data

For simple aiming (turn-to-target, distance-to-target), `getData().targetData` gives you crosshair-relative offsets without any pose estimation:

```java
if (limelight.getData().targetData.getTargetStatus()) {
    double tx = limelight.getData().targetData.getHorizontalOffset();
    double ty = limelight.getData().targetData.getVerticalOffset();
    // turn toward tx, adjust range using ty
}
```

Always check `getTargetStatus()` before trusting `tx`/`ty` — they hold stale values when no target is visible.

## Next steps

* [AprilTag Pose Estimation](/documentation/tutorials/apriltag-pose-estimation.md) — fuse MegaTag2 into your robot's pose estimator.
* [Object Detection](/documentation/tutorials/object-detection.md) — read neural classifier/detector results.
* [How do I choose between MegaTag1 and MegaTag2?](/documentation/how-to-guides/how-do-i-choose-megatag1-vs-megatag2.md)
* [Tuning Workflow Overview](/documentation/tuning/tuning-workflow-overview.md) — once basic setup works, this is the recommended order for getting accurate, reliable results out of whichever pipeline you're using.


---

# 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/tutorials/basic-setup.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.
