Commit Graph

64078 Commits

Author SHA1 Message Date
Andy Piper eaf001c52f Copter: disable fences for landing by suppressing in the fence check rather than using a state machine 2024-07-24 08:24:06 +10:00
Andy Piper 46d6d0bf03 Plane: disable fences for landing by suppressing in the fence check rather than using a state machine 2024-07-24 08:24:06 +10:00
Andy Piper 04dd7de1ed AC_Fence: disable fences for landing by suppressing in the fence check rather than using a state machine
simplify takeoff auto-enablement
2024-07-24 08:24:06 +10:00
Andy Piper c216536a94 autotest: test aborted landing with fence correctly 2024-07-24 08:24:06 +10:00
Andy Piper ee7742ac40 Plane: use reset_fence_floor_enable() 2024-07-24 08:24:06 +10:00
Andy Piper d5c6f3fe06 AC_Fence: add reset_fence_floor_enable() and use it in plane when landing is aborted 2024-07-24 08:24:06 +10:00
Andy Piper cedccdb8fe autotest: add test for auto-disabling min alt fence breaches on disarming
clean-up fence manipulation functions and add test for auto-enablement on copter
update tests to have some FENCE_ENABLE tests
add avoidance minimum and maximum altitude fence
add fence switch test while flying
add FenceAutoEnableDisableSwitch for auto mode 2
add more scenarios for plane fence auto-enable
validate fence rc switch behaviour
check fence autoenable by taking off in guided mode
more FENCE_AUTOENABLE tests
add FenceEnableDisableAux and FenceMinAltAutoEnableAbort
2024-07-24 08:24:06 +10:00
Peter Barker a4c7819117 AC_Fence: clear breach of disabled fence
skip breach checks if no fences
correct initialisation of _num_fences in the case of no fences in eeprom
2024-07-24 08:24:06 +10:00
Andy Piper 3fabec4158 AP_Arming: ensure fence enablement on arming is inverted on disarming 2024-07-24 08:24:06 +10:00
Andy Piper 174d5f07bb AC_Fence: ensure fence enablement on arming is inverted on disarming
correct detection of polyfence
2024-07-24 08:24:06 +10:00
Andy Piper f0f8187c7f AC_Fence: add ability to auto-enable fence floor while doing fence checks
control copter floor fence with autoenable
autoenable floor fence with a margin
check for manual recovery only after having checked the fences
make auto-disabling for minimum altitude fence an option
output message when fence floor auto-enabled
re-use fence floor auto-enable/disable from plane
auto-disable on landing
do not update enable parameter when controlling through mavlink
make sure get_enabled_fences() actually returns enabled fences.
make current fences enabled internal state rather than persistent
implement auto options correctly and on copter
add fence names utility
use ExpandingString for constructing fence names
correctly check whether fences are enabled or not and disable min alt for landing in all auto modes
add enable_configured() for use by mavlink and rc
add events for all fence types
make sure that auto fences are no longer candidates after manual updates
add fence debug
make sure rc switch is the ultimate authority on fences
reset auto mask when enabling or disabling fencing
ensure auto-enable on arming works as intended
simplify printing fence notices
reset autofences when auot-enablement is changed
2024-07-24 08:24:06 +10:00
Andy Piper 370b0d7b9c AP_Logger: add events for all fence types 2024-07-24 08:24:06 +10:00
Henry Wurzburg a6300e35d0 Plane: prevent Mode Takeoff calling fence autoenable more than once 2024-07-24 08:24:06 +10:00
Andy Piper 4fc59ae67d Rover: use fence enable_configured() 2024-07-24 08:24:06 +10:00
Andy Piper 559bd1e252 Plane: use fence enable_configured()
avoid fence breach clearing spam
2024-07-24 08:24:06 +10:00
Andy Piper 0288e1e79c RC_Channel: use fence enable_configured() 2024-07-24 08:24:06 +10:00
Andy Piper d16615923d AP_Frsky_Telem: use fence enable_configured() 2024-07-24 08:24:06 +10:00
Andy Piper 0c6ea4790d AP_Common: fix initialization of ExpandingString so that it can be used on the stack
zero out passed in buffers for ExpandingString
2024-07-24 08:24:06 +10:00
Andy Piper 8c2f686bfa Plane: output user-friendly fence messages 2024-07-24 08:24:06 +10:00
Andy Piper 3dbcbe0026 AP_Arming: do not enable minimim altitude fence on arming
call appropriate fence method for auto-enablement
2024-07-24 08:24:06 +10:00
Andy Piper 8287d4f2d0 AC_Avoidance: take into account minimum altitude fence when calculating climb rate 2024-07-24 08:24:06 +10:00
Andy Piper 95b39f64e3 AP_Mission: add comment about new fence API 2024-07-24 08:24:06 +10:00
Andy Piper f73154349b GCS_MAVLink: use bitmask based enablement for fences 2024-07-24 08:24:06 +10:00
Andy Piper 738586342c Copter: notify when fence breach has cleared
output fence breach type
when switching mode without a fence action do not go into manual recovery
only recover if there is a fence action
implement auto-takeoff fence options
output user-friendly fence names
auto-enable fences on auto-takeoff
use fence enable_configured()
simplify message printing
2024-07-24 08:24:06 +10:00
Bob Long 230269bed8 HAL_ChibiOS: add adjustable wdg timeout for hwdefs
This allows the watchdog timeout to be adjusted in the hwdef.dat file,
so that critical nodes like ESCs can recover more quickly.
2024-07-23 19:53:38 +10:00
Andrew Tridgell 03bdbea77c hwdef: enable relay support in MatekL431-DShot fw
the PWM expansion boards can also be used for relay control, often
combined with PWM output
2024-07-23 18:42:56 +10:00
Alex P 0190e70da4 Tools: Reserving board id for Stellar F4 in board_types.txt 2024-07-23 17:01:45 +10:00
Rhys Mainwaring 4354072d34 SITL: SIM_Rover: add simulation for omni3 mecanum rover
Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
2024-07-23 13:27:04 +10:00
Rhys Mainwaring 0272f59d0c Tools: autotest: add rover-omni3mecanum
- Add frame rover-omni3mecanum.
- Remove params with default values.

Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
2024-07-23 13:27:04 +10:00
Ben Butterworth 0a9a8d9178 Tools: install-prereqs-ubuntu.sh: fix script after setuptools==71.0.0 release
Use newest `packaging` to avoid packaging incompatibility with `setuptools>=71.0`

