Commit Graph

29 Commits

Author SHA1 Message Date
Michael du Breuil 53cbd86cbe AP_Scripting: Fix the lua scheduling rate to be referenced from the
start of the update

This allows specifying a return value like "return update, 10" to run
at a near perfect 100Hz, where as before it would be run 10 ms after the
script had completed it's loop, which can be highly variable as the
script experiences interupts from the system, as well as needing the
script author to take responsibility for calculating the desired update
rate at the end. This was always intended to be fixed, but I pushed it
back during the initial development, however people are begining to run
scripts that have enough processing, or are rate sensitive enough that
we are now needing to start correcting this, or scripts will have to do
their best to guess the time, which will be inferior to us providing it.

As a note if you exceeded the time expected we will be rescheduling the
script immediately, thus it will have a schedule time in the past and
will be slotted in. This can't indefinetly starve other scripts as they
will still be slotted in, but if you request an update in 1 ms, but took
100ms to run we will simply slide you back into the queue 1ms after when
you started running.
2020-11-17 10:19:13 +11:00
Iampete1 97b44dfe71 AP_Scripting: add DIR_DISABLE param 2020-10-28 19:22:45 +11:00
Rishabh bd7190767e AP_Scripting: Create scripts folder automatically 2020-06-20 21:39:06 +10:00
Andrew Tridgell 2c6fd13899 AP_Scripting: auto-build the bindings 2020-05-12 19:55:21 +10:00
Michael du Breuil 75b133926f AP_Scripting: Cleanups to remove false posive warnings 2020-03-28 21:16:09 +11:00
Andrew Tridgell 5047eb88e2 AP_Scripting: use @ROMFS 2020-03-28 15:28:03 +11:00
Andrew Tridgell ebec738b88 AP_Scripting: enable lua scripts in ROMFS 2020-03-28 15:28:03 +11:00
Andrew Tridgell a91c587ef3 AP_Scripting: use new DirHandle for directory listings 2020-03-28 15:28:03 +11:00
Peter Barker 19249a13fd AP_Scripting: tell the user where their scripts directory is on failure 2020-03-10 08:43:03 +09:00
Michael du Breuil d7a59bc449 AP_Scripting: Reduce the sleep time with no scripts
Lowering the sleep time when no scripts are pending, causes starting a
REPL session to respond much faster (this cuts the latency from up to 10
seconds to 1 second before the session is ready to start).

Also lowers the default scripting debug level to hide the statustext
from users, as in the general case this is just a spammy message if it
occurs, and we should be finding better reporting bits to get this to
the user.
2020-02-19 13:24:23 -07:00
Michael du Breuil cf06beb1e6 AP_Scripting: Add support for REPL over MAVLink 2020-02-18 17:23:22 -07:00
Michael du Breuil c1a599d0bd AP_Scripting: Reduce memory associated with the sandbox 2020-02-18 10:38:09 +11:00
Michael du Breuil 0e70eabdb9 AP_Scripting: Send lua errors to the console before status_text
This helps SITL where we frequently panic about to long a statustext,
which means a user never sees the intresting part unless they comment
out the sanity check, or run on a real board.
2020-01-16 17:54:30 -07:00
Michael du Breuil 9fe2c02079 AP_Scripting: Don't restart scripts if it panic'd during the initial VM creation 2019-12-05 15:08:43 -07:00
Andrew Tridgell 83eeca2586 AP_Scripting: fixes for modified AP_ROMFS API
need to use AP_ROMFS::free()
2019-10-24 22:03:43 +11:00
Michael du Breuil cf94a02207 AP_Scripting: Stop running scripts if the enable flag ever goes false 2019-10-15 15:35:12 -06:00
Andrew Tridgell b577787f68 AP_Scripting: use AP_Filesystem API 2019-08-27 15:40:43 +10:00
Michael du Breuil 7fdc9fef12 AP_Scripting: Garbage collect after each run of a script
For some reason this resolves a memory leak in a tight loop of file
open, close. This also extends the memory debug printing to be a bit
more useful.
2019-08-27 13:54:54 +10:00
Randy Mackay 0e9688a4e1 AP_Scripting: resolve gcs::send_text compiler warning 2019-07-29 09:23:13 +09:00
Michael du Breuil 0054544bd3 AP_Scripting: Add support for enums to be passed through 2019-07-19 09:34:05 +09:00
Michael du Breuil d7e71f85b8 AP_Scripting: Add a debug level param 2019-04-11 23:03:20 -07:00
Michael du Breuil e7d59514d9 AP_Scripting: Add an initial generator 2019-04-11 23:03:20 -07:00
Michael du Breuil b45970fded AP_Scripting: Add location and ahrs user data 2019-02-01 14:31:05 -07:00
Michael du Breuil c191789651 AP_Scripting: Use dedicated heap 2018-12-31 19:25:23 -07:00
Michael du Breuil 0ede7b7d39 AP_Scripting: Catch lua panics 2018-11-26 22:32:56 +00:00
Michael du Breuil 2afe72d79f AP_Scripting: Swap reschedule to be callback, delay 2018-11-14 01:41:35 +00:00
Michael du Breuil ecb1a433b1 AP_Scripting: Add more runtime sanity checks 2018-11-14 01:41:35 +00:00
Michael du Breuil 40d5e233d4 AP_Scripting: Autostart all scripts in a given folder 2018-11-14 01:41:35 +00:00
Michael du Breuil 19a8c5a6ed AP_Scripting: Run multiple scripts at once 2018-11-14 01:41:35 +00:00