# Validation

## Reading Validation

The AM Lidar provides multiple pieces of data with each measurement. To ensure your robot is making decisions based on reliable information, it is important to validate each reading before using it.

This section explains how to determine whether a measurement should be **accepted** or **rejected**.

## Overview

Each measurement includes:

* **Distance (mm)**
* **Status Code**
* **Peak Signal Strength**
* **Ambient Light Level**

A reading is considered reliable when:

* The sensor successfully completed the measurement
* The returned signal is strong enough
* The measurement is not dominated by noise

## Step 1: Check Status Code

The first and most important check is the **status code**.

<table><thead><tr><th width="97">Status</th><th width="271">Meaning</th><th>Action</th></tr></thead><tbody><tr><td>0</td><td>Range Valid</td><td>✅ Continue validation</td></tr><tr><td>1</td><td>Sigma Fail</td><td>❌ Reject</td></tr><tr><td>2</td><td>Signal Fail</td><td>❌ Reject</td></tr><tr><td>4</td><td>Phase Fail</td><td>❌ Reject</td></tr><tr><td>5</td><td>Hardware Fail</td><td>❌ Reject</td></tr><tr><td>7</td><td>Wrap Target</td><td>✅ Continue validation (Weak)</td></tr><tr><td>8</td><td>Processing Fail</td><td>❌ Reject</td></tr></tbody></table>

👉 **Only proceed if Status = 0 or 7**

**Status code 0 data should be trusted more than status code 7 data.**&#x20;

**Wrap Target indicates the device is near the limits of what the current tuning allows or the measurement is near 4 meters.**\
\
Step 2: Check Signal Strength

The **Peak Signal** represents how strong the reflected laser signal is.

* Higher values = stronger, more reliable readings
* Lower values = weak or distant targets

#### Recommended Threshold:

```
Peak Signal > 150 (centi-MCPS)
```

<table><thead><tr><th width="137">Peak Signal</th><th width="172">Interpretation</th></tr></thead><tbody><tr><td>> 300</td><td>Excellent</td></tr><tr><td>150–300</td><td>Good</td></tr><tr><td>&#x3C; 150</td><td>Weak ⚠️</td></tr></tbody></table>

👉 Reject readings with very low signal unless necessary

## Step 3: Check Ambient Light

The **Ambient** value represents background light/noise.

* Lower values = cleaner measurement
* Higher values = more interference

#### General Guidance:

```
Ambient < 100 (centi-MCPS) → Ideal
```

High ambient light can reduce measurement accuracy, especially at long range.

## Step 4: Evaluate Signal-to-Noise Ratio (SNR)

The most important quality metric is:

```
SNR = Peak Signal / Ambient
```

This compares the useful signal to background noise.

#### Recommended Threshold:

```
SNR > 1.5 → Acceptable
SNR > 2.0 → Good
```

<table><thead><tr><th width="181">SNR Value</th><th>Interpretation</th></tr></thead><tbody><tr><td>> 2.0</td><td>Reliable ✅</td></tr><tr><td>1.5–2.0</td><td>Usable ⚠️</td></tr><tr><td>&#x3C; 1.5</td><td>Unreliable ❌</td></tr></tbody></table>

## ✅ Final Acceptance Criteria

A measurement should be **accepted** if:

* Status == 0 or 7
* Peak Signal > 150
* SNR > 1.5

Otherwise, it should be rejected or treated with caution.

## ⚠️ Notes and Best Practices

* A reading marked “Range Valid” may still be noisy
* Long-range measurements naturally have lower signal strength
* Highly reflective or angled surfaces may affect readings
* Bright environments increase ambient noise

***

## 🧪 Practical Tip

When tuning your system:

* Watch how **Peak Signal** and **Ambient** change with distance
* Identify thresholds that work for your specific robot and field conditions

***

## 🎯 Summary

| Check       | Requirement       |
| ----------- | ----------------- |
| Status      | Must be 0         |
| Peak Signal | > 150 recommended |
| SNR         | > 1.5             |

👉 Use all three checks together for best reliability


---

# Agent Instructions: 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:

```
GET https://docs.andymark.com/frc-electronics/can-sensors/can-lidar-am-5684/validation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
