EKF Flags LUA scripting

Hi,

Can someone assist me in creating a new Lua binding, for the EKF flags?

I want to create my own neopixel notification led light, for signaling when the copter will accept loiter mode. As i can see, it won’t do that until all EKF flags are ok. Usually the pos_horiz_abs is the slowest at going from red to white.

image

Alternatively, where can i find the documentation behind “pos_horiz_abs” - i want to know what values it is using to detemine if it is happy or not.

Enable fences, and you’ll get a prearm check for position. No need for scripting.

Do a text search of “prearm” in this source file for most of the reasons for EKF prearm check failures:

1 Like

If your GPS is frequently causing prearm failures, you can relax GPS_HDOP_GOOD.

Interesting!

So I could enable fences, then use the Lua binding “arming:pre_arm_checks()” to get feedback on whether the system is ready to arm :smiley:

The EKF calculations going on for determining if the pos_horiz_abs is good or not was more complex than expected :sweat_smile:

If you enable fences (even if none are uploaded), the copter will refuse to arm in any mode until the position flags are valid. You don’t need to script anything, as the LED status will continue to flash yellow for failed prearm checks until all pass. You’ll also get periodic GCS messages stating the same if Yaapu telemetry is present or a GCS is connected.

1 Like

I understand!

The reason I want to use Lua scripting is to create custom led signals that tell me very specific things during flight.

I tested your solution today, using fences and the prearm lua function, and it worked beautifully.

Thanks!

1 Like