# SquIDF

A `SquIDF` controller is a variation of the `PIDF` controller that square roots the positional error term. Effectively, it extends the `PIDF` class, and overrides the `calculateOutput` method. This modification changes how the controller responds to errors of different magnitudes.

#### Key Differences from PIDF

| Aspect                    | PIDF                        | SquIDF               |
| ------------------------- | --------------------------- | -------------------- |
| **Proportional Response** | Linear with error           | Square root of error |
| **Large Errors**          | Stronger correction         | Moderate correction  |
| **Small Errors**          | Generally weaker correction | Stronger correction  |
| **Response Curve**        | Straight line               | Curved (sub-linear)  |

`SquIDF` helps reduces overshoot (since the square root dampens aggressive corrections when initial error is high), and generally gives a smoother approach. However, like a PID/PIDF, tuning is critical. The controller is only as good as you can tune it.

#### Usage Example

```java
// Create SquIDF controller with same gains as PIDF
SquIDFController squidfController = new SquIDFController(
    1.0,  // kP
    0.1,  // kI
    0.05, // kD
    0.2   // kF
);

// Use just like a PIDF controller
squidfController.setSetPoint(targetPosition);
double output = squidfController.calculate(currentPosition);
```

#### Tuning Notes

* **kP values** will typically need to be **higher** than in PIDF since √(e) < e for errors > 1
* Start with your PIDF gains and increase kP gradually
* The I, D, and F terms work pretty much identically to PIDF


---

# 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.seattlesolvers.com/features/controllers/squidf.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.
