Commit Graph
483 Commits
Author SHA1 Message Date
Iampete1 55c09f57f8 AP_Scripting: bindings: RangeFinder: update range check on setting rangefinder state 2026-08-26 17:54:30 +10:00
Peter Hall 7668c24104 AP_Scripting: add airspeed driver bindings 2026-07-29 20:16:37 +01:00
Peter Barker 9d9b5c5436 AP_Scripting: add ahrs:get_wind binding
Unlike ahrs:wind_estimate() this returns nil when the vehicle has no
valid wind estimate, rather than handing out a vector which may be zero
or stale.
2026-07-28 13:48:28 +10:00
Peter Barker 630372253a AP_Scripting: add manual binding for ahrs:wind_estimate
The Vector3f-returning AP_AHRS::wind_estimate() method is about to be
removed from the AHRS interface.  Scripting has no way of receiving
both the vector and the validity flag from AP_AHRS::get_wind(), so
provide the old shape as a compatibility binding here rather than
keeping a method in AP_AHRS purely for scripting's benefit.

No change to the Lua API.
2026-07-28 13:48:28 +10:00
Andy Piper 746e90cc18 AP_Scripting: exclude OSD bindings from AP_Periph builds
pre-commit / ci (push) Canceled after 0s
test scripts / build (astyle-cleanliness) (push) Canceled after 0s
test scripts / build (check_autotest_options) (push) Canceled after 0s
test scripts / build (logger_metadata) (push) Canceled after 0s
test scripts / build (param-file-validation) (push) Canceled after 0s
test scripts / build (param_parse) (push) Canceled after 0s
test scripts / build (python-cleanliness) (push) Canceled after 0s
test scripts / build (shellcheck) (push) Canceled after 0s
test scripts / build (validate_board_list) (push) Canceled after 0s
test scripting / test-scripting (push) Canceled after 0s
AP_Periph does not build AP_OSD, but OSD_ENABLED defaults to 1 so the
generated bindings failed to link with undefined references to
AP_OSD::_singleton
2026-07-24 11:22:29 +01:00
Andy PiperandIampete1 584007f865 AP_Scripting: add OSD bindings and add semaphore protection for scripting bindings
Co-Authored-By: Iampete1 <iampete@hotmail.co.uk>
2026-07-24 11:22:29 +01:00
Andy PiperandIampete1 af61458600 AP_Scripting: generator: add get keyword for custom pointer string
Co-Authored-By: Iampete1 <iampete@hotmail.co.uk>
2026-07-24 11:22:29 +01:00
Yuri Rage 4eabe72949 AP_Scripting: add is_crashed binding and applet 2026-07-07 08:33:58 +09:00
Ben ButterworthandPierre Kancir 81f23dbd75 AP_Scripting: add send_named_int function
Co-authored-by: Pierre Kancir <pierre.kancir.emn@gmail.com>
2026-06-27 08:07:35 +10:00
Pierre Kancir f9f4726ca4 AP_Scripting: update how generate docs 2026-06-17 14:36:22 +10:00
Peter Barker 13ab85a5af AP_Scripting: allow script-defined gimbals to specify target types
this allows a script which converts ArduPilot targets into a wire protocol to send to a gimbal to tell ArduPilot what sorts of targets the script/gimbal can understand.

For example, if the gimbal being controlled can understand a lat/lng/alt, the script can tell ArduPilot that with the new method call.
2026-04-07 10:44:42 +10:00
Andy Piper f06b568151 AP_Scripting: return alt frame from safe alt fence bindings
Update get_safe_alt_min and get_safe_alt_max bindings to also return
the altitude frame as a second return value. Existing callers are not
broken as Lua silently discards extra return values.
2026-03-24 10:44:04 +11:00
Iampete1 ce6d78c653 AP_Scripting: Add bindings to allow updating servo telem 2026-02-10 10:21:16 +11:00
Andy Piper 9562c98f84 AP_Scripting: allow vehicles to yaw to target
docs for set_target_velocity_NED()
add set_target_angle_and_rate_and_throttle() for precise vehicle control
manual binding for set_target_velocity_NED() to allow optional boolean
update docs for attitude control
2025-12-17 16:31:37 +00:00
Andy Piper a14116f64a AP_Scripting: add get_throttle_in() to scripting 2025-12-17 16:31:37 +00:00
Thomas Watson a550087eee AP_Scripting: generator: dynamically create userdata metatables
The `luaL_testudata` and `luaL_checkudata` functions correctly treat the
absence of a metatable for the type to check as the type not matching,
so there is no need to have the type's metatable in memory until an
object using it exists. Therefore we can defer the metatable's creation
until the first time an object of that type is created.

