> For the complete documentation index, see [llms.txt](https://docs.theseus.us/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.theseus.us/cyclops/autopilot-integration/optional-improvements/dead-reckoning-switch.md).

# Dead Reckoning Switch

Theseus provides a Lua script that allows pilots to disable GPS position in the EKF with a 2- or 3-position RC switch. Disabling this position input allows your UAV to dead reckon using the EKF sensor data with Cyclops providing localized position updates. The script does this by setting the value of the `EK3_SRC1_POSXY` parameter to 3 (GPS) or 0 (Disabled).

Upload the script below to ArduPilot to enable this functionality:

{% file src="/files/nngOs64ezxqeXdTFK1WT" %}

### Configuring an RC Switch

Select which switch on your controller you want to use and identify its corresponding RC channel in your mixing model. On your GCS software, set the corresponding RC option to Scripting 4 (value 303). *For example, if your switch is on RC channel 7, set* `RC7_OPTION = 303`.

{% hint style="info" %}
To enable this script in ArduPilot, set `SCR_USER2=1` in the Full Parameters List. To prevent the script from running, set this parameter to 0.
{% endhint %}

{% hint style="warning" %}
Note: The script functionality is hardcoded to Scripting 4 (value 303) within the provided Lua script. If you are using multiple Lua scripts on the same flight controller, make sure that those scripts do not use Scripting 4.
{% endhint %}

### Switch Positions

* **LOW / MID**: GPS position source **enabled** (`EK3_SRC1_POSXY = 3`)
* **HIGH**: GPS position source **disabled** (`EK3_SRC1_POSXY = 0`)

### Startup Behavior

On boot, the script reads the current switch position and immediately sets EK3\_SRC1\_POSXY to match. If the switch is in the HIGH position when the flight controller boots, GPS position will be disabled as soon as the script initializes. If SCR\_USER2 is set to 0, the script will not run and EK3\_SRC1\_POSXY will remain at whatever value is set in your parameters.

{% hint style="success" %}
The script prints a status message to the GCS every 5 seconds indicating the current GPS position source state, so you can confirm the active configuration at a glance during flight.
{% endhint %}


---

# 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://docs.theseus.us/cyclops/autopilot-integration/optional-improvements/dead-reckoning-switch.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.
