Commit Graph
1330 Commits
Author SHA1 Message Date
Andrew Tridgell 9456449a44 AP_Scripting: removed zero field in plane_precland.lua
always zero
2025-12-16 08:19:11 +11:00
Thomas Watson b6a31f28b0 AP_Scripting: logger: do proper uint64_t coercion
Allows all non-negative numbery things to be logged as type `Q`, instead
of just the `uint64_t` userdata.
2025-12-15 14:05:49 -06:00
Thomas Watson 28898bf348 AP_Scripting: logger: use existing check functions
Reduces size but changes error messages somewhat.
2025-12-15 14:05:49 -06:00
Thomas Watson b380b3f120 AP_Scripting: logger: fix spelling and format 2025-12-15 14:05:49 -06:00
Thomas Watson be6ffb5f61 AP_Scripting: logger: use snprintf for more efficient prepend
Contrary to the comment there is no scope issue.
2025-12-15 14:05:49 -06:00
Thomas Watson 005a7afd30 AP_Scripting: logger: use appropriate types and names
Avoids shenanigans with strings long enough to wrap a uint8_t.
2025-12-15 14:05:49 -06:00
Thomas Watson be52b644ea AP_Scripting: logger: clean up error handling returns
It is more efficient to have them.
2025-12-15 14:05:49 -06:00
Thomas Watsonandjschall a684486cb0 AP_Scripting: logger: use stack buffer
malloc is kinda slow and we were failing to free the memory in tandem
with its original allocated size, causing Lua to believe we still had
the bytes allocated. This created misleading stats and unnecessary GC
pressure, but no actual leak.

Fix by using a stack buffer half the buffer size we use in other
functions but still big enough for the maximum possible log message.

Co-authored-by: jschall <mr.challinger@gmail.com>
2025-12-15 14:05:49 -06:00
Thomas Watson 628ed68a21 AP_Scripting: factor non-templated definitions out of generated code
In some far future we may use a real templating language, but this makes
that code easier to edit today.
2025-12-10 14:39:14 -06:00
Thomas Watson 7a48bd363e AP_Scripting: mavlink: avoid crash on reinit with bigger size
The different size won't cause the `accept_msg_ids` array to be
reallocated, but it will still be zeroed up to its new size. If that's
bigger than the old one, then the heap gets corrupted, and mayhem and
destruction ensues.

Fix by only initializing the related data immediately on successful
allocation.
2025-12-09 00:58:33 +00:00
Thomas Watson 6dcd0889ca AP_Scripting: unify handling of legacy dot vs. colon calls
Push a dummy element on a dot call to make the stack look like the
generated bindings, which always expect the colon call (that pushes self
as the first argument) and the intended usage pattern.

Folds in `arg_offset = 1`. Note that none of these routines care about
the first argument as they were fine being called without it.
2025-12-09 00:56:31 +00:00
Thomas Watson fbf146fc35 AP_Scripting: fix spelling mistake in error message 2025-12-04 21:12:30 -06:00
Thomas Watson 3b93ae972b AP_Scripting: fix binding generator spelling mistakes 2025-12-04 21:12:30 -06:00
Andy Piper 83e2647b5e AP_Scripting: add access to more fence methods 2025-12-03 19:18:19 +00:00
Andrew Tridgell 92d6c292ca AP_Scripting: dynamic mixer example for X8 co-rotating frame 2025-12-02 11:16:21 +11:00
Peter Barker 27781c8f18 AP_Scripting: add a pair of warnings about using RC set_override method
had an instance where a script was using this override and didn't failsafe as expected
2025-11-28 18:26:08 +11:00
neo-0007 16a79f5554 AP_Scripting: add example script to test target location
Script to test location for all 7 modes of mount using the
AP_Scripting_Backend.

Signed-off-by: neo-0007 <hrishikeshgohain123@gmail.com>
2025-11-27 10:14:20 +11:00
Andrew Tridgell 150c0e0879 AP_Scripting: add arm error for no battery tag
if the user neglects to connect the battery tag give a clear error
message
2025-11-27 07:32:09 +11:00
Andy Piper 7ede7dc715 AP_Scripting: clean-up semaphore access for CRSF 2025-11-19 19:01:11 +11:00
Andy Piper 94bc8d86e3 AP_Scripting: add CRSF peek_menu_event() and pop_menu_event()
add CRSF send_response() method
2025-11-19 19:01:11 +11:00
Peter Barker 93f45acb45 AP_Scripting: rename airspeed methods on AHRS to include EAS or TAS
mixing these up has caused confusion in the past.

