Commit Graph
1260 Commits
Author SHA1 Message Date
Peter Barker 55277a339e AP_Scripting: copter_terrain_brake: read aloud activation message 2025-07-29 21:23:39 +10:00
Andy Piper 7fbdfcee0a AP_Scripting: add stop method 2025-07-23 18:13:36 +10:00
Peter Barker ae48665948 AP_Scripting: add example which prints checksum of @SYS/flash.bin 2025-07-23 10:50:55 +10:00
Andrew Tridgell 318e6b9190 AP_Scripting: update HFE EFI driver script
added option to log all CAN frames for debugging new protocols
2025-07-22 13:02:52 +10:00
Peter Barker 3708936c62 global: correct shebang lines to refernce python3
also remove the odd encoding line which is not required in Py3
2025-07-22 10:45:57 +10:00
Joseph Stewart d9f1287c8b AP_Scripting: Use unified regex pattern for parameter parsing 2025-07-22 09:31:59 +10:00
Joseph Stewart c4ba818ca5 AP_Scripting: write full param lists without timeout 2025-07-22 09:31:59 +10:00
Joseph Stewart ada20e5224 AP_Scripting: Added comma delimited parameter files in param controller 2025-07-22 09:31:59 +10:00
Andrew Tridgell 90700977c5 AP_Scripting: added EFI_DLA64 driver
new protocol for updated EFI engine from DLA
2025-07-21 20:43:33 +10:00
Andrew Tridgell 55c8eee5a5 AP_Scripting: added BTAG_CUR_CYCLES
this can be used by another battery estimation lua script to adjust
for max number of cycles across all batteries
2025-07-17 21:15:30 +10:00
Thomas Watson 3e76fd681c AP_Scripting: drop utf8 string parsing and formatting
Difficult to imagine a use-case and substitutable with raw hex
characters.
2025-07-15 09:58:44 +10:00
Thomas Watson 81fdbae3ea AP_Scripting: remove utf8 library
Difficult to imagine a use-case and easy to re-implement.

Saves 1280 bytes.
2025-07-15 09:58:44 +10:00
Thomas Watson 6b3e37698f AP_Scripting: use native implementation of luaO_ceillog2
Using a builtin instruction (on Cortex M3/M4/M7) saves 268 bytes.

Tested that the result is the same for all values:

  ```c
  #include <stdio.h>
  #include <limits.h>
  #include <inttypes.h>

  int cl2_new(unsigned int x) {
    const int bitwidth = CHAR_BIT*sizeof(x);
    x--;
    const int clz = x ? __builtin_clz(x) : bitwidth; // clz(0) is undefined
    return bitwidth-clz;
  }

  int cl2_old(unsigned int x) {
    static const uint8_t log_2[256] = {  /* log_2[i] = ceil(log2(i - 1)) */
      0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
      6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
      7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
      7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
      8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
      8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
      8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
      8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
    };
    int l = 0;
    x--;
    while (x >= 256) { l += 8; x >>= 8; }
    return l + log_2[x];
  }

  int main(int argc, char** argv) {
      for (unsigned int i=1; i!=0; i++) { // 0 is not in the domain
          int v_new = cl2_new(i);
          int v_old = cl2_old(i);
          if (v_new != v_old) {
              printf("%u: %d != %d\n", i, v_new, v_old);
              break;
          }
      }
  }
  ```
2025-07-14 15:58:32 -05:00
Christian Clauss 7351a858b5 AP_Scripting: Fix ‘buff’ may be used uninitialized
Fixes: #30623
* #30623

