← All tools

Message & Error Explainer

What an ArduPilot message means and what to do about it

Українська

A Lua script ran for too long in one go

WarningBoard, internal errors, CAN, scripting

What ArduPilot says:

Each time ArduPilot calls a script, the script may execute at most SCR_VM_I_COUNT Lua instructions (10000 by default, never fewer than 1000) before it hands control back. A script that goes over is stopped with “Lua: FILE exceeded time limit”, removed, and not run again. The limit keeps one script from taking the processor away from the others and from the flight code.

What to do, most likely first

  1. The applet is a heavy one, and its instructions give a higher SCR_VM_I_COUNT.

    CheckRead the applet's own page: the Lua Applet Catalog shows the parameters each one needs.

    FixSet SCR_VM_I_COUNT to the value the applet asks for and reboot.

  2. Your script does too much in one call: a long loop, a big table, a file read to the end.

    FixSplit the work over several calls: do a part, return, and continue on the next call.

  3. A loop in the script never ends.

    FixCorrect the loop's condition. A higher limit only makes such a script hang longer.

Parameters to look at

ParameterWhat it is
SCR_VM_I_COUNTScripting Virtual Machine Instruction Count
SCR_THD_PRIORITYScripting thread priority
The code that sends it

… exceeded time limit

libraries/AP_Scripting/lua_scripts.cpp lua_scripts::run_next_script() · Open in ArduPilot Copter-4.7.1

Written here for Copter 4.6. In the tool you choose your vehicle and version, see your own parameter values beside the ones named here, and drop a flight log to have every message in it explained.

Open it in the Message & Error Explainer