As https://github.com/pypa/setuptools/issues/4496#issuecomment-2240322375 mentions:
> setuptools>=71.0 does not work with packaging<24.0, but will not upgrade it if packaging is already installed

Also relevant: https://github.com/pypa/setuptools/issues/4496
2024-07-23 13:22:04 +10:00
Thomas Watson b6adb4c7e7 DroneCAN: update DSDL compiler
Fixes the following issues:

 * Compound array elements subject to tail array optimization could be
decoded incorrectly, causing a decode failure.

 * Invalid array lengths could be sent over the wire if a
longer-than-max array was encoded (though only the max number of
elements was sent).

 * Lengths were not validated when decoding arrays of compound elements
using TAO, causing memory corruption if an invalid length was received.

 * Union tags were not validated, causing undefined behavior if an
invalid tag was received.
2024-07-23 12:08:48 +10:00
James O'Shannessy ce0ae33c5b AP_HAL_ChibiOS: Capture the case where the persistent parameter is the newer format INSn_ACC_ID
This fixes the handling of the newer INSn_* parameters when loading those stored in persistent memory.
2024-07-23 12:06:18 +10:00
James O'Shannessy c771440ea4 AP_InertialSensor: Fix persistent storing of IMU Z Scale
Fixes INSn_ACCSCAL_Z not being stored in persistent storage when bootloader is flashed.
2024-07-23 11:59:49 +10:00
xiaozhou e2cb4ba232 AP_Mount: Topotek image tracking fix
Co-authored-by: Randy Mackay <rmackay9@yahoo.com>
2024-07-23 10:51:09 +10:00
xiaozhou 69e4005bb6 AP_Mount: Topotek retrieves model name
Co-authored-by: Randy Mackay <rmackay9@yahoo.com>
2024-07-23 10:51:09 +10:00
xiaozhou 858aff5f4f AP_Mount: Topotek handles new version format
Co-authored-by: Randy Mackay <rmackay9@yahoo.com>
2024-07-23 10:51:09 +10:00
muramura 7731fc09e2 AP_HAL_SITL: If HAL_CAN_WITH_SOCKETCAN is undefined, treat it as NONE 2024-07-23 10:47:16 +10:00
Michael du Breuil edaddc0431 AP_TECS: Use aircraft stall speed
When stall prevention is enabled we were scaling from the aircraft's
minimum flight speed. However this is normally already picked as being
above the stall speed, and for a variety of reasons we may want to pin
the aircraft at a higher minimum speed. But if the aircraft was
commanded to fly to close to that minimum speed as soon as it banked for
a pattern it would command a increase in speed to keep it away from
stalling. However if your minimum speed is far from stalling this
increase was incorrect. To make it worse what this actually results in
happening is an aircraft diving for more speed (over 10 m/s on some
aircraft) as well as descending to gain that speed resulting in over 200
foot deviations in altitude control.
2024-07-23 10:37:24 +10:00
Michael du Breuil 80277e6da0 ArduPlane: Add a stall speed parameter 2024-07-23 10:37:24 +10:00
Michael du Breuil 5005809e74 AP_Vehicle: add stall speed parameter for plane 2024-07-23 10:37:24 +10:00
Thomas Watson b64ed6ca56 AP_Scripting: dynamically load some binding objects
Only create the binding object (singleton metatable/userdata or C
function reference) once the user first references a particular
singleton or userdata creation function. Once created, the object is
stored into the script's environment so it doesn't get recreated on the
next reference and there isn't any further overhead. The userdatas are
no longer shared between scripts which imposes a slight memory penalty
for multiple scripts using the same singleton but this avoids an
additional lookup time cost.