Initialized the `buff` to remove a frequent warning in our GitHub Actions.
```diff
-  char buff[LUA_TMPNAMBUFSIZE];
+  char buff[LUA_TMPNAMBUFSIZE] = {0};
```
2025-07-13 17:14:25 +10:00
Andrew Tridgell 086472de8f AP_Scripting: added an add_route() binding
allows custom network routes
2025-07-13 13:31:59 +10:00
Andrew Tridgell 8bf182faf5 AP_Scripting: changed LTE_BAND and LTE_MCCMNC to no-change by default
avoid setting band and network if not wanted
2025-07-11 08:04:51 +10:00
Andrew Tridgell d379de6f9c AP_Scripting: support mode modem chipsets in LTE_modem driver
support Air780, EC200 and SIM7070G
add escaping to CMUX data
improved logging
2025-07-09 18:24:24 +10:00
Iampete1 cce22722e9 AP_Scripting: applets: UniversalAutoLand: rename params to avoid name conflict with native mode 2025-07-08 10:03:42 +10:00
Andrew Tridgell 85b2de8b95 AP_Scripting: added docs for plane_ship_landing.lua
based on https://discuss.ardupilot.org/t/ship-landing-support/82772
2025-07-05 18:23:23 +10:00
Peter Barker 8aaeef5724 AP_Scripting: docs_check.py: flake8 correctness
... also avoid catching bare exception, handle the case where the regex isn't matching
2025-06-22 09:04:16 +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
Christian Clauss dc9446af62 wscript: Add # flake8: noqa linter directive 2025-06-20 20:30:15 +10:00
Christian Clauss e4fb97b745 AP_Scripting: Add # flake8: noqa linter directive 2025-06-20 20:30:15 +10:00
Andrew Tridgell acda8428f8 AP_Scripting: use CMUX for LTE_modem
using CMUX allows us to have AT commands run in parallel with PPP or
TCP data, allowing for signal strength and other data to be retrieved

