Commit Graph

50 Commits

Author SHA1 Message Date
Iampete1 596433a19a AP_Scripting: lua_scripts: add missing HAL_LOGGING_ENABLED define 2023-10-17 10:23:20 +11:00
Iampete1 7bbd4a7c7d AP_Scripting: add some missing dependencies 2023-09-26 11:29:42 +10:00
Peter Barker d519ab604e AP_Scripting: allow AP_SCRIPTING_ENABLED to come from hwdef files 2023-06-09 16:10:52 +10:00
bugobliterator 306b14d8dc AP_Scripting: add require with sandbox inheritence 2023-04-28 12:36:08 +10:00
Andrew Tridgell b45be75a98 AP_Scripting: use MultiHeap class 2023-01-16 09:19:16 +11:00
Iampete1 7e07859ec9 AP_Scripting: add debug print of state memory cost 2022-11-03 09:50:59 +11:00
Iampete1 815adbbc8e AP_Scripting: log memory cost of script load 2022-11-03 09:50:59 +11:00
Iampete1 da5ec973c5 AP_Scripting: add error message buffer semaphore 2022-08-31 17:04:24 +10:00
Iampete1 e2c29b09ab AP_Scripting: add arming check for failed scripts 2022-08-31 17:04:24 +10:00
murata c65425e3ac AP_Scripting: Changed NULL to nullptr 2022-06-07 11:59:23 +09:00
Iampete1 66cdfb015b AP_Scripting: always free the heap and remove scripts 2022-05-18 08:20:32 +10:00
murata 6e91b364e0 AP_Scripting: Console output can be disabled 2022-05-17 09:53:06 +10:00
Iampete1 9da80b45e9 AP_Scripting: load manual bindings via generator 2022-05-04 17:49:14 +10:00
Peter Barker ce312a3750 AP_Scripting: stop libraries including AP_Logger.h in .h files
AP_Logger.h is a nexus of includes; while this is being improved over
time, there's no reason for the library headers to include AP_Logger.h
as the logger itself is access by singleton and the structures are in
LogStructure.h

This necessitated moving The PID_Info structure out of AP_Logger's
namespace.  This cleans up a pretty nasty bit - that structure is
definitely not simply used for logging, but also used to pass pid
information around to controllers!

There are a lot of patches in here because AP_Logger.h, acting as a
nexus, was providing transitive header file inclusion in many (some
unlikely!) places.
2022-04-08 19:18:38 +10:00
Iampete1 427e8d1e24 AP_Scripting: add define option to disable interupts for the duration of script run 2022-02-02 11:33:46 +11:00
Peter Barker d72d0578a3 AP_Scripting: correct compilation when HAL_LOGGER_FILE_CONTENTS_ENABLED is 0 2021-12-07 09:36:48 +11:00
Iampete1 58ef0d0137 AP_Scripting: log files and runtime stats 2021-11-17 19:16:46 +11:00
Iampete1 817864ce74 AP_Scripting: convert DEBUG_LVL to DEBUG_OPTS bitmask 2021-11-17 19:16:46 +11:00
Iampete1 b047ea5c02 AP_Scripting: stop and restart scripting via command int 2021-11-02 17:33:34 +11:00
Iampete1 6aa8319b90 AP_Scripting: re-emmit error messages every 10 seconds if SCR_DEBUG_LVL > 0 2021-09-29 17:11:18 +10:00
murata 731fd7221f AP_Scripting: Only use messages that are useful for debugging 2021-09-10 20:46:33 +10:00
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