Userdata and ap_objects aren't eligible for this optimization as the C++
code might want a particular metatable at any time.

Saves ~9.3K Lua heap.
2024-07-23 10:34:52 +10:00
Thomas Watson 059af2117d AP_Scripting: place bindings into global table
The global table is then used as the __index metamethod of each state's
environment table. Avoids the overhead of loading binding objects into
each state. The binding objects are immutable from Lua so sandboxing is
not violated.

Does have the slight downside that a script can no longer know all the
binding names by enumerating _ENV.

Saves ~700B of memory per loaded script.
2024-07-23 10:34:52 +10:00
Thomas Watson 9cbec043d0 AP_Scripting: remove __call metamethod from singleton metatables
The __call metamethod was set to the metatable itself. With __call not
present, Lua will try to call the metatable (and fail), which is the
same behavior as with the __call metamethod set to the metatable.

Saves ~2K Lua heap.
2024-07-23 10:34:52 +10:00
Thomas Watson 8e303675fe AP_Scripting: don't put userdata and ap_objects into globals
They are never accessed from globals. Only their metatables are
accessed, using luaL_getmetatable.

Saves ~2.9K of Lua heap.
2024-07-23 10:34:52 +10:00
Thomas Watson 50eac0ef31 AP_Scripting: keep enum definitions in flash
Saves ~100B of statically allocated RAM.
2024-07-23 10:34:52 +10:00
chiara-septentrio fc8147ead0 AP_GPS:Septentrio constellation choice 2024-07-23 10:32:32 +10:00
Willian Galvani 7b5c1f16c1 tools: firmware_version_decoder.py: fix detection for BETA+n firmware 2024-07-22 14:57:47 -03:00
Peter Barker 56773f09b4 AP_Scripting: docs for get_resistance 2024-07-22 09:09:26 +10:00
Peter Barker 6514a3522b AP_Scripting: add battery-resistance-checking example 2024-07-22 09:09:26 +10:00
Peter Barker e94ebe4d1a AP_Scripting: add battery resistance to bindings 2024-07-22 09:09:26 +10:00