this also adds auto-bauding, with separate LTE_IBAUD and LTE_BAUD
parameters, avoiding the need to configure the hardware baud rate with
a terminal program
2025-06-16 12:29:44 +10:00
Andrew Tridgell 98b42cf2fc AP_Scripting: added LTE_OPTIONS to LTE driver 2025-06-16 12:29:44 +10:00
Christian Clauss 966588f714 AP_Scripting: Fix check-shebang-scripts-are-executable 2025-06-15 11:17:47 +10:00
Abdulaziz 6b30f2cccb AP_Scripting: provide bindings for parity and stop bits 2025-06-07 18:51:00 -05:00
Andrew Tridgell 63a40b65e3 AP_Scripting: rename SIM7600 to LTE_modem
we will soon be supporting other modem chipsets
2025-06-06 18:09:51 +10:00
Andrew Tridgell f86918e5ae AP_Scripting: added support for PPP connections to SIM7600 driver
this allows for the modem to be used as a PPP server, allowing the
full range of ArduPilot networking capabilities, which means multiple
TCP and UDP connections, scripting sockets etc
2025-06-06 18:09:51 +10:00
Peter Barker 1f8370b615 AP_Scripting: update scripts for get_roll->get_roll_rad rename 2025-06-05 17:28:41 +10: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
Andrew Tridgell 8cd83b8e64 AP_Scripting: LTE driver using SIM7600 AT commands
colcon build/test / build-test (push) Has been cancelled
Cygwin Build / build (push) Has been cancelled
ESP32 Build / build (esp32buzz, 10) (push) Has been cancelled
ESP32 Build / build (esp32s3empty, 10) (push) Has been cancelled
Macos Build / build (CubeOrange) (push) Has been cancelled
Macos Build / build (sitl) (push) Has been cancelled
QURT Build / build (push) Has been cancelled
test ccache / build (10, chibios) (push) Has been cancelled
test chibios / build (CubeOrange-EKF2, 10, chibios) (push) Has been cancelled
test chibios / build (CubeOrange-ODID, 10, chibios) (push) Has been cancelled
test chibios / build (CubeOrange-PPP, 10, chibios) (push) Has been cancelled
test chibios / build (CubeOrange-bootloader, 10, chibios) (push) Has been cancelled
test chibios / build (CubeRedPrimary-bootloader, 10, chibios) (push) Has been cancelled
test chibios / build (MatekF405-Wing, 10, chibios) (push) Has been cancelled
test chibios / build (Pixhawk6X-PPPGW, 10, chibios) (push) Has been cancelled
test chibios / build (SOHW, 10, chibios) (push) Has been cancelled
test chibios / build (build-options-defaults-test, 10, chibios) (push) Has been cancelled
test chibios / build (configure-all, 10, chibios) (push) Has been cancelled
test chibios / build (fmuv2-plane, 10, chibios) (push) Has been cancelled
test chibios / build (fmuv3, 10, chibios) (push) Has been cancelled
test chibios / build (fmuv3-bootloader, 10, chibios) (push) Has been cancelled
test chibios / build (iofirmware, 10, chibios) (push) Has been cancelled
test chibios / build (new-check, 10, chibios) (push) Has been cancelled
test chibios / build (periph-build, 10, chibios) (push) Has been cancelled
test chibios / build (revo-bootloader, 10, chibios) (push) Has been cancelled
test chibios / build (revo-mini, 10, chibios) (push) Has been cancelled
test chibios / build (signing, 10, chibios) (push) Has been cancelled
test chibios / build (stm32f7, 10, chibios) (push) Has been cancelled
test chibios / build (stm32h7, 10, chibios) (push) Has been cancelled
test chibios / build (stm32h7-debug, 10, chibios) (push) Has been cancelled
test dds / build (sitl) (push) Has been cancelled
test dds / build (stm32h7) (push) Has been cancelled
test Linux SBC / build (bbbmini, armhf) (push) Has been cancelled
test Linux SBC / build (bebop, armhf) (push) Has been cancelled
test Linux SBC / build (bhat, armhf) (push) Has been cancelled
test Linux SBC / build (canzero, armhf) (push) Has been cancelled
test Linux SBC / build (erlebrain2, armhf) (push) Has been cancelled
test Linux SBC / build (linux, base) (push) Has been cancelled
test Linux SBC / build (navigator, armhf-musl) (push) Has been cancelled
test Linux SBC / build (navigator64, aarch64) (push) Has been cancelled
test Linux SBC / build (navio, armhf) (push) Has been cancelled
test Linux SBC / build (navio2, armhf) (push) Has been cancelled
test Linux SBC / build (pxf, armhf) (push) Has been cancelled
test Linux SBC / build (pxfmini, armhf) (push) Has been cancelled
test replay / build (replay, base) (push) Has been cancelled
test replay / build (replay, clang) (push) Has been cancelled
test scripts / build (astyle-cleanliness) (push) Has been cancelled
test scripts / build (check_autotest_options) (push) Has been cancelled
test scripts / build (logger_metadata) (push) Has been cancelled
test scripts / build (param_parse) (push) Has been cancelled
test scripts / build (python-cleanliness) (push) Has been cancelled
test scripts / build (validate_board_list) (push) Has been cancelled
test blimp / build (base) (push) Has been cancelled
test blimp / build (clang) (push) Has been cancelled
test blimp / autotest (sitltest-blimp) (push) Has been cancelled
test copter / build (base) (push) Has been cancelled
test copter / build (clang) (push) Has been cancelled
test copter / autotest (sitltest-copter-tests1a) (push) Has been cancelled
test copter / autotest (sitltest-copter-tests1b) (push) Has been cancelled
test copter / autotest (sitltest-copter-tests1c) (push) Has been cancelled
test copter / autotest (sitltest-copter-tests1d) (push) Has been cancelled
test copter / autotest (sitltest-copter-tests1e) (push) Has been cancelled
test copter / autotest (sitltest-copter-tests2a) (push) Has been cancelled
test copter / autotest (sitltest-copter-tests2b) (push) Has been cancelled
test copter / build-gcc-heli (push) Has been cancelled
test copter / autotest-heli (sitltest-heli) (push) Has been cancelled
test ap_periph / build-gcc-ap_periph (push) Has been cancelled
test ap_periph / autotest-can (sitltest-can) (push) Has been cancelled
test plane / build (base) (push) Has been cancelled
test plane / build (clang) (push) Has been cancelled
test plane / autotest (sitltest-plane-tests1a) (push) Has been cancelled
test plane / autotest (sitltest-plane-tests1b) (push) Has been cancelled
test plane / autotest (sitltest-quadplane) (push) Has been cancelled
test rover / build (base) (push) Has been cancelled
test rover / build (clang) (push) Has been cancelled
test rover / autotest (sitltest-balancebot) (push) Has been cancelled
test rover / autotest (sitltest-rover) (push) Has been cancelled
test rover / autotest (sitltest-sailboat) (push) Has been cancelled
test sub / build (base) (push) Has been cancelled
test sub / build (clang) (push) Has been cancelled
test sub / autotest (sitltest-sub) (push) Has been cancelled
test tracker / build (base) (push) Has been cancelled
test tracker / build (clang) (push) Has been cancelled
test tracker / autotest (sitltest-tracker) (push) Has been cancelled
test unit tests and sitl building / build (examples, base) (push) Has been cancelled
test unit tests and sitl building / build (examples, clang) (push) Has been cancelled
test unit tests and sitl building / build (sitl, base) (push) Has been cancelled
test unit tests and sitl building / build (sitl, clang) (push) Has been cancelled
test unit tests and sitl building / build (unit-tests, base) (push) Has been cancelled
test unit tests and sitl building / build (unit-tests, clang) (push) Has been cancelled
test scripting / test-scripting (push) Has been cancelled
provides a transparent TCP connection to a server
2025-06-03 11:11:22 +10:00
rishabsingh3003 dab81d0f7d AP_Scripting: Correct typo in EFI DLA Driver 2025-05-27 12:56:11 +01:00
Ryan Friedman 03adf5e801 AP_Scripting: Add trisonica LI550 3D wind sensor logger
Signed-off-by: Ryan Friedman <25047695+Ryanf55@users.noreply.github.com>
2025-05-24 20:09:14 -05: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
Andrew Tridgell e519a93037 AP_Scripting: added notch params to revert param script
useful for testing notch changes in flight
2025-05-23 08:42:03 +01:00
Peter Barker 27465b5c33 AP_Scripting: param-set.lua: trim out unused MAV_SYSID parameter reference 2025-05-20 19:39:52 +10: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
Thomas Watson 62e33f847b AP_Scripting: use luaL_checklstring instead of lua_tolstring in helpers
The latter returns a null pointer (and sets the string size to zero) if
the conversion fails, which the following code neglects to check,
potentially leading to null pointer dereferences.

