George Zogopoulos
2717470df1
AP_Scripting: Misc. small improvements.
...
Typo fix
Removed unused variable
2024-06-28 10:05:29 +10:00
Thomas Watson
6e0d7bddf1
AP_Scripting: add serial device simulation example
2024-06-27 12:00:18 +10:00
Thomas Watson
f9b138724c
AP_Scripting: add serial loopback test script
...
Tests that data can flow both ways with one end using protocol 28
(Scripting) and the other using the serial device simulation feature.
2024-06-27 12:00:18 +10:00
Thomas Watson
46e204dd6c
AP_Scripting: clear serial device sim buffers appropriately
...
Ensures the script won't process data created before it started, and
that the protocol won't process data created after the script stopped.
2024-06-27 12:00:18 +10:00
Thomas Watson
a077e4a3ed
AP_Scripting: introduce serial device simulation support
...
Allows a script to simulate a device attached via any serial protocol.
The script can read and write data and have it handled according to the
protocol as if exchanged over a serial port. The script can then do
protocol translation, data filtering and validation,
hardware-in-the-loop simulation, experimentation, etc., especially in
combination with the scripting protocol which lets the script itself
handle an attached device and so interpose any communication.
2024-06-27 12:00:18 +10:00
Thomas Watson
4df2a1bce7
AP_Scripting/generator: generate depends for manual functions on singletons
2024-06-27 12:00:18 +10:00
Thomas Watson
c18f9f733e
AP_Scripting: add writestring for serial
...
Enables more efficient scripting.
2024-06-27 12:00:18 +10:00
Thomas Watson
d93aa15f2a
AP_Scripting: refactor serial readstring
...
Using `luaL_Buffer` avoids the need for any heap allocation in the
common case (count <= 512 bytes) and avoids stressing out the system
heap for large reads, instead using the script heap.
Zero net flash usage change.
2024-06-27 12:00:18 +10:00
Thomas Watson
e18449b1b8
AP_Scripting: use generic access userdata for serial ports
...
Adding another layer instead of just exposing UARTDriver bindings allows
substitution of the different functions for device simulation later.
Also take the opportunity to rework the docs a little.
2024-06-27 12:00:18 +10:00
Thomas Watson
c37dba60de
AP_Scripting/generator: allow disabling userdata creation from Lua
...
Passing -1 to the argument count for the `creation` tag (name does not
matter) will stop the generator from giving Lua a function to construct
that userdata. The C `new_<name>` function still works.
2024-06-27 12:00:18 +10:00
Pierre Kancir
396bca359d
AP_Scripting: add an example to use Copter Standby mode in SITL with LUA
2024-06-27 10:11:53 +10:00
Andrew Tridgell
10c6020a66
AP_Scripting: update docs
2024-06-27 10:11:14 +10:00
Andrew Tridgell
d87404adfa
AP_Scripting: added mcu_temperature binding
2024-06-27 10:11:14 +10:00
Peter Barker
9bb343938f
AP_Scripting: correct use-after-free in script statistics
...
run_next_script can free the script if the script runs over-time.
... so stop using data from that freed script structure!
2024-06-25 11:07:07 +10:00
Iampete1
cc99ebf872
AP_Scripting: allow logging lua boolean with uint8 format `B`
2024-06-25 11:01:10 +10:00
Andrew Tridgell
32750476be
AP_Scripting: added more telemetry for INF Inject
2024-06-25 09:34:18 +10:00
Andrew Tridgell
b108d9cf09
AP_Scripting: added throttle and ignition control for INF_INject
...
allows full control over serial
2024-06-25 09:34:18 +10:00
TsuyoshiKawamura
b9bf7acbf1
AP_Scripting: add test samples of get_target_location/update_target_location for copter
2024-06-25 08:29:57 +09:00
Iampete1
a322ba4f77
AP_Scripting: add binding for GPS `time_epoch_usec`
2024-06-18 10:37:13 +10:00
Iampete1
1c26c241f1
AP_Scripting: add uint64 userdata
2024-06-18 10:37:13 +10:00
Iampete1
574b9939a5
AP_Scripting: allow auto generation of uint32 operators
2024-06-18 10:37:13 +10:00
Andrew Tridgell
c783f632c1
AP_Scription: added CANF logging to Halo6000 EFI driver
...
allows for easier debugging
2024-06-09 08:37:44 +10:00
Iampete1
1c5c80d244
AP_Scripting: Docs: remove stray grave
2024-06-08 07:29:53 +10:00
Iampete1
cb22a6389d
AP_Scripting: add virtual class in docs to avoid need nil check warning
2024-06-07 06:30:22 +10:00
Iampete1
364419be81
AP_Scripting: docs: allow overload of manual bindings to allow documentation of optional arguments
2024-06-04 09:29:49 +10:00
Iampete1
f54ca766df
AP_Scripting: tests: luacheck.lua: ignore lua-language-server
2024-06-04 09:29:49 +10:00
Iampete1
93642026aa
AP_Scripting: tests: check.json: check files it gitignore but not self
2024-06-04 09:29:49 +10:00
Andrew Tridgell
a2459c6e61
AP_Scripting: use NEW_NOTHROW for new(std::nothrow)
2024-06-04 09:20:21 +10:00
Andrew Tridgell
d305cb47f8
AP_Scripting: added GPS yaw binding
...
useful for seeing if switching to a GPS yaw source set in EK3 will work
2024-05-29 12:56:57 +10:00
Andrew Tridgell
bf9f3b8660
AP_Scripting: added notch_switch example
...
switch between two notch setups using attenuation change
2024-05-29 12:56:43 +10:00
petrosilius
1d810bfa6f
AP_Scripting: added tracker Pelco-D control script
...
This script uses the scaled output from the antennatracker servos and map them to corresponding Pelco-D messages to be sent via a RS-485 interface to a motorized base (can be anything from motorized tracker to a PTZ camera).
If your FCU doesnt offer a RS-485 interface by default, you can use or TTL-RS485- or USB-RS485-adapters.
Pelco-D allows to control using either speed-/differential- or absolute-control control of the pan-/tilt-axis.
Currently the script uses speed based control using by mapping the "ContinuousRotation" type servos outputs to the corresponding Pelco-D messages.
The absolute control messages are implemented nevertheless for future use.
The script assumes therefor at least the following parameters to be set:
SCR_ENABLE = 1
SERVO_PITCH_TYPE = 2 # ContinuousRotation type servo
SERVO_YAW_TYPE = 2 # ContinuousRotation type servo
SERIALx_PROTOCOL = 28 # serial port used by luascript
Additionally the PITCH2SRV and YAW2SRV tuning needs to be done as described by the antennatracker description.
Also keep attention to the PITCH_MIN, PITCH_MAX and YAW_RANGE parameters to fit your Pelco-D hardware!
2024-05-28 17:42:52 +10:00
Iampete1
f5e7bfcc48
AP_Scripting: remove support for REPL
2024-05-28 10:10:14 +10:00
Iampete1
713eda617f
AP_Scripting: allow new flow control type in `set_flow_control` binding
2024-05-28 09:48:19 +10:00
Iampete1
0c6f396438
AP_Scripting: docs: document all functions currently documented on the wiki
2024-05-22 18:13:53 +10:00
Iampete1
91cdea1a8d
AP_Scripting: examples: fault_handling.lua: ignore errors.
2024-05-21 09:42:22 +10:00
Iampete1
3a7bf8dd7d
AP_Scripting: ignore lua language check issues resulting from https://github.com/ArduPilot/ardupilot/pull/26939
2024-05-21 09:42:22 +10:00
Iampete1
d2e95583d6
AP_Scripting: docs: update
2024-05-21 09:42:22 +10:00
Iampete1
003ccc38c6
AP_Scripting: generator allow more types for uint32 prams and dont add class keyword to globals
2024-05-21 09:42:22 +10:00
Iampete1
cc159a44d5
AP_Scripting: tests: add config files for checks and docs generation
2024-05-21 09:42:22 +10:00
Iampete1
5bb5f442e1
AP_Scripting: ignore lua-language-server-errors
2024-05-21 09:42:22 +10:00
Andrew Tridgell
188df1312d
AP_Scripting: fixed float register save/restore in setjmp/longjmp
...
the register save must happen before the setjmp() call, which means
outside of the LUAI_TRY() macro. We also should be saving all 32
floating point registers
2024-05-15 06:47:44 +10:00
Andrew Tridgell
09df079c19
AP_Scripting: added example script that causes a hard fault
...
this exercises rapid fault handling
2024-05-15 06:47:44 +10:00
magate
a6995c93cc
AP_Scripting: allow revert of angular rate limits
2024-05-08 17:43:04 +10:00
Andrew Tridgell
bae5859a92
AP_Scripting: added copter_loiter_brake script
...
for automatic BRAKE mode when flying in LOITER in steep terrain
2024-05-07 19:39:39 +10:00
Iampete1
a8b4999d96
AP_Scripting: tests: enforce correct types in docs
2024-05-07 09:51:53 +10:00
Iampete1
aa7a1ce2a6
AP_Scripting: Docs: fix all type errors
2024-05-07 09:51:53 +10:00
Iampete1
a4a8923e1e
AP_Scripting: generator: add return count to manual bindings
2024-05-07 09:51:53 +10:00
Iampete1
439fcb7c46
AP_Scripting: update docs
2024-05-07 09:51:53 +10:00
Iampete1
6e75f7c80f
AP_Scripting: update docs generator to show ap_objects as possibly nil
2024-05-07 09:51:53 +10:00
Iampete1
95a5169439
AP_Scripting: CAN: `get_device` and `get_device2` return nil if no driver is configure with the correct protocol
2024-05-07 09:48:10 +10:00
Andrew Tridgell
e2767f899f
AP_Scripting: allow for 0x00 for 2nd checksum byte in INF_Inject driver
...
the device does send 0x00 sometimes and data is valid
2024-05-04 07:43:39 +10:00
Andrew Tridgell
c628e31c0a
AP_Scripting: fixed crc and added logging to INF_Inject driver
2024-05-02 12:17:49 +10:00
Peter Barker
d1de760ee4
AP_Scripting: enable AP_Scheduler for CubeOrange-periph-heavy
...
... we use the scehduler in AP_Motors, which is compiled when making heavy-periph
2024-05-01 17:53:44 +10:00
Andrew Tridgell
1cafe25854
AP_Scripting: improve INF inject driver
...
make it more robust to serial errors, and support correct checksum
2024-04-14 07:19:40 +10:00
Henry Wurzburg
b0decff44f
AP_SCripting: update VTOL QuickTune to allow YAW FLTE = 0
2024-04-09 09:31:42 +10:00
Peter Mullen
c0a8e6c96a
AP_Scripting: lua range finder driver that returns distances to a simulated sea floor for testing ArduSub surface tracking modes
2024-04-08 11:18:23 -03:00
Iampete1
dd4e212fbd
AP_Scripting: examples: update servo scan
2024-04-03 16:31:23 +09:00
Andrew Tridgell
1794c128a2
AP_Scripting: raise max FLTE for yaw to 8
...
better yaw for many vehicles
2024-04-02 10:28:34 +11:00
Peter Barker
bb83c43d1b
AP_Scripting: rename GPS_ to GPS1_
2024-03-19 19:50:12 +11:00
Andrew Tridgell
ece61c29d5
AP_Scripting: fixed NaN in path lookahead at end of schedule
...
this can happen at high speedups under SITL
2024-03-17 09:07:29 +11:00
Andrew Tridgell
6a8130e8ba
AP_Scripting: prevent "Starting XXX tune" happening multiple times
...
when filter setting disabled
2024-03-13 16:14:22 +09:00
Andrew Tridgell
b9fbc7d809
AP_Scripting: support precision loiter in quadplanes
...
and allow for moving landing target
2024-03-12 10:45:56 +11:00
Iampete1
90ad109047
AP_Scripting: Only try to make scripts directory if file write and directory is enabled
2024-03-12 08:52:38 +11:00
Andrew Tridgell
dc863d878a
AP_Scripting: fixed race condition in ship landing
...
and fixed lua warnings
2024-03-06 09:39:51 +11:00
Andrew Tridgell
c210675e95
AP_Scripting: added plane_precland lua script
2024-03-06 09:39:51 +11:00
Andrew Tridgell
fa1d965224
AP_Scripting: added docs for precland
2024-03-06 09:39:51 +11:00
Andrew Tridgell
bac99dc7ac
AP_Scripting: added bindings for AC_PrecLand
2024-03-06 09:39:51 +11:00
Andrew Tridgell
9ea8e61cfc
AP_Scripting: example showing how to use readstring method
...
a fairly common requirement for scripts
2024-02-28 19:05:58 +11:00
Randy Mackay
07cd050f63
AP_Scripting: EKF source switching for ExtNav and optflow
2024-02-28 18:52:37 +11:00
Randy Mackay
f2b66fd179
AP_Scripting: add VisualOdom bindings
2024-02-28 18:52:37 +11:00
Andrew Tridgell
23f2621685
AP_Scripting: improved dual log handling
...
allow sync of PTHT messages between vehicle logs
2024-02-27 21:10:01 +11:00
Iampete1
c7d543f9af
AP_Scripting: only try to load from ROMFS if `HAL_HAVE_AP_ROMFS_EMBEDDED_LUA` is defined
2024-02-27 11:09:08 +11:00
Peter Barker
53fd9056d8
AP_Scripting: use AP_ARMING_ENABLED and AP_COMPASS_ENABLED
...
... in place of periph-specific checks
2024-02-27 11:02:48 +11:00
Iampete1
b7dd432409
AP_Scripting: allow loading moduels from ROMFS
2024-02-27 10:17:43 +11:00
Clyde McQueen
b486c1cb46
AP_Scripting: expose sub rangefinder methods
2024-02-21 18:59:20 -03:00
Andrew Tridgell
f8097379cb
AP_Scripting: prevent a code path to abort() in scripting
...
if scripting can't find an error handler it can call abort(). We don't
ever want to do that in ArduPilot
2024-02-21 12:09:48 +11:00
Andrew Tridgell
b3240ac243
AP_Scripting: use gmtime_r() instead of gmtime()
...
using gmtime_r makes gmtime thread safe
2024-02-21 12:09:48 +11:00
Iampete1
5907e49cb1
AP_Scripting: ensure that all pass by refence values are initialized
2024-02-20 11:05:36 +11:00
Andrew Tridgell
303c33411f
AP_Scripting: fixed pitch param reversion in revert_param.lua
2024-02-19 09:41:18 +11:00
Peter Barker
2263dced74
AP_Scripting use scheduler semaphore only if AP_SCHEDULER_ENABLED
2024-02-15 12:17:07 +11:00
Iampete1
46e4588cf7
AP_Scripting: add file system crc32 binding
2024-02-15 07:36:39 +11:00
Peter Barker
40f0001aea
AP_BattMonitor: fix compilation when scripting in but scripted-battery out
...
Co-authored-by: Peter Hall <33176108+IamPete1@users.noreply.github.com>
2024-02-14 23:43:18 +11:00
Peter Barker
3f34eb12b0
AP_Scripting: include extern-hal line to fix compilation
...
this external line was coming in from a header file somewhere...
2024-02-13 20:57:12 +11:00
Andrew Tridgell
5d789f46ea
AP_Scripting: prevent double close in web server
2024-02-13 12:40:14 +11:00
Andrew Tridgell
7b36adf49d
AP_Scripting: prevent re-use of closed socket
...
this prevents a null pointer dereference after a close of a network
socket
2024-02-13 12:40:14 +11:00
Richard Marko
04b46678a4
treewide: fix shebangs - /bin/bash -> /usr/bin/env bash
...
Most scripts/tools use non-portable `/bin/bash`, switch
to environment agnostic `/usr/bin/env bash`.
2024-02-13 11:36:23 +11:00
Peter Barker
bb8047c026
AP_Scripting: correct compilation with AP_FILESYSTEM_FORMAT_ENABLED is false
...
Co-authored-by: Peter Hall <33176108+IamPete1@users.noreply.github.com>
2024-02-12 09:38:29 +11:00
Hayden Donald
52409d6765
AP_Scripting: Add gyro/accel consistency checks to lua
...
Added the accels_consistent and gyros_consistent methods to the lua bindings
2024-02-09 18:54:43 +11:00
Hayden Donald
c259d11cd6
AP_Scripting: Add getting of gyro/accel values
...
Added the ability to get gyro/accel from LUA
2024-02-08 15:24:12 +11:00
Hayden Donald
baf8958ee0
AP_Scripting: Add send_text to display binding
...
Added a notify:send_text and notify:release_text binding to override the text displayed on a display with custom text
2024-02-07 23:52:30 +00:00
Hayden Donald
14aea255e6
AP_Scripting: Add calibrating method
...
Add the calibrating method to lua so we can see if the device is currently calibrating
2024-02-07 18:36:33 +11:00
Hayden Donald
85a8b6c414
AP_Scripting: Add filesystem format
...
Added the ability to format the SD card from LUA
2024-02-07 18:35:36 +11:00
Peter Barker
bed976a8fc
AP_Scripting: add and use AP_BATTERY_ENABLED
2024-02-06 11:01:02 +11:00
Andrew Tridgell
4f182f3194
AP_Scripting: fixed parameter names
2024-01-23 15:00:30 +11:00
Andrew Tridgell
77877584f8
AP_Scripting: fixed example script
2024-01-23 15:00:30 +11:00
Andrew Tridgell
a0c2f5eadb
AP_Scripting: convert ALT_HOLD_RTL to RTL_ALTITUDE
2024-01-23 15:00:30 +11:00
Andrew Tridgell
8fd0bc6f6a
AP_Scripting: convert ARSPD_FBW_MIN/MAX to AIRSPEED_MIN and AIRSPEED_MAX
2024-01-23 15:00:30 +11:00
Andrew Tridgell
00eeac0551
AP_Scripting: convert remaining uses of TRIM_ARSPD_CM to AIRSPEED_CRUISE
2024-01-23 15:00:30 +11:00
Andrew Tridgell
c064e8eb5a
AP_Scripting: added docs for reboot in periph
2024-01-21 12:30:08 +11:00
Andrew Tridgell
c84459f518
AP_Scripting: added reboot() binding to AP_Periph
2024-01-21 12:30:08 +11:00