"estimate" could also be confused as to mean "synthetic", when it will often come from a sensor.
2025-11-17 18:46:52 -06:00
Stephen Dade d256a73ee7 AP_Scripting: Add Rockblock 9704 Lua script 2025-11-17 19:18:42 +11:00
Iampete1 790c735999 AP_Scripting: allow scripting report power percentage ESC telem 2025-11-16 11:44:35 +11:00
Iampete1 1c3784c575 AP_Scripting: allow adding depends keyword to fields 2025-11-16 11:44:35 +11:00
Iampete1 38e8f23302 AP_Scripting: Periph bindings get_yaw_earth and get_vehicle_state should depend on AP_PERIPH_NOTIFY_ENABLED 2025-11-16 11:11:33 +11:00
George Zogopoulos a730781de7 AP_Scripting: param-set.lua: Add missing enum 2025-11-05 08:50:25 -06:00
Andy Piper c5540252e4 AP_Scripting: add get_breach_direction_NED() to lua bindings
optionally return last breach position
2025-11-05 18:24:54 +11:00
muramura 3655c5066d AP_Scripting: Change the maximum and minimum values of the type to named constants 2025-11-05 18:05:53 +11:00
Ryan Friedman 888456786d AP_Scripting: Add GPS switch script
* Use this script and an Aux switch to change the primary GPS for the
  EKF

Signed-off-by: Ryan Friedman <25047695+Ryanf55@users.noreply.github.com>
2025-11-04 09:48:56 +11:00
Bob Long 36b54e6e48 AP_Scripting: examples: add fake camera tracking 2025-10-24 13:54:38 +11:00
Andrew Tridgell 3a14f4a52d AP_Scripting: added throttle_kill applet
for killing turbine engines that rely on low PWM (below SERVO3_MIN) to
kill the engine
2025-10-22 19:51:27 +11:00
AlexisMGL 68636140f8 AP_Scripting: fix behavior when when PLND_XY_DIST_MAX=0 2025-10-22 18:21:06 +11:00
Dr.-Ing. Amilcar do Carmo Lucas 73a62004e4 AP_Scripting: fix LTE_MCCMNC documentation metadata 2025-10-21 11:20:03 +02:00
Michael du Breuil 0f0a30bb94 AP_Scripting: Correct INF EFI temperatures
They were being reported as C, while the driver expects them to be in
Kelvin. This causes it to get sent to the GCS as the wrong unit.
Correcting the named value float pairs is not required as they are not a
part of a standard, so we can safely leave them in degrees C.
2025-10-21 11:42:34 +11:00
Bob Long fbe0e49f0e AP_Scripting: fix UltraMotion servo mask bug
This script only worked if setting some N number of consecutive bits,
starting from the LSB. The # operator does NOT get the number of
elements in a table, unless that table is strictly an array.
2025-10-21 10:23:51 +11:00
Bob Long 194da2d257 AP_Scripting: fix UltraMotion docs 2025-10-21 10:23:51 +11:00
Oleksiy Protas 979142b953 AP_Scripting: serial begin() automatic baud rate
If the baud rate is omitted or nil, use the HAL-derived value
which usually is taken from the corresponding parameter.
2025-10-20 23:05:47 +02:00
Iampete1 ed8c82a1f2 AP_Scripting: Docs: update BattMonitorScript_State_ud comments 2025-10-20 15:36:27 -05:00
Randy Mackay 08eaef9fcb AP_Scripting: message_interval gets more messages 2025-10-19 18:11:42 +11:00
Peter Barker 2322ea7a7f AP_Scripting: have param-set.lua send PARAM_ERROR messages 2025-10-18 11:50:33 +11:00
Thomas Watson da676fd438 AP_Scripting: fix gcs:set_message_interval port range
Despite the implications of the example and the
`MAVLINK_COMM_NUM_BUFFERS` limit in the description, the actual first
argument to this function is the serial port number.

Correct the argument range to allow any possible port number (no need to
limit as the list is sparse) and enhance the example to give more port
numbers.
2025-10-13 22:48:12 -05:00
Andrew Tridgell 210f0b7e53 AP_Scripting: added CAN_playback.lua
used to play back a log captured using CAN_Pn_OPTIONS=1
2025-10-14 12:56:57 +11:00
Andrew Tridgell 691e559db4 AP_Scripting: fixed a memory leak in socket recv()
we need to allocate the memory in the lua heap, otherwise a failure
leaks global memory
2025-10-14 12:56:41 +11:00
Iampete1 f44cefd0e4 AP_Scripting: regenerate MAVLink message definitions 2025-10-14 10:34:11 +11:00
Peter Barker 9b240db037 AP_Scripting: add a binding for set_alt_m 2025-10-11 12:39:41 -05:00
Tim Tuxworth ae038a5886 AP_Scripting: update plane_flllow.md documentation 2025-10-11 08:19:10 +02:00
Tim Tuxworth 6b4743f027 AP_Scripting: plane_follow.lua applet 2025-10-07 11:48:50 +11:00
George Zogopoulos 6f188f5427 AP_Scripting: Added VSPeak Modell flow meter driver
Changest tested with Kyle

Updated script

Fixed documentation errors

Added VSPF_MODE

Fixed type casting

Added VSPF_PORT to choose serial port

Updated documentation

Fixed wrong handling of sensor mode

Some changes to hopefully get better data parsing

Fixed bugs
2025-10-02 08:34:54 +10:00
Peter Barker e783bb4ab8 AP_Scripting: add define so user can omit AP_Vehicle bindings 2025-10-01 18:05:38 +10:00
Peter Barker da93d1467c AP_Scripting: add define so user can omit AP_Motors bindings 2025-10-01 18:05:38 +10:00