Instead use the former, which throws a helpful type error if it fails
and doesn't expose the code to null pointers.
2025-05-18 11:59:24 +10:00
Thomas Watson 55889f6db7 AP_Scripting: use luaL_checklstring for serial port writestring
Avoids potential null pointer dereferences if a port write method can't
handle a null pointer when doing a zero length write. Also provides a
nice type error if something that can't be converted to a string is
passed.
2025-05-18 11:58:54 +10:00
Thomas Watson a20dd5af68 AP_Scripting: avoid dereferencing NULL for non-string error objects
Various places print "error objects", which are nominally things passed
to `error()`. However, the user can pass anything to that function, e.g.
`error(nil)`. This causes `lua_tostring` to return `NULL` and the string
format to dereference that pointer if it happens at the top level.

Fix the issue by using a helper to convert error objects to strings that
returns a sentinel string if the conversion fails.
2025-05-18 11:58:54 +10:00
Andrew Tridgell f30766f645 AP_Scripting: added BatteryTag applet 2025-05-17 09:25:46 +10:00
Peter BarkerandRyan Friedman 2e414af057 AP_Scripting: correct use of pcall in examples and applets
Co-authored-by: Ryan Friedman <25047695+Ryanf55@users.noreply.github.com>
2025-05-17 08:16:52 +10:00
Peter Barker a85e9b679a AP_Scripting: plane_ship_landing.lua: add pos/vel sanity check
this method can return false if the target is outside the AP_Follow acceptance radius.  So we can be receiving messages from the target, so have_target can be true, but false is returned from get_target_location_and_velocity_ofs, meaning we try to call methods on nil values
2025-05-14 11:06:56 +10:00
Andrew Tridgell 78d42fcf24 AP_Scripting: example of using DroneCAN messaging 2025-05-09 13:08:40 +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
Stephen Dade d0b310668c AP_Scripting: fix cast-local-type in Rockblock and MAVLinkHL 2025-04-29 17:21:00 +01:00
Iampete1 4e1457e86b AP_Scripting: temporarily ignore lua language server issues 2025-04-29 11:29:28 +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