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:
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.
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.
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.
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.
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.
Last updated