Saves some 4500 bytes of Lua heap RAM, at least if no such objects are
created. The created metatables are shared between all scripts, so there
is no increase in the total RAM usage if all objects are used. However,
there is some increased risk of heap fragmentation and unexpected
out-of-memory errors on rarely used code paths.

It would be nice to construct the object in the new utility function,
but it's not possible in C++ to take the address of a constructor.
Instead passing in a lambda is ugly, hardly any more efficient, and
screws up constructors which take parameters.

Also optimizes by using the generated userdata creators where possible,
and convincing the compiler to omit unnecessary checks.
2025-12-16 11:13:16 +11:00
Thomas Watson 00a2b76779 AP_Scripting: generator: dynamically create ap_object metatables
The `luaL_testudata` and `luaL_checkudata` functions correctly treat the
absence of a metatable for the type to check as the type not matching,
so there is no need to have the type's metatable in memory until an
object using it exists. Therefore we can defer the metatable's creation
until the first time an object of that type is created.

Saves some 1500 bytes of Lua heap RAM, at least if no such objects are
created. The created metatables are shared between all scripts, so there
is no increase in the total RAM usage if all objects are used. However,
there is some increased risk of heap fragmentation and unexpected
out-of-memory errors on rarely used code paths.
2025-12-16 11:13:16 +11: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 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
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
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
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
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
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
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
Peter Barker 9b240db037 AP_Scripting: add a binding for set_alt_m 2025-10-11 12:39:41 -05:00
Tim Tuxworth 6b4743f027 AP_Scripting: plane_follow.lua applet 2025-10-07 11:48:50 +11: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
Tom Pittenger 08b209d340 AP_Scripting: fix periph:get_vehicle_state to be 64 bit 2025-09-29 15:16:23 +10:00
Iampete1 064655cb4a AP_Scripting: add binding for UART set_unbuffered_writes 2025-09-15 18:18:55 -05:00
Iampete1 5f33bc7af8 AP_Scripting: update esc_telem:update_rpm method to use float 2025-09-15 18:18:55 -05:00
Andrew Tridgell 3393fa2ed9 AP_Scripting: added is_pending() method on sockets
allows for non-blocking TCP connections
2025-09-03 15:17:39 +01:00
Tim Tuxworth cc0b8164d2 AP_Scripting: scripted arming checks 2025-08-16 19:55:15 +01:00
Peter Barker 4e7e417dc3 AP_Scripting: add test for NAMED_VALUE_STRING 2025-08-10 08:38:08 +10:00
Andrew Tridgell 086472de8f AP_Scripting: added an add_route() binding
allows custom network routes
2025-07-13 13:31:59 +10:00
Yuri RageandThomas Watson e952d4b16b AP_Scripting: add net-ntrip applet
Co-authored-by: Thomas Watson <twatson52@mac.com>

Co-authored-by: Thomas Watson <twatson52@mac.com>
2025-06-20 19:44:33 -05:00
Abdulaziz 6b30f2cccb AP_Scripting: provide bindings for parity and stop bits 2025-06-07 18:51:00 -05:00
Peter Barker fa899c14cc AP_Scripting: new scripting bindings get_roll_rad
deprecate the old get_roll binding
2025-06-05 17:28:41 +10:00
Peter Barker c873d8bb53 AP_Scripting: rename AHRS get_roll etc accessors to include _rad 2025-06-05 17:28:41 +10:00
Peter Barker 3ec715e81c AP_Scripting: rename get_relative_position_NED_origin methods to include 'float'
can't have both postype and these methods, something has to shift names
2025-05-24 09:23:35 +09:00
Peter Barker 18ba475340 AP_Scripting: add param-set-filter LUA applet and bindings for same
AP_Scripting: add param-set.md to document new applet

with thanks to ChatGPT for the documentation!
2025-05-20 13:32:16 +10:00
Andrew Tridgell 4a442d3b20 AP_Scripting: support DroneCAN messaging in lua
allow for sending broadcast messages, subscribing to broadcast
messages and sending requests
2025-05-09 13:08:40 +10:00
Peter Barker bf8a9e5df4 AP_Scripting: add _cm to get_vector_from_origin_NEU
... and the _NE equivalent.

Moves us closer to using metres in interfaces.  Several places already *0.01 the result of these methods
2025-04-29 08:29:41